void () { overrideJreHiDPIEnabled(true); @SuppressWarnings("UndesirableClassUsage") Graphics2D g = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB).createGraphics(); try { g.scale(2, 2); assertTrue(PaintUtil.getParityMode(1, g).even()); assertTrue(PaintUtil.getParityMode(1.1, ScaleContext.create(g), null).even()); assertTrue(PaintUtil.getParityMode(1.1, ScaleContext.create(g), RoundingMode.FLOOR).even()); assertTrue(PaintUtil.getParityMode(1.1, ScaleContext.create(g), RoundingMode.ROUND).even()); assertTrue(!PaintUtil.getParityMode(1.1, ScaleContext.create(g), RoundingMode.CEIL).even()); assertEquals(1.0, PaintUtil.alignToInt(1, g, (RoundingMode)null)); assertEquals(1.0, PaintUtil.alignToInt(1, g, (ParityMode)null)); assertEquals(1.0, PaintUtil.alignToInt(1.1, g, RoundingMode.FLOOR)); assertEquals(1.0, PaintUtil.alignToInt(1.1, g, RoundingMode.ROUND)); assertEquals(1.5, PaintUtil.alignToInt(1.1, g, RoundingMode.CEIL)); assertEquals(1.5, PaintUtil.alignToInt(1.1, ScaleContext.create(g), null, ParityMode.ODD)); assertEquals(1.5, PaintUtil.alignToInt(1.1, ScaleContext.create(g), RoundingMode.ROUND, ParityMode.ODD)); assertEquals(0.5, PaintUtil.alignToInt(1.1, ScaleContext.create(g), RoundingMode.FLOOR, ParityMode.ODD)); assertEquals(1.5, PaintUtil.alignToInt(1.1, ScaleContext.create(g), RoundingMode.CEIL, ParityMode.ODD)); assertEquals(1.0, PaintUtil.alignToInt(1.1, ScaleContext.create(g), null, ParityMode.EVEN)); assertEquals(1.0, PaintUtil.alignToInt(1.1, ScaleContext.create(g), RoundingMode.ROUND, ParityMode.EVEN)); assertEquals(1.0, PaintUtil.alignToInt(1.1, ScaleContext.create(g), RoundingMode.FLOOR, ParityMode.EVEN)); assertEquals(2.0, PaintUtil.alignToInt(1.1, ScaleContext.create(g), RoundingMode.CEIL, ParityMode.EVEN)); } finally { g.dispose(); } }