X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fbin%2FHiDPISettingTest1.java;h=49a721f99e9ae1caacf67348250831ea4490376b;hb=91b3af9bfa70fc853ec6e74096454e17882a7543;hp=fd27a34c9bd92b0d0a389ef423ab131e91eaf53a;hpb=58f6e2a689afae0b869f28f8874cd735f0cfd129;p=jalview.git diff --git a/test/jalview/bin/HiDPISettingTest1.java b/test/jalview/bin/HiDPISettingTest1.java index fd27a34..49a721f 100644 --- a/test/jalview/bin/HiDPISettingTest1.java +++ b/test/jalview/bin/HiDPISettingTest1.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.bin; import static org.testng.Assert.assertEquals; @@ -12,6 +32,7 @@ import jalview.gui.Desktop; import jalview.gui.JvOptionPane; import jalview.io.DataSourceType; import jalview.io.FileLoader; +import jalview.util.Platform; /* * Testing a HiDPI display is difficult without running in a HiDPI display. @@ -64,7 +85,8 @@ public class HiDPISettingTest1 @AfterClass(alwaysRun = true) public void tearDown() { - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }) @@ -87,20 +109,22 @@ public class HiDPISettingTest1 setMockScreen(1920, 1080, 96); assertEquals(HiDPISetting.getScalePropertyArg(), null); + // currently HiDPISetting only operates for Linux + // 4K screen -- scale by 2 setMockScreen(3180, 2160, 80); assertEquals(HiDPISetting.getScalePropertyArg(), - "-D" + scalePropertyName + "=2"); + Platform.isLinux() ? "-D" + scalePropertyName + "=2" : null); // 4K screen with high dpi -- scale by 3 setMockScreen(3180, 2160, 450); assertEquals(HiDPISetting.getScalePropertyArg(), - "-D" + scalePropertyName + "=3"); + Platform.isLinux() ? "-D" + scalePropertyName + "=3" : null); // stupidly big screen -- scale by 8 setMockScreen(19200, 10800, 72); assertEquals(HiDPISetting.getScalePropertyArg(), - "-D" + scalePropertyName + "=8"); + Platform.isLinux() ? "-D" + scalePropertyName + "=8" : null); } }