Skip to content

Commit 810cbcc

Browse files
amartya4256HeikoKlare
authored andcommitted
Fix specific WidgetWin32Tests to not use Layout
Some of the tests in WidgetWin32Tests assert the size of the controls after DPI_CHANGE. The tests work fine since theres no updateLayout called but its deffered to be executed after the thread is free and hence the controls size are unaffected. However this is risky and layouting can make the values arbitrary and the tests can fail. Hence, we simply test the absolute values without using any Layout in this commit.
1 parent d5273ee commit 810cbcc

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/WidgetWin32Tests.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,14 @@ public void testButtonPointsAfterZooming() throws NoSuchMethodException, Illegal
5555
int scaledZoom = zoom * 2;
5656

5757
shell.setBounds(0, 0, 100, 160);
58-
shell.setLayout(new FillLayout());
59-
shell.pack();
6058

6159
Button button = new Button(shell, SWT.PUSH);
6260
button.setText("Button");
6361
button.setBounds(0, 0, 100, 200);
64-
Point sizeBeforeEvent = button.getSize();
65-
Point p1 = button.computeSizeInPixels(sizeBeforeEvent.x, sizeBeforeEvent.y, false);
62+
Point p1 = button.getSize();
63+
6664
DPITestUtil.changeDPIZoom(shell, scaledZoom);
67-
Point sizeAfterEvent = button.getSize();
68-
Point p2 = button.computeSizeInPixels(sizeAfterEvent.x, sizeAfterEvent.y, false);
65+
Point p2 = button.getSize();
6966

7067
assertEquals("Width should be half in points after zooming to 200", p1.x / 2 , p2.x);
7168
assertEquals("Height should be half in points after zooming to 200", p1.y / 2, p2.y);
@@ -134,8 +131,6 @@ public void testCoolItemAfterZooming() {
134131

135132

136133
shell.setBounds(0, 0, 100, 160);
137-
shell.setLayout(new FillLayout());
138-
shell.pack();
139134

140135
CoolBar coolBar = new CoolBar(shell, SWT.NONE);
141136
CoolItem item1 = new CoolItem(coolBar, SWT.NONE);
@@ -200,8 +195,6 @@ public void testTabFolderSizeAfterZooming() {
200195
int scaledZoom = zoom * 2;
201196

202197
shell.setBounds(0, 0, 100, 160);
203-
shell.setLayout(new FillLayout());
204-
shell.pack();
205198

206199
TabFolder tabFolder = new TabFolder(shell, SWT.NONE);
207200
tabFolder.setBounds(20, 20, 360, 240);

0 commit comments

Comments
 (0)