Skip to content

Commit 7a03c60

Browse files
ptzieglerHeikoKlare
authored andcommitted
[Win32] Add test case to check auto-scaling mode calculation
This adds test cases to check that the auto-scaling mode is correctly read from the widget data and correctly propagated to child widgets.
1 parent 8dcdeab commit 7a03c60

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,4 +369,45 @@ void testChildShellGetSize() {
369369
assertEquals(300, childShell.getSizeInPixels().x);
370370
}
371371

372+
@Test
373+
public void testAutoScaleDisabledProperty() {
374+
Display display = Display.getDefault();
375+
Shell shell = new Shell(display);
376+
shell.setData("AUTOSCALE_DISABLED", true);
377+
assertEquals(AutoscalingMode.DISABLED_INHERITED, shell.autoscalingMode);
378+
Composite child = new Composite(shell, SWT.NONE);
379+
assertEquals(AutoscalingMode.DISABLED_INHERITED, child.autoscalingMode);
380+
}
381+
382+
@Test
383+
public void testAutoScaleDisabled() {
384+
Display display = Display.getDefault();
385+
Shell shell = new Shell(display);
386+
shell.setAutoscalingMode(AutoscalingMode.DISABLED);
387+
assertEquals(AutoscalingMode.DISABLED, shell.autoscalingMode);
388+
Composite child = new Composite(shell, SWT.NONE);
389+
assertEquals(AutoscalingMode.ENABLED, child.autoscalingMode);
390+
}
391+
392+
@Test
393+
public void testPropagateAutoScaleDisabledProperty() {
394+
Display display = Display.getDefault();
395+
Shell shell = new Shell(display);
396+
shell.setData("AUTOSCALE_DISABLED", true);
397+
shell.setData("PROPOGATE_AUTOSCALE_DISABLED", false);
398+
assertEquals(AutoscalingMode.DISABLED, shell.autoscalingMode);
399+
Composite child = new Composite(shell, SWT.NONE);
400+
assertEquals(AutoscalingMode.ENABLED, child.autoscalingMode);
401+
}
402+
403+
@Test
404+
public void testPropagateAutoScaleDisabled() {
405+
Display display = Display.getDefault();
406+
Shell shell = new Shell(display);
407+
shell.setAutoscalingMode(AutoscalingMode.DISABLED_INHERITED);
408+
assertEquals(AutoscalingMode.DISABLED_INHERITED, shell.autoscalingMode);
409+
Composite child = new Composite(shell, SWT.NONE);
410+
assertEquals(AutoscalingMode.DISABLED_INHERITED, child.autoscalingMode);
411+
}
412+
372413
}

0 commit comments

Comments
 (0)