From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27578 invoked by alias); 23 Feb 2006 03:05:29 -0000 Received: (qmail 27564 invoked by uid 22791); 23 Feb 2006 03:05:28 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 23 Feb 2006 03:05:25 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id k1N35OcM026422 for ; Wed, 22 Feb 2006 22:05:24 -0500 Received: from pobox.toronto.redhat.com (pobox.toronto.redhat.com [172.16.14.4]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id k1N35N103152 for ; Wed, 22 Feb 2006 22:05:23 -0500 Received: from tortoise.toronto.redhat.com (tortoise.toronto.redhat.com [172.16.14.92]) by pobox.toronto.redhat.com (8.12.8/8.12.8) with ESMTP id k1N35N93031447 for ; Wed, 22 Feb 2006 22:05:23 -0500 Subject: FYI: new JFrame test From: Thomas Fitzsimmons To: mauve-discuss@sources.redhat.com Content-Type: multipart/mixed; boundary="=-iTWviILzku3n/xXVa+0r" Date: Thu, 23 Feb 2006 03:05:00 -0000 Message-Id: <1140663923.1404.212.camel@tortoise.toronto.redhat.com> Mime-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact mauve-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sourceware.org X-SW-Source: 2006-q1/txt/msg00045.txt.bz2 --=-iTWviILzku3n/xXVa+0r Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 183 Hi, I committed this heavyweight-in-JFrame test. Tom 2006-02-22 Thomas Fitzsimmons * gnu/testlet/javax/swing/JFrame/HeavyweightComponent.java: New test. --=-iTWviILzku3n/xXVa+0r Content-Disposition: inline; filename=mauve-jframe-heavyweight.patch Content-Type: text/x-patch; name=mauve-jframe-heavyweight.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 3050 Index: HeavyweightComponent.java =================================================================== RCS file: HeavyweightComponent.java diff -N HeavyweightComponent.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ HeavyweightComponent.java 23 Feb 2006 02:59:34 -0000 @@ -0,0 +1,91 @@ +// Tags: JDK1.2 GUI + +// Copyright (C) 2006 Red Hat + +// This file is part of Mauve. + +// Mauve is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) +// any later version. + +// Mauve is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Mauve; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +package gnu.testlet.javax.swing.JFrame; + +import gnu.testlet.Testlet; +import gnu.testlet.TestHarness; +import gnu.testlet.java.awt.LocationTests; + +import javax.swing.JFrame; +import javax.swing.JComponent; +import java.awt.*; +import java.util.Vector; + +/** + * These tests pass with the Sun JDK 1.4.2_05 on GNU/Linux IA-32. + */ +public class HeavyweightComponent implements Testlet { + + // Tests that a heavyweight component is drawn at the correct location + // within a JFrame. + public void test(TestHarness harness) { + int outer_width = 100; + int outer_height = 100; + int inner_width = 0; + int inner_height = 0; + + Robot r = harness.createRobot(); + + JFrame f = new JFrame(); + f.setLayout(null); + Canvas c = new Canvas() { + public void paint(Graphics g) { + Rectangle r = getBounds(); + g.setColor(Color.red); + // Subtract 1 from width and height since Graphics methods take + // *co-ordinates* as arguments, not widths and heights. + g.drawRect(r.x, r.y, r.width - 1, r.height - 1); + } + }; + f.setSize(outer_width, outer_height); + f.add(c); + f.show(); + + // Wait for native frame to be fully displayed. + r.waitForIdle(); + r.delay(1000); + + Insets i = f.getInsets(); + // Calculate area inside window frame. + inner_width = outer_width - i.left - i.right; + inner_height = outer_height - i.top - i.bottom; + + c.setBounds(0, 0, inner_width, inner_height); + + // bounds of red rectangle (1 pixel wide border) + Point loc = f.getLocationOnScreen(); + Rectangle bounds = new Rectangle(loc.x + i.left, loc.y + i.top, + inner_width, inner_height); + + // Wait for Canvas to paint itself. + r.waitForIdle(); + r.delay(1000); + + // Check that the Canvas fills the entire JFrame, within the JFrame's + // window frame. + LocationTests.checkRectangleCornerColors(harness, r, bounds, Color.red, + true); + + // There is a delay so the tester can see the result. + r.delay(3000); + } +} --=-iTWviILzku3n/xXVa+0r--