102 // Because we want to catch the "size-grip" of the frame.
103 System.out.println("The test environment must have non-zero right & bottom insets! The current insets are: " + insets);
104 pass();
105 return;
106 }
107
108 // Let's move the mouse pointer to the bottom-right coner of the frame (the "size-grip")
109 Rectangle bounds = frame.getBounds();
110
111 robot.mouseMove(bounds.x + bounds.width - 1, bounds.y + bounds.height - 1);
112
113 // From now on the ANCESTOR_RESIZED events get counted.
114 HierarchyBoundsListener listener = new HierarchyBoundsListenerImpl();
115 for (int i = 0; i < components.length; i++) {
116 components[i].addHierarchyBoundsListener(listener);
117 frame.add(components[i]);
118 }
119
120 // ... and start resizing
121 robot.mousePress( InputEvent.BUTTON1_MASK );
122 robot.mouseMove(bounds.x + bounds.width + 20, bounds.y + bounds.height + 15);
123 Util.waitForIdle(robot);
124
125 if (ancestorResizedCounter == 0) {
126 robot.mouseRelease( InputEvent.BUTTON1_MASK );
127 AncestorResized.fail("No ANCESTOR_RESIZED events received.");
128 return;
129 }
130
131 robot.mouseRelease( InputEvent.BUTTON1_MASK );
132
133 AncestorResized.pass();
134 }//End init()
135
136
137
138 /*****************************************************
139 * Standard Test Machinery Section
140 * DO NOT modify anything in this section -- it's a
141 * standard chunk of code which has all of the
142 * synchronisation necessary for the test harness.
143 * By keeping it the same in all tests, it is easier
144 * to read and understand someone else's test, as
145 * well as insuring that all tests behave correctly
146 * with the test harness.
147 * There is a section following this for test-
148 * classes
149 ******************************************************/
150 private static boolean theTestPassed = false;
151 private static boolean testGeneratedInterrupt = false;
152 private static String failureMessage = "";
|
102 // Because we want to catch the "size-grip" of the frame.
103 System.out.println("The test environment must have non-zero right & bottom insets! The current insets are: " + insets);
104 pass();
105 return;
106 }
107
108 // Let's move the mouse pointer to the bottom-right coner of the frame (the "size-grip")
109 Rectangle bounds = frame.getBounds();
110
111 robot.mouseMove(bounds.x + bounds.width - 1, bounds.y + bounds.height - 1);
112
113 // From now on the ANCESTOR_RESIZED events get counted.
114 HierarchyBoundsListener listener = new HierarchyBoundsListenerImpl();
115 for (int i = 0; i < components.length; i++) {
116 components[i].addHierarchyBoundsListener(listener);
117 frame.add(components[i]);
118 }
119
120 // ... and start resizing
121 robot.mousePress( InputEvent.BUTTON1_MASK );
122
123 for (int i = 0; i<20; i++)
124 {
125 robot.mouseMove(bounds.x + bounds.width + i, bounds.y + bounds.height + i);
126 Util.waitForIdle(robot);
127 }
128
129 if (ancestorResizedCounter == 0) {
130 robot.mouseRelease( InputEvent.BUTTON1_MASK );
131 AncestorResized.fail("No ANCESTOR_RESIZED events received.");
132 return;
133 }
134
135 robot.mouseRelease( InputEvent.BUTTON1_MASK );
136
137 Sysout.println("ANCESTOR_RESIZED event received" + ancestorResizedCounter + " times");
138
139 AncestorResized.pass();
140 }//End init()
141
142
143
144 /*****************************************************
145 * Standard Test Machinery Section
146 * DO NOT modify anything in this section -- it's a
147 * standard chunk of code which has all of the
148 * synchronisation necessary for the test harness.
149 * By keeping it the same in all tests, it is easier
150 * to read and understand someone else's test, as
151 * well as insuring that all tests behave correctly
152 * with the test harness.
153 * There is a section following this for test-
154 * classes
155 ******************************************************/
156 private static boolean theTestPassed = false;
157 private static boolean testGeneratedInterrupt = false;
158 private static String failureMessage = "";
|