This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
Re: FYI: New Lightweight tests
> > Also, I think this test should be simplified. The test is:
> >
> > A Frame containing a lighweight container. The lightweight container
> > contains a heavyweight child. The lightweight container is moved but
> > not resized (so that the heavyweight's position changes relative to the
> > frame but not relative to its parent). So the test should be:
> >
> > - show a Frame with a null layout and a green background, with
> > lightweight child at a given size and location. inside that lightweight
> > child, add a blue heavyweight panel
> >
> > - wait for a second
> >
> > - call Component.move on the lightweight child
> >
> > - check for the blue heavyweight panel's position relative to the frame
> >
> > Without our patch, the panel will not move and so will end up in the
> > wrong location relative to the frame. With our patch it will move along
> > with the lightweight container and end up in the right position.
>
Fixed. But it appears that our patch is not correct still!
2006-02-24 Lillian Angel <langel@redhat.com>
* gnu/testlet/java/awt/Container/LightweightContainer.java
(testLoc2): Simplified test.
Index: gnu/testlet/java/awt/Container/LightweightContainer.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/Container/LightweightContainer.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- gnu/testlet/java/awt/Container/LightweightContainer.java 23 Feb 2006 20:39:48 -0000 1.6
+++ gnu/testlet/java/awt/Container/LightweightContainer.java 24 Feb 2006 15:16:14 -0000 1.7
@@ -140,61 +140,32 @@
{
Robot r = harness.createRobot();
Frame f = new Frame();
- f.setLayout(new BorderLayout());
-
- Panel HW = new Panel();
- HW.setLayout (new BorderLayout());
- HW.add (new testPanel(Color.green), BorderLayout.CENTER);
- f.add(HW, BorderLayout.CENTER);
-
- testContainer LW = new testContainer();
- GridBagLayout gridbag = new GridBagLayout();
- GridBagConstraints c = new GridBagConstraints();
- LW.setLayout(gridbag);
-
- Button b1 = new Button("Button1");
- Button b2 = new Button("Button2");
- Button b3 = new Button("Button3");
- Label l = new Label("Label");
- Panel pan = new Panel(new GridLayout(3, 2, 2, 2));
- Label l2 = new Label("", Label.CENTER);
-
- pan.add(l);
- pan.add(b1);
- pan.add(b2);
- pan.add(b3);
-
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 0.0; c.weighty = 0.0;
- c.insets = new Insets(4, 4, 1, 1);
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.gridwidth = 1;
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.weightx = 1.0; c.weighty = 1.0;
- gridbag.setConstraints(l2, c);
- LW.add(l2);
- c.weightx = 1.0; c.weighty = 0.0;
- gridbag.setConstraints(pan, c);
- LW.add(pan);
- f.add(LW, BorderLayout.EAST);
-
+ f.setLayout(null);
+ f.setBackground(Color.green);
+ testContainer tc = new testContainer();
+ f.add(tc);
f.setSize(500, 500);
+ tc.setBounds(100, 0, 200, 200);
+ testPanel p = new testPanel(Color.yellow);
+ tc.add(p);
+ p.setBounds(10, 10, 50, 50);
f.show();
- // Wait for delay to avoid race conditions
+ // There is a delay to avoid any race conditions.
r.waitForIdle();
- r.delay(2000);
+ r.delay(1000);
+
+ Point pt = p.getLocationOnScreen();
+ tc.move(150, 50);
- Point p = f.getLocationOnScreen();
- int x = LW.getX() + f.getInsets().left + p.x - 1;
- int y = pan.getY() + f.getInsets().top + p.y;
- Color d = r.getPixelColor(x, y);
- LocationTests.checkColor(harness, d, Color.blue, false);
- Color e = r.getPixelColor(x - 2, y);
- LocationTests.checkColor(harness, e, Color.blue, true);
+ r.delay(1000);
+ Point pt2 = p.getLocationOnScreen();
+ harness.check(pt2.x, (pt.x + 50));
+ harness.check(pt2.y, (pt.y + 50));
+
// There is a delay so the tester can see the result.
- r.delay(2000);
+ r.delay(3000);
}
class testPanel extends Panel