< prev index next >
test/jdk/java/awt/GraphicsDevice/DisplayModes/CompareToXrandrTest.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 22,32 ****
*/
/**
* @test
* @key headful
! * @bug 8022810
* @summary Cannot list all the available display modes on Ubuntu linux in case
* of two screen devices
* @run main CompareToXrandrTest
*/
--- 22,32 ----
*/
/**
* @test
* @key headful
! * @bug 8022810 8196616
* @summary Cannot list all the available display modes on Ubuntu linux in case
* of two screen devices
* @run main CompareToXrandrTest
*/
*** 47,67 ****
if (!new File("/usr/bin/xrandr").exists()) {
System.out.println("No xrandr tool to compare");
return;
}
! BufferedReader reader = new BufferedReader(new InputStreamReader(
! Runtime.getRuntime().exec("/usr/bin/xrandr").getInputStream()));
! reader.readLine();
! reader.readLine();
Pattern pattern = Pattern.compile("^\\s*(\\d+x\\d+)");
for (GraphicsDevice d : GraphicsEnvironment
.getLocalGraphicsEnvironment().getScreenDevices()) {
Set<String> xrandrModes = reader.lines().map(pattern::matcher)
! .takeWhile(Matcher::find).map(m -> m.group(1))
.collect(Collectors.toSet());
Set<String> javaModes = Arrays.stream(d.getDisplayModes())
.map(m -> m.getWidth() + "x" + m.getHeight())
.collect(Collectors.toSet());
--- 47,65 ----
if (!new File("/usr/bin/xrandr").exists()) {
System.out.println("No xrandr tool to compare");
return;
}
! try (BufferedReader reader = new BufferedReader(new InputStreamReader(
! Runtime.getRuntime().exec("/usr/bin/xrandr").getInputStream()))) {
Pattern pattern = Pattern.compile("^\\s*(\\d+x\\d+)");
for (GraphicsDevice d : GraphicsEnvironment
.getLocalGraphicsEnvironment().getScreenDevices()) {
Set<String> xrandrModes = reader.lines().map(pattern::matcher)
! .filter(Matcher::find).map(m -> m.group(1))
.collect(Collectors.toSet());
Set<String> javaModes = Arrays.stream(d.getDisplayModes())
.map(m -> m.getWidth() + "x" + m.getHeight())
.collect(Collectors.toSet());
*** 72,77 ****
--- 70,76 ----
System.out.println("Device " + d + ": " + javaModes.size() +
" modes found.");
}
}
}
+ }
}
< prev index next >