diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java index aa19d2c843f..a517ed9942b 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 Yatta Solutions + * Copyright (c) 2024, 2025 Yatta Solutions and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -13,18 +13,19 @@ *******************************************************************************/ package org.eclipse.swt.tests.junit; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; -import static org.junit.Assume.assumeFalse; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; import org.eclipse.swt.graphics.Device; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.internal.DPIUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; /** * Automated Test Suite for class org.eclipse.swt.internal.DPIUtil @@ -32,18 +33,18 @@ * @see org.eclipse.swt.internal.DPIUtil */ @SuppressWarnings("restriction") +@DisabledOnOs(value = org.junit.jupiter.api.condition.OS.LINUX, disabledReason = "Linux uses Cairo auto scaling, thus DPIUtil scaling is disabled") public class DPIUtilTests { private int deviceZoom; - @Before + @BeforeEach public void setup() { - assumeFalse("Linux uses Cairo auto scaling, thus DPIUtil scaling is disabled", SwtTestUtil.isLinux); deviceZoom = DPIUtil.getDeviceZoom(); DPIUtil.setDeviceZoom(200); } - @After + @AfterEach public void tearDown() { DPIUtil.setDeviceZoom(deviceZoom); } @@ -55,24 +56,24 @@ public void scaleDownFloatArray() { float[] valueAt100 = new float[] { 1, 1.5f, 2 }; float[] scaledValue = DPIUtil.autoScaleDown(valueAt200); - assertArrayEquals(String.format("Scaling down float array from device zoom (%d) to 100 failed", - DPIUtil.getDeviceZoom()), valueAt100, scaledValue, .001f); + assertArrayEquals(valueAt100, scaledValue, .001f, String.format("Scaling down float array from device zoom (%d) to 100 failed", + DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.autoScaleDown((Device) null, valueAt200); - assertArrayEquals(String.format("Scaling down float array from device zoom (%d) to 100 with device failed", - DPIUtil.getDeviceZoom()), valueAt100, scaledValue, .001f); + assertArrayEquals(valueAt100, scaledValue, .001f, String.format("Scaling down float array from device zoom (%d) to 100 with device failed", + DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.scaleDown(valueAt200, 200); - assertArrayEquals("Scaling down float array from 200 failed", valueAt100, scaledValue, .001f); + assertArrayEquals(valueAt100, scaledValue, .001f, "Scaling down float array from 200 failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt200, 200); - assertArrayEquals("Scaling down float array from 200 with device failed", valueAt100, scaledValue, .001f); + assertArrayEquals(valueAt100, scaledValue, .001f, "Scaling down float array from 200 with device failed"); scaledValue = DPIUtil.scaleDown(valueAt150, 150); - assertArrayEquals("Scaling down float array from 150 failed", valueAt100, scaledValue, .001f); + assertArrayEquals(valueAt100, scaledValue, .001f, "Scaling down float array from 150 failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt150, 150); - assertArrayEquals("Scaling down float array from 150 with device failed", valueAt100, scaledValue, .001f); + assertArrayEquals(valueAt100, scaledValue, .001f, "Scaling down float array from 150 with device failed"); scaledValue = DPIUtil.scaleDown(valueAt100, 100); - assertSame("Scaling down float array without zoom change failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling down float array without zoom change failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt100, 100); - assertSame("Scaling down float array without zoom change with device failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling down float array without zoom change with device failed"); } @Test @@ -83,24 +84,23 @@ public void scaleDownInteger() { int scaledValue = DPIUtil.autoScaleDown(valueAt200); assertEquals( - String.format("Scaling down integer from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()), - valueAt100, scaledValue); + valueAt100, scaledValue, String.format("Scaling down integer from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.autoScaleDown((Device) null, valueAt200); - assertEquals(String.format("Scaling down integer from device zoom (%d) to 100 with device failed", - DPIUtil.getDeviceZoom()), valueAt100, scaledValue); + assertEquals( + valueAt100, scaledValue, String.format("Scaling down integer from device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.scaleDown(valueAt200, 200); - assertEquals("Scaling down integer from 200 failed", valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, "Scaling down integer from 200 failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt200, 200); - assertEquals("Scaling down integer from 200 with device failed", valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, "Scaling down integer from 200 with device failed"); scaledValue = DPIUtil.scaleDown(valueAt150, 150); - assertEquals("Scaling down integer from 150 failed", valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, "Scaling down integer from 150 failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt150, 150); - assertEquals("Scaling down integer from 150 with device failed", valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, "Scaling down integer from 150 with device failed"); scaledValue = DPIUtil.scaleDown(valueAt100, 100); - assertSame("Scaling down integer without zoom change failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling down integer without zoom change failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt100, 100); - assertSame("Scaling down integer without zoom change with device failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling down integer without zoom change with device failed"); } @Test @@ -110,25 +110,24 @@ public void scaleDownFloat() { float valueAt100 = 5f; float scaledValue = DPIUtil.autoScaleDown(valueAt200); - assertEquals( - String.format("Scaling down float from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()), - valueAt100, scaledValue, .001f); + assertEquals(valueAt100, scaledValue, .001f, + String.format("Scaling down float from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.autoScaleDown((Device) null, valueAt200); - assertEquals(String.format("Scaling down float from device zoom (%d) to 100 with device failed", - DPIUtil.getDeviceZoom()), valueAt100, scaledValue, .001f); + assertEquals(valueAt100, scaledValue, .001f, String + .format("Scaling down float from device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.scaleDown(valueAt200, 200); - assertEquals("Scaling down float from 200 failed", valueAt100, scaledValue, .001f); + assertEquals(valueAt100, scaledValue, .001f, "Scaling down float from 200 failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt200, 200); - assertEquals("Scaling down float from 200 with device failed", valueAt100, scaledValue, .001f); + assertEquals(valueAt100, scaledValue, .001f, "Scaling down float from 200 with device failed"); scaledValue = DPIUtil.scaleDown(valueAt150, 150); - assertEquals("Scaling down float from 150 failed", valueAt100, scaledValue, .001f); + assertEquals(valueAt100, scaledValue, .001f, "Scaling down float from 150 failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt150, 150); - assertEquals("Scaling down float from 150 with device failed", valueAt100, scaledValue, .001f); + assertEquals(valueAt100, scaledValue, .001f, "Scaling down float from 150 with device failed"); scaledValue = DPIUtil.scaleDown(valueAt100, 100); - assertEquals("Scaling down float without zoom change failed", valueAt100, scaledValue, .001f); + assertEquals(valueAt100, scaledValue, .001f, "Scaling down float without zoom change failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt100, 100); - assertEquals("Scaling down float without zoom change with device failed", valueAt100, scaledValue, .001f); + assertEquals(valueAt100, scaledValue, .001f, "Scaling down float without zoom change with device failed"); } @Test @@ -138,25 +137,24 @@ public void scaleDownPoint() { Point valueAt100 = new Point(5, 7); Point scaledValue = DPIUtil.autoScaleDown(valueAt200); - assertEquals( - String.format("Scaling down Point from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()), - valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, + String.format("Scaling down Point from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.autoScaleDown((Device) null, valueAt200); - assertEquals(String.format("Scaling down Point from device zoom (%d) to 100 with device failed", - DPIUtil.getDeviceZoom()), valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, String + .format("Scaling down Point from device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.scaleDown(valueAt200, 200); - assertEquals("Scaling down Point from 200 failed", valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, "Scaling down Point from 200 failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt200, 200); - assertEquals("Scaling down Point from 200 with device failed", valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, "Scaling down Point from 200 with device failed"); scaledValue = DPIUtil.scaleDown(valueAt150, 150); - assertEquals("Scaling down Point from 150 failed", valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, "Scaling down Point from 150 failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt150, 150); - assertEquals("Scaling down Point from 150 with device failed", valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, "Scaling down Point from 150 with device failed"); scaledValue = DPIUtil.scaleDown(valueAt100, 100); - assertSame("Scaling down Point without zoom change failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling down Point without zoom change failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt100, 100); - assertSame("Scaling down Point without zoom change with device failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling down Point without zoom change with device failed"); } @Test @@ -166,24 +164,24 @@ public void scaleDownRectangle() { Rectangle valueAt100 = new Rectangle(50, 75, 5, 7); Rectangle scaledValue = DPIUtil.autoScaleDown(valueAt200); - assertEquals(String.format("Scaling down Rectangle from device zoom (%d) to 100 failed", - DPIUtil.getDeviceZoom()), valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, + String.format("Scaling down Rectangle from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.autoScaleDown((Device) null, valueAt200); - assertEquals(String.format("Scaling down Rectangle from device zoom (%d) to 100 with device failed", - DPIUtil.getDeviceZoom()), valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, String.format( + "Scaling down Rectangle from device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.scaleDown(valueAt200, 200); - assertEquals("Scaling down Rectangle from 200 failed", valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, "Scaling down Rectangle from 200 failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt200, 200); - assertEquals("Scaling down Rectangle from 200 with device failed", valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, "Scaling down Rectangle from 200 with device failed"); scaledValue = DPIUtil.scaleDown(valueAt150, 150); - assertEquals("Scaling down Rectangle from 150 failed", valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, "Scaling down Rectangle from 150 failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt150, 150); - assertEquals("Scaling down Rectangle from 150 with device failed", valueAt100, scaledValue); + assertEquals(valueAt100, scaledValue, "Scaling down Rectangle from 150 with device failed"); scaledValue = DPIUtil.scaleDown(valueAt100, 100); - assertSame("Scaling down Rectangle without zoom change failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling down Rectangle without zoom change failed"); scaledValue = DPIUtil.scaleDown((Device) null, valueAt100, 100); - assertSame("Scaling down Rectangle without zoom change with device failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling down Rectangle without zoom change with device failed"); } @Test @@ -193,25 +191,24 @@ public void scaleUpIntArray() { int[] valueAt100 = new int[] { 5, 6, 7 }; int[] scaledValue = DPIUtil.autoScaleUp(valueAt100); - assertArrayEquals( - String.format("Scaling up int array to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()), - valueAt200, scaledValue); + assertArrayEquals(valueAt200, scaledValue, + String.format("Scaling up int array to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.autoScaleUp((Device) null, valueAt100); - assertArrayEquals(String.format("Scaling up int array to device zoom (%d) to 100 with device failed", - DPIUtil.getDeviceZoom()), valueAt200, scaledValue); + assertArrayEquals(valueAt200, scaledValue, String + .format("Scaling up int array to device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.scaleUp(valueAt100, 200); - assertArrayEquals("Scaling up int array to 200 failed", valueAt200, scaledValue); + assertArrayEquals(valueAt200, scaledValue, "Scaling up int array to 200 failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 200); - assertArrayEquals("Scaling up int array to 200 with device failed", valueAt200, scaledValue); + assertArrayEquals(valueAt200, scaledValue, "Scaling up int array to 200 with device failed"); scaledValue = DPIUtil.scaleUp(valueAt100, 150); - assertArrayEquals("Scaling up int array to 150 failed", valueAt150, scaledValue); + assertArrayEquals(valueAt150, scaledValue, "Scaling up int array to 150 failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 150); - assertArrayEquals("Scaling up int array to 150 with device failed", valueAt150, scaledValue); + assertArrayEquals(valueAt150, scaledValue, "Scaling up int array to 150 with device failed"); scaledValue = DPIUtil.scaleUp(valueAt100, 100); - assertSame("Scaling up int array without zoom change failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling up int array without zoom change failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 100); - assertSame("Scaling up int array without zoom change with device failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling up int array without zoom change with device failed"); } @Test @@ -221,24 +218,24 @@ public void scaleUpInteger() { int valueAt100 = 5; int scaledValue = DPIUtil.autoScaleUp(valueAt100); - assertEquals(String.format("Scaling up integer to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()), - valueAt200, scaledValue); + assertEquals(valueAt200, scaledValue, + String.format("Scaling up integer to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.autoScaleUp((Device) null, valueAt100); - assertEquals(String.format("Scaling up integer to device zoom (%d) to 100 with device failed", - DPIUtil.getDeviceZoom()), valueAt200, scaledValue); + assertEquals(valueAt200, scaledValue, String + .format("Scaling up integer to device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.scaleUp(valueAt100, 200); - assertEquals("Scaling up integer to 200 failed", valueAt200, scaledValue); + assertEquals(valueAt200, scaledValue, "Scaling up integer to 200 failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 200); - assertEquals("Scaling up integer to 200 with device failed", valueAt200, scaledValue); + assertEquals(valueAt200, scaledValue, "Scaling up integer to 200 with device failed"); scaledValue = DPIUtil.scaleUp(valueAt100, 150); - assertEquals("Scaling up integer to 150 failed", valueAt150, scaledValue); + assertEquals(valueAt150, scaledValue, "Scaling up integer to 150 failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 150); - assertEquals("Scaling up integer to 150 with device failed", valueAt150, scaledValue); + assertEquals(valueAt150, scaledValue, "Scaling up integer to 150 with device failed"); scaledValue = DPIUtil.scaleUp(valueAt100, 100); - assertSame("Scaling up integer without zoom change failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling up integer without zoom change failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 100); - assertSame("Scaling up integer without zoom change with device failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue,"Scaling up integer without zoom change with device failed"); } @Test @@ -248,24 +245,24 @@ public void scaleUpFloat() { float valueAt100 = 5; float scaledValue = DPIUtil.autoScaleUp(valueAt100); - assertEquals(String.format("Scaling up integer to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()), - valueAt200, scaledValue, 0.001f); + assertEquals(valueAt200, scaledValue, 0.001f, + String.format("Scaling up integer to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.autoScaleUp((Device) null, valueAt100); - assertEquals(String.format("Scaling up integer to device zoom (%d) to 100 with device failed", - DPIUtil.getDeviceZoom()), valueAt200, scaledValue, 0.001f); + assertEquals(valueAt200, scaledValue, 0.001f, String + .format("Scaling up integer to device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.scaleUp(valueAt100, 200); - assertEquals("Scaling up integer to 200 failed", valueAt200, scaledValue, 0.001f); + assertEquals(valueAt200, scaledValue, 0.001f, "Scaling up integer to 200 failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 200); - assertEquals("Scaling up integer to 200 with device failed", valueAt200, scaledValue, 0.001f); + assertEquals(valueAt200, scaledValue, 0.001f, "Scaling up integer to 200 with device failed"); scaledValue = DPIUtil.scaleUp(valueAt100, 150); - assertEquals("Scaling up integer to 150 failed", valueAt150, scaledValue, 0.001f); + assertEquals(valueAt150, scaledValue, 0.001f, "Scaling up integer to 150 failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 150); - assertEquals("Scaling up integer to 150 with device failed", valueAt150, scaledValue, 0.001f); + assertEquals(valueAt150, scaledValue, 0.001f, "Scaling up integer to 150 with device failed"); scaledValue = DPIUtil.scaleUp(valueAt100, 100); - assertEquals("Scaling up integer without zoom change failed", valueAt100, scaledValue, 0.001f); + assertEquals(valueAt100, scaledValue, 0.001f, "Scaling up integer without zoom change failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 100); - assertEquals("Scaling up integer without zoom change with device failed", valueAt100, scaledValue, 0.001f); + assertEquals(valueAt100, scaledValue, 0.001f, "Scaling up integer without zoom change with device failed"); } @Test @@ -275,24 +272,24 @@ public void scaleUpPoint() { Point valueAt100 = new Point(5, 7); Point scaledValue = DPIUtil.autoScaleUp(valueAt100); - assertEquals(String.format("Scaling up Point to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()), - valueAt200, scaledValue); + assertEquals(valueAt200, scaledValue, + String.format("Scaling up Point to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.autoScaleUp((Device) null, valueAt100); - assertEquals(String.format("Scaling up Point to device zoom (%d) to 100 with device failed", - DPIUtil.getDeviceZoom()), valueAt200, scaledValue); + assertEquals(valueAt200, scaledValue, String + .format("Scaling up Point to device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.scaleUp(valueAt100, 200); - assertEquals("Scaling up Point to 200 failed", valueAt200, scaledValue); + assertEquals(valueAt200, scaledValue, "Scaling up Point to 200 failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 200); - assertEquals("Scaling up Point to 200 with device failed", valueAt200, scaledValue); + assertEquals(valueAt200, scaledValue, "Scaling up Point to 200 with device failed"); scaledValue = DPIUtil.scaleUp(valueAt100, 150); - assertEquals("Scaling up Point to 150 failed", valueAt150, scaledValue); + assertEquals(valueAt150, scaledValue, "Scaling up Point to 150 failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 150); - assertEquals("Scaling up Point to 150 with device failed", valueAt150, scaledValue); + assertEquals(valueAt150, scaledValue, "Scaling up Point to 150 with device failed"); scaledValue = DPIUtil.scaleUp(valueAt100, 100); - assertSame("Scaling up Point without zoom change failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling up Point without zoom change failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 100); - assertSame("Scaling up Point without zoom change with device failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling up Point without zoom change with device failed"); } @Test @@ -302,24 +299,23 @@ public void scaleUpRectangle() { Rectangle valueAt100 = new Rectangle(50, 75, 5, 7); Rectangle scaledValue = DPIUtil.autoScaleUp(valueAt100); - assertEquals( - String.format("Scaling up Rectangle to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()), - valueAt200, scaledValue); + assertEquals(valueAt200, scaledValue, + String.format("Scaling up Rectangle to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.autoScaleUp((Device) null, valueAt100); - assertEquals(String.format("Scaling up Rectangle to device zoom (%d) to 100 with device failed", - DPIUtil.getDeviceZoom()), valueAt200, scaledValue); + assertEquals(valueAt200, scaledValue, String + .format("Scaling up Rectangle to device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom())); scaledValue = DPIUtil.scaleUp(valueAt100, 200); - assertEquals("Scaling up Rectangle to 200 failed", valueAt200, scaledValue); + assertEquals(valueAt200, scaledValue, "Scaling up Rectangle to 200 failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 200); - assertEquals("Scaling up Rectangle to 200 with device failed", valueAt200, scaledValue); + assertEquals(valueAt200, scaledValue, "Scaling up Rectangle to 200 with device failed"); scaledValue = DPIUtil.scaleUp(valueAt100, 150); - assertEquals("Scaling up Rectangle to 150 failed", valueAt150, scaledValue); + assertEquals(valueAt150, scaledValue, "Scaling up Rectangle to 150 failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 150); - assertEquals("Scaling up Rectangle to 150 with device failed", valueAt150, scaledValue); + assertEquals(valueAt150, scaledValue, "Scaling up Rectangle to 150 with device failed"); scaledValue = DPIUtil.scaleUp(valueAt100, 100); - assertSame("Scaling up Rectangle without zoom change failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling up Rectangle without zoom change failed"); scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 100); - assertSame("Scaling up Rectangle without zoom change with device failed", valueAt100, scaledValue); + assertSame(valueAt100, scaledValue, "Scaling up Rectangle without zoom change with device failed"); } }