mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-8949 Wayland: java/awt/Gtk/GtkVersionTest/GtkVersionTest.java: Wrong GTK library version: null
This commit is contained in:
@@ -27,9 +27,13 @@
|
||||
* @summary "Fail forward" fails for GTK3 if no GTK2 available
|
||||
* @modules java.desktop/sun.awt
|
||||
* @requires (os.family == "linux")
|
||||
* @library /test/lib
|
||||
* @run main GtkVersionTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.StringArrayUtils;
|
||||
|
||||
import sun.awt.UNIXToolkit;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
@@ -44,22 +48,31 @@ public class GtkVersionTest {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
test(null, "3");
|
||||
test("2", "2");
|
||||
test("2.2", "2");
|
||||
String toolkitName = Toolkit.getDefaultToolkit().getClass().getName();
|
||||
boolean isWLToolkit = "sun.awt.wl.WLToolkit".equals(toolkitName);
|
||||
|
||||
if (!isWLToolkit) {
|
||||
test(null, "3");
|
||||
test("2", "2");
|
||||
test("2.2", "2");
|
||||
}
|
||||
test("3", "3");
|
||||
}
|
||||
|
||||
private static void test(String version, String expect) throws Exception {
|
||||
System.out.println( "Test " +
|
||||
(version == null ? "no" : " GTK" + version) + " preference.");
|
||||
Process p = Runtime.getRuntime().exec(System.getProperty("java.home") +
|
||||
"/bin/java " +
|
||||
(version == null ? "" : "-Djdk.gtk.version=" + version) +
|
||||
" -Djdk.gtk.verbose=true " +
|
||||
"--add-exports=java.desktop/sun.awt=ALL-UNNAMED " +
|
||||
"-cp " + System.getProperty("java.class.path", ".") +
|
||||
" GtkVersionTest$LoadGtk");
|
||||
|
||||
String args[] = StringArrayUtils.concat(
|
||||
"--add-exports=java.desktop/sun.awt=ALL-UNNAMED",
|
||||
"-Djdk.gtk.verbose=true");
|
||||
if (version != null) {
|
||||
args = StringArrayUtils.concat(args, "-Djdk.gtk.version=" + version);
|
||||
}
|
||||
args = StringArrayUtils.concat(args, LoadGtk.class.getName());
|
||||
|
||||
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(args);
|
||||
Process p = ProcessTools.startProcess("GTK test", pb);
|
||||
p.waitFor();
|
||||
|
||||
try (BufferedReader br = new BufferedReader(
|
||||
|
||||
Reference in New Issue
Block a user