15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 import java.awt.Dialog; 25 import java.awt.Frame; 26 import java.awt.Graphics; 27 import java.awt.Graphics2D; 28 import java.awt.geom.AffineTransform; 29 import javax.swing.UIManager; 30 31 /* @test 32 * @bug 8137571 33 * @summary Linux HiDPI Graphics support 34 * @author Alexander Scherbatiy 35 * @requires (os.family == "linux") 36 * @run main/othervm -Dsun.java2d.uiScale.enabled=false 37 * -Dsun.java2d.uiScale=2 38 * HiDPIPropertiesLinuxTest UISCALE_DISABLED 39 * HiDPIPropertiesTest UISCALE_DISABLED 40 * @run main/othervm -Dsun.java2d.uiScale.enabled=true 41 * -Dsun.java2d.uiScale=3 42 * HiDPIPropertiesLinuxTest UISCALE_3 43 * @run main/othervm -Dsun.java2d.uiScale=4 44 * HiDPIPropertiesLinuxTest UISCALE_4 45 */ 46 public class HiDPIPropertiesLinuxTest { 47 48 public static void main(String[] args) throws Exception { 49 50 try { 51 UIManager.setLookAndFeel( 52 "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); 53 } catch (Exception e) { 54 return; 55 } 56 57 String testCase = args[0]; 58 switch (testCase) { 59 case "UISCALE_DISABLED": 60 testScale(1.0, 1.0); 61 break; 62 case "UISCALE_3": 63 testScale(3.0, 3.0); 64 break; 65 case "UISCALE_4": 66 testScale(4.0, 4.0); 67 break; 68 default: 69 throw new RuntimeException("Unknown test case: " + testCase); 70 } 71 } 72 73 private static void testScale(double scaleX, double scaleY) { 74 75 Dialog dialog = new Dialog((Frame) null, true) { | 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 import java.awt.Dialog; 25 import java.awt.Frame; 26 import java.awt.Graphics; 27 import java.awt.Graphics2D; 28 import java.awt.geom.AffineTransform; 29 import javax.swing.UIManager; 30 31 /* @test 32 * @bug 8137571 33 * @summary Linux HiDPI Graphics support 34 * @author Alexander Scherbatiy 35 * @requires (os.family == "linux" | os.family == "mac") 36 * @run main/othervm -Dsun.java2d.uiScale.enabled=false 37 * -Dsun.java2d.uiScale=2 38 * HiDPIPropertiesUnixTest UISCALE_DISABLED 39 * @run main/othervm -Dsun.java2d.uiScale.enabled=true 40 * -Dsun.java2d.uiScale=3 41 * HiDPIPropertiesUnixTest UISCALE_3 42 * @run main/othervm -Dsun.java2d.uiScale=4 43 * HiDPIPropertiesUnixTest UISCALE_4 44 */ 45 public class HiDPIPropertiesUnixTest { 46 47 public static void main(String[] args) throws Exception { 48 49 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 50 51 String testCase = args[0]; 52 switch (testCase) { 53 case "UISCALE_DISABLED": 54 testScale(1.0, 1.0); 55 break; 56 case "UISCALE_3": 57 testScale(3.0, 3.0); 58 break; 59 case "UISCALE_4": 60 testScale(4.0, 4.0); 61 break; 62 default: 63 throw new RuntimeException("Unknown test case: " + testCase); 64 } 65 } 66 67 private static void testScale(double scaleX, double scaleY) { 68 69 Dialog dialog = new Dialog((Frame) null, true) { |