8196616: ava/awt/GraphicsDevice/DisplayModes/CompareToXrandrTest.java fails
Reviewed-by: prr, mhalder
This commit is contained in:
parent
9130f2314c
commit
4d00df3200
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -24,7 +24,7 @@
|
||||
/**
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 8022810
|
||||
* @bug 8022810 8196616
|
||||
* @summary Cannot list all the available display modes on Ubuntu linux in case
|
||||
* of two screen devices
|
||||
* @run main CompareToXrandrTest
|
||||
@ -49,28 +49,27 @@ public class CompareToXrandrTest {
|
||||
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+)");
|
||||
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()) {
|
||||
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> 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());
|
||||
Set<String> javaModes = Arrays.stream(d.getDisplayModes())
|
||||
.map(m -> m.getWidth() + "x" + m.getHeight())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
if (!xrandrModes.equals(javaModes)) {
|
||||
throw new RuntimeException("Failed");
|
||||
} else {
|
||||
System.out.println("Device " + d + ": " + javaModes.size() +
|
||||
" modes found.");
|
||||
if (!xrandrModes.equals(javaModes)) {
|
||||
throw new RuntimeException("Failed");
|
||||
} else {
|
||||
System.out.println("Device " + d + ": " + javaModes.size() +
|
||||
" modes found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user