diff --git a/.jcheck/conf b/.jcheck/conf index e8b8223875e..046197ae090 100644 --- a/.jcheck/conf +++ b/.jcheck/conf @@ -5,6 +5,7 @@ version=17.0.13 [checks] error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists +warning=issuestitle,binary [repository] tags=(?:jdk-(?:[1-9]([0-9]*)(?:\.(?:0|[1-9][0-9]*)){0,4})(?:\+(?:(?:[0-9]+))|(?:-ga)))|(?:jdk[4-9](?:u\d{1,3})?-(?:(?:b\d{2,3})|(?:ga)))|(?:hs\d\d(?:\.\d{1,2})?-b\d\d) diff --git a/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java b/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java index 5921b7cfca5..840c0055b9a 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java +++ b/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java @@ -388,7 +388,7 @@ private void onCertificate(ServerHandshakeContext shc, ClientAuthType.CLIENT_AUTH_REQUESTED) { // unexpected or require client authentication throw shc.conContext.fatal(Alert.BAD_CERTIFICATE, - "Empty server certificate chain"); + "Empty client certificate chain"); } else { return; } @@ -405,7 +405,7 @@ private void onCertificate(ServerHandshakeContext shc, } } catch (CertificateException ce) { throw shc.conContext.fatal(Alert.BAD_CERTIFICATE, - "Failed to parse server certificates", ce); + "Failed to parse client certificates", ce); } checkClientCerts(shc, x509Certs); @@ -1247,7 +1247,7 @@ private static X509Certificate[] checkClientCerts( } } catch (CertificateException ce) { throw shc.conContext.fatal(Alert.BAD_CERTIFICATE, - "Failed to parse server certificates", ce); + "Failed to parse client certificates", ce); } // find out the types of client authentication used diff --git a/test/hotspot/jtreg/compiler/codecache/CheckCodeCacheInfo.java b/test/hotspot/jtreg/compiler/codecache/CheckCodeCacheInfo.java index 26f563788f8..03fae1c3890 100644 --- a/test/hotspot/jtreg/compiler/codecache/CheckCodeCacheInfo.java +++ b/test/hotspot/jtreg/compiler/codecache/CheckCodeCacheInfo.java @@ -28,9 +28,7 @@ * @library /test/lib * @requires vm.debug * - * @run driver jdk.test.lib.helpers.ClassFileInstaller - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * compiler.codecache.CheckCodeCacheInfo + * @run driver compiler.codecache.CheckCodeCacheInfo */ package compiler.codecache; @@ -69,9 +67,9 @@ public class CheckCodeCacheInfo { public static void main(String[] args) throws Exception { ProcessBuilder pb; - pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintCodeCache", - "-XX:+Verbose", - "-version"); + pb = ProcessTools.createTestJvm("-XX:+PrintCodeCache", + "-XX:+Verbose", + "-version"); OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldHaveExitValue(0); out.stdoutShouldMatch(VERBOSE_REGEXP); diff --git a/test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java b/test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java index 395e2bbdbfd..652d0b0b526 100644 --- a/test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java +++ b/test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java @@ -33,6 +33,7 @@ * @test * @bug 8276036 8277213 8277441 * @summary test for the value of full_count in the message of insufficient codecache + * @requires vm.compMode != "Xint" * @library /test/lib */ public class CodeCacheFullCountTest { @@ -54,7 +55,7 @@ public static void wasteCodeCache() throws Exception { } public static void runTest() throws Throwable { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createTestJvm( "-XX:ReservedCodeCacheSize=2496k", "-XX:-UseCodeCacheFlushing", "CodeCacheFullCountTest", "WasteCodeCache"); OutputAnalyzer oa = ProcessTools.executeProcess(pb); // Ignore adapter creation failures diff --git a/test/hotspot/jtreg/compiler/codecache/cli/TestSegmentedCodeCacheOption.java b/test/hotspot/jtreg/compiler/codecache/cli/TestSegmentedCodeCacheOption.java index 2a810abdd48..a5068b47454 100644 --- a/test/hotspot/jtreg/compiler/codecache/cli/TestSegmentedCodeCacheOption.java +++ b/test/hotspot/jtreg/compiler/codecache/cli/TestSegmentedCodeCacheOption.java @@ -25,6 +25,7 @@ * @test * @bug 8015774 * @summary Verify SegmentedCodeCache option's processing + * @requires vm.flagless * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler diff --git a/test/hotspot/jtreg/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java b/test/hotspot/jtreg/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java index 7ae62407ece..4d52f470645 100644 --- a/test/hotspot/jtreg/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java +++ b/test/hotspot/jtreg/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java @@ -26,6 +26,7 @@ * @key randomness * @bug 8015774 * @summary Verify processing of options related to code heaps sizing. + * @requires vm.flagless * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler diff --git a/test/hotspot/jtreg/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java b/test/hotspot/jtreg/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java index 223d683fc24..c0d826e59ec 100644 --- a/test/hotspot/jtreg/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java +++ b/test/hotspot/jtreg/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java @@ -25,6 +25,7 @@ * @test * @bug 8015774 * @summary Verify that PrintCodeCache option print correct information. + * @requires vm.flagless * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/README.md b/test/hotspot/jtreg/compiler/lib/ir_framework/README.md index 8a405b3f246..d07760a1fcc 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/README.md +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/README.md @@ -10,17 +10,17 @@ The framework is intended to be used in JTreg tests. The JTreg header of the tes * @library /test/lib / * @run driver my.package.MySimpleTest */ - + package my.package; - + import compiler.lib.ir_framework.*; public class MySimpleTest { - + public static void main(String[] args) { TestFramework.run(); // The framework runs all tests of this class. } - + @Test @IR(failOn = IRNode.STORE) // Fail if the IR of myTest() contains any stores. public void myTest() { @@ -29,14 +29,14 @@ The framework is intended to be used in JTreg tests. The JTreg header of the tes } There are various ways how to set up and run a test within the `main()` method of a JTreg test. These are described and can be found in the [TestFramework](./TestFramework.java) class. - + ## 2. Features The framework offers various annotations and flags to control how your test code should be invoked and being checked. This section gives an overview over all these features. ### 2.1 Different Tests There are three kinds of tests depending on how much control is needed over the test invocation. #### Base Tests -The simplest form of testing provides a single `@Test` annotated method which the framework will invoke as part of the testing. The test method has no or well-defined arguments that the framework can automatically provide. +The simplest form of testing provides a single `@Test` annotated method which the framework will invoke as part of the testing. The test method has no or well-defined arguments that the framework can automatically provide. More information on base tests with a precise definition can be found in the Javadocs of [Test](./Test.java). Concrete examples on how to specify a base test can be found in [BaseTestsExample](../../../testlibrary_tests/ir_framework/examples/BaseTestExample.java). @@ -57,12 +57,12 @@ The user has the possibility to add an additional `@IR` annotation to any `@Test - A `failOn` check that verifies that the provided regex is not matched in the C2 IR. - A `counts` check that verifies that the provided regex is matched a user defined number of times in the C2 IR. - + A regex can either be a custom string or any of the default regexes provided by the framework in [IRNode](./IRNode.java) for some commonly used IR nodes (also provides the possibility of composite regexes). -An IR verification cannot always be performed. For example, a JTreg test could be run with _-Xint_ or not a debug build (_-XX:+PrintIdeal_ and _-XX:+PrintOptoAssembly_ are debug build flags). But also CI tier testing could add additional JTreg VM and Javaoptions flags which could make an IR rule unstable. +An IR verification cannot always be performed. For example, a JTreg test could be run with _-Xint_ or not a debug build (_-XX:+PrintIdeal_ and _-XX:+PrintOptoAssembly_ are debug build flags). But also CI tier testing could add additional JTreg VM and Javaoptions flags which could make an IR rule unstable. -In general, the framework will only perform IR verification if the used VM flags allow a C2 compilation and if non-critical additional JTreg VM and Javaoptions are provided (see whiteflag list in [TestFramework](./TestFramework.java)). The user test code, however, can specify any flags which still allow an IR verification to be performed if a C2 compilation is done (expected flags by user defined `@IR` annotations). +In general, the framework will only perform IR verification if the used VM flags allow a C2 compilation and if non-critical additional JTreg VM and Javaoptions are provided (see whiteflag list in [TestFramework](./TestFramework.java)). The user test code, however, can specify any flags which still allow an IR verification to be performed if a C2 compilation is done (expected flags by user defined `@IR` annotations). An `@IR` annotation allows additional preconditions/restrictions on the currently present VM flags to enable or disable rules when certain flags are present or have a specific value (see `applyIfXX` properties of an `@IR` annotation). @@ -90,6 +90,7 @@ The framework provides various stress and debug flags. They should mainly be use - `-DExclude=test3`: Provide a list of `@Test` method names which should be excluded from execution. - `-DScenarios=1,2`: Provide a list of scenario indexes to specify which scenarios should be executed. - `-DWarmup=200`: Provide a new default value of the number of warm-up iterations (framework default is 2000). This might have an influence on the resulting IR and could lead to matching failures (the user can also set a fixed default warm-up value in a test with `testFrameworkObject.setDefaultWarmup(200)`). +- `-DReportStdout=true`: Print the standard output of the test VM. - `-DVerbose=true`: Enable more fain-grained logging (slows the execution down). - `-DReproduce=true`: Flag to use when directly running a test VM to bypass dependencies to the driver VM state (for example, when reproducing an issue). - `-DPrintTimes=true`: Print the execution time measurements of each executed test. @@ -99,16 +100,17 @@ The framework provides various stress and debug flags. They should mainly be use - `-DShuffleTests=false`: Disables the random execution order of all tests (such a shuffling is always done by default). - `-DDumpReplay=true`: Add the `DumpReplay` directive to the test VM. - `-DGCAfter=true`: Perform `System.gc()` after each test (slows the execution down). -- `-TestCompilationTimeout=20`: Change the default waiting time (default: 10s) for a compilation of a normal `@Test` annotated method. +- `-DTestCompilationTimeout=20`: Change the default waiting time (default: 10s) for a compilation of a normal `@Test` annotated method. - `-DWaitForCompilationTimeout=20`: Change the default waiting time (default: 10s) for a compilation of a `@Test` annotated method with compilation level [WAIT\_FOR\_COMPILATION](./CompLevel.java). -- `-DIgnoreCompilerControls=false`: Ignore all compiler controls applied in the framework. This includes any compiler control annotations (`@DontCompile`, `@DontInline`, `@ForceCompile`, `@ForceInline`, `@ForceCompileStaticInitializer`), the exclusion of `@Run` and `@Check` methods from compilation, and the directive to not inline `@Test` annotated methods. - +- `-DIgnoreCompilerControls=true`: Ignore all compiler controls applied in the framework. This includes any compiler control annotations (`@DontCompile`, `@DontInline`, `@ForceCompile`, `@ForceInline`, `@ForceCompileStaticInitializer`), the exclusion of `@Run` and `@Check` methods from compilation, and the directive to not inline `@Test` annotated methods. +- `-DExcludeRandom=true`: Randomly exclude some methods from compilation. +- `-DPreferCommandLineFlags=true`: Prefer flags set via the command line over flags specified by the tests. ## 3. Test Framework Execution This section gives an overview of how the framework is executing a JTreg test that calls the framework from within its `main()` method. The framework will spawn a new "test VM" to execute the user defined tests. The test VM collects all tests of the test class specified by the user code in `main()` and ensures that there is no violation of the required format by the framework. In a next step, the framework does the following for each test in general: -1. Warm the test up for a predefined number of times (default 2000). This can also be adapted for all tests by using `testFrameworkobject.setDefaultWarmup(100)` or for individual tests with an additional [@Warmup](./Warmup.java) annotation. +1. Warm the test up for a predefined number of times (default 2000). This can also be adapted for all tests by using `testFrameworkobject.setDefaultWarmup(100)` or for individual tests with an additional [@Warmup](./Warmup.java) annotation. 2. After the warm-up is finished, the framework compiles the associated `@Test` annotated method at the specified compilation level (default: C2). 3. After the compilation, the test is invoked one more time. @@ -116,8 +118,8 @@ Once the test VM terminates, IR verification (if possible) is performed on the o Some of the steps above can be different due to the kind of the test or due to using non-default annotation properties. These details and differences are described in the Javadocs for the three tests (see section 2.1 Different Tests). -More information about the internals and the workflow of the framework can be found in the Javadocs of [TestFramework](./TestFramework.java). - +More information about the internals and the workflow of the framework can be found in the Javadocs of [TestFramework](./TestFramework.java). + ## 4. Internal Framework Tests There are various tests to verify the correctness of the test framework. These tests can be found in [ir_framework](../../../testlibrary_tests/ir_framework) and can directly be run with JTreg. The tests are part of the normal JTreg tests of HotSpot and should be run upon changing the framework code as a minimal form of testing. diff --git a/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java b/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java index 297415de850..c282a784203 100644 --- a/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java +++ b/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -40,13 +40,13 @@ public class TestDisableDefaultGC { public static void main(String[] args) throws Exception { // Start VM, disabling all possible default GCs - ProcessBuilder pb = GCArguments.createJavaProcessBuilder("-XX:-UseSerialGC", - "-XX:-UseParallelGC", - "-XX:-UseG1GC", - "-XX:-UseZGC", - "-XX:+UnlockExperimentalVMOptions", - "-XX:-UseShenandoahGC", - "-version"); + ProcessBuilder pb = GCArguments.createTestJvm("-XX:-UseSerialGC", + "-XX:-UseParallelGC", + "-XX:-UseG1GC", + "-XX:-UseZGC", + "-XX:+UnlockExperimentalVMOptions", + "-XX:-UseShenandoahGC", + "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldMatch("Garbage collector not selected"); output.shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/Log.java b/test/hotspot/jtreg/vmTestbase/nsk/share/Log.java index 109c3ddd8f7..990e45133ee 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/Log.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/Log.java @@ -80,15 +80,15 @@ public class Log extends FinalizableObject { /** * Is log-mode verbose? - * Default value is false. + * Always enabled. */ - private boolean verbose = false; + private final boolean verbose = true; /** * Should log messages prefixed with timestamps? - * Default value is false. + * Always enabled. */ - private boolean timestamp = false; + private final boolean timestamp = true; /** * Names for trace levels @@ -212,7 +212,6 @@ public Log(PrintStream stream) { */ public Log(PrintStream stream, boolean verbose) { this(stream); - this.verbose = verbose; } /** @@ -223,7 +222,6 @@ public Log(PrintStream stream, boolean verbose) { public Log(PrintStream stream, ArgumentParser argsParser) { this(stream, argsParser.verbose()); traceLevel = argsParser.getTraceLevel(); - timestamp = argsParser.isTimestamp(); } ///////////////////////////////////////////////////////////////// @@ -267,10 +265,9 @@ public void enableVerboseOnError(boolean enable) { * Enable or disable verbose mode for printing messages. */ public void enableVerbose(boolean enable) { - if (!verbose) { - flushLogBuffer(); + if (!enable) { + throw new RuntimeException("The non-verbose logging is not supported."); } - verbose = enable; } public int getTraceLevel() { @@ -472,7 +469,6 @@ private void logExceptionForFailureAnalysis(String msg) { protected synchronized void logTo(PrintStream stream) { finalize(); // flush older log stream out = stream; - verbose = true; } ///////////////////////////////////////////////////////////////// diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java index dc5bc5e8b88..ee82d88f6fa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2023, 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 @@ -234,11 +234,21 @@ public static int eatMemory(ExecutionController stresser, GarbageProducer gp, lo long.class, OOM_TYPE.class); + private static MethodHandle eat; + + static { + try { + eat = MethodHandles.lookup().findStatic(GarbageUtils.class, "eatMemoryImpl", mt); + } catch (Exception nsme) { + // Can't run the test for some unexpected reason + throw new RuntimeException(nsme); + } + } + + public static int eatMemory(ExecutionController stresser, GarbageProducer gp, long initialFactor, long minMemoryChunk, long factor, OOM_TYPE type) { try { // Using a methodhandle invoke of eatMemoryImpl to prevent inlining of it - MethodHandles.Lookup lookup = MethodHandles.lookup(); - MethodHandle eat = lookup.findStatic(GarbageUtils.class, "eatMemoryImpl", mt); return (int) eat.invoke(stresser, gp, initialFactor, minMemoryChunk, factor, type); } catch (OutOfMemoryError e) { return numberOfOOMEs++; diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 5015f4fbfb1..f28e4fecf6e 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -564,9 +564,10 @@ com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java 8030957 aix-all java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java 8247426 generic-all -sun/management/jdp/JdpDefaultsTest.java 8241865 linux-aarch64,macosx-all -sun/management/jdp/JdpJmxRemoteDynamicPortTest.java 8241865 macosx-all -sun/management/jdp/JdpSpecificAddressTest.java 8241865 macosx-all +sun/management/jdp/JdpDefaultsTest.java 8241865,8308807 linux-aarch64,macosx-all,aix-ppc64 +sun/management/jdp/JdpJmxRemoteDynamicPortTest.java 8241865,8308807 macosx-all,aix-ppc64 +sun/management/jdp/JdpSpecificAddressTest.java 8241865,8308807 macosx-all,aix-ppc64 +sun/management/jdp/JdpOffTest.java 8308807 aix-ppc64 ############################################################################ @@ -587,15 +588,18 @@ java/net/MulticastSocket/B6427403.java 8308807 aix-ppc6 java/net/MulticastSocket/IPMulticastIF.java 8308807 aix-ppc64 java/net/MulticastSocket/JoinLeave.java 8308807 aix-ppc64 java/net/MulticastSocket/MulticastAddresses.java 8308807 aix-ppc64 -java/net/MulticastSocket/NoLoopbackPackets.java 7122846 macosx-all +java/net/MulticastSocket/NoLoopbackPackets.java 7122846,8308807 macosx-all,aix-ppc64 java/net/MulticastSocket/NoSetNetworkInterface.java 8308807 aix-ppc64 java/net/MulticastSocket/Promiscuous.java 8308807 aix-ppc64 java/net/MulticastSocket/SetGetNetworkInterfaceTest.java 8219083,8308807 windows-all,aix-ppc64 -java/net/MulticastSocket/SetLoopbackMode.java 7122846 macosx-all +java/net/MulticastSocket/SetLoopbackMode.java 7122846,8308807 macosx-all,aix-ppc64 java/net/MulticastSocket/SetOutgoingIf.java 8308807 aix-ppc64 -java/net/MulticastSocket/Test.java 7145658 macosx-all +java/net/MulticastSocket/Test.java 7145658,8308807 macosx-all,aix-ppc64 java/net/ServerSocket/AcceptInheritHandle.java 8211854 aix-ppc64 +java/net/MulticastSocket/B6427403.java 8308807 aix-ppc64 +java/net/MulticastSocket/SetOutgoingIf.java 8308807 aix-ppc64 + ############################################################################ # jdk_nio @@ -609,6 +613,8 @@ java/nio/channels/AsynchronousSocketChannel/StressLoopback.java 8211851 aix-ppc6 java/nio/file/Files/probeContentType/Basic.java 8320943 windows-all +java/nio/channels/DatagramChannel/AfterDisconnect.java 8308807 aix-ppc64 + ############################################################################ # jdk_rmi diff --git a/test/jdk/TEST.ROOT b/test/jdk/TEST.ROOT index d9de5d7e50c..6b08eb3b706 100644 --- a/test/jdk/TEST.ROOT +++ b/test/jdk/TEST.ROOT @@ -29,17 +29,41 @@ # should be taken to handle test failures of intermittent or # randomness tests. # -# A "headful" test requires a graphical environment to meaningfully -# run. Tests that are not headful are "headless". -# A test flagged with key sound needs audio devices on the system, this -# may be accompanied by the headful keyword since audio device access +# A test flagged with cgroups uses cgroups. +# +# Notes on "client" keywords : headful sound printer multimon +# =========================================================== +# +# These keywords are there to help with test selection so that +# tests that need a particular resource can be selected to run on a system +# with that resource. Conversely "!somekeyword" can be used to exclude tests +# on a system without such a resource. +# Caution: If you are always excluding tests using any of these keywords then you +# are likely missing many important tests. +# +# "headful". A "headful" test requires a graphical environment to meaningfully run. +# This does not have to mean a physical host, since a VM can be configured as headful. +# Tests that are not headful are "headless". +# Note: all manual tests are assumed to be headful and do not need the keyword. +# +# "printer". Not all tests of printing APIs require a printer, but many do. +# So a "printer" test requires a printer to be installed to do anything meaningful. +# Tests may not fail if there is none, instead just silently return. +# But they also may legitimately throw an Exception depending on the test. +# Also printer tests are not necessarily headful, but some are, and some are automated. +# +# "sound". Similarly, not all sound tests require audio devices, but many do. +# A test flagged with key "sound" needs audio devices on the system. +# Also they are not necessarily "headful", since they don't require a display etc. +# But sometimes they may be accompanied by the headful keyword, since sound # is often linked to access to desktop resources and headful systems are # also more likely to have audio devices (ie meaning both input and output) -# A test flagged with key "printer" requires a printer to succeed, else -# throws a PrinterException or the like. -# A test flagged with cgroups uses cgroups. +# +# "multimon" should be used in conjunction with headful and is used to identify +# tests which require two displays connected. -keys=2d dnd headful sound i18n intermittent printer randomness jfr cgroups +keys=headful sound printer multimon \ + i18n intermittent randomness jfr cgroups # Tests that must run in othervm mode othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/swing javax/print \ diff --git a/test/jdk/java/awt/List/MouseDraggedOutCauseScrollingTest/MouseDraggedOutCauseScrollingTest.html b/test/jdk/java/awt/List/MouseDraggedOutCauseScrollingTest/MouseDraggedOutCauseScrollingTest.html deleted file mode 100644 index 7049e827033..00000000000 --- a/test/jdk/java/awt/List/MouseDraggedOutCauseScrollingTest/MouseDraggedOutCauseScrollingTest.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - ManualYesNoTest - - - -

ManualYesNoTest
Bug ID:

- -

See the dialog box (usually in upper left corner) for instructions

- - - - diff --git a/test/jdk/java/awt/List/MouseDraggedOutCauseScrollingTest/MouseDraggedOutCauseScrollingTest.java b/test/jdk/java/awt/List/MouseDraggedOutCauseScrollingTest/MouseDraggedOutCauseScrollingTest.java index 8b509a12311..09ea5bc11cc 100644 --- a/test/jdk/java/awt/List/MouseDraggedOutCauseScrollingTest/MouseDraggedOutCauseScrollingTest.java +++ b/test/jdk/java/awt/List/MouseDraggedOutCauseScrollingTest/MouseDraggedOutCauseScrollingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, 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 @@ -22,29 +22,29 @@ */ /* - test + @test @bug 6243382 8006070 @summary Dragging of mouse outside of a List and Choice area don't work properly on XAWT - @author Dmitry.Cherepanov@SUN.COM area=awt.list - @run applet/manual=yesno MouseDraggedOutCauseScrollingTest.html + @requires (os.family == "linux") + @library /java/awt/regtesthelpers + @run main/manual MouseDraggedOutCauseScrollingTest */ -import java.applet.Applet; -import java.awt.*; +import java.awt.Choice; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.List; +import java.awt.Toolkit; -public class MouseDraggedOutCauseScrollingTest extends Applet -{ - Choice choice; - List singleList; - List multipleList; +public class MouseDraggedOutCauseScrollingTest { - public void init() - { - this.setLayout (new GridLayout (1, 3)); + static Frame createUI() { + Frame frame = new Frame("MouseDraggedOutCausesScrollingTest"); + frame.setLayout(new GridLayout(1, 3)); - choice = new Choice(); - singleList = new List(3, false); - multipleList = new List(3, true); + Choice choice = new Choice(); + List singleList = new List(3, false); + List multipleList = new List(3, true); choice.add("Choice"); for (int i = 1; i < 100; i++){ @@ -59,188 +59,68 @@ public void init() for (int i = 1; i < 100; i++) multipleList.add(""+i); - this.add(choice); - this.add(singleList); - this.add(multipleList); + frame.add(choice); + frame.add(singleList); + frame.add(multipleList); + frame.setSize(400, 100); + return frame; + } + public static void main(String[] args) throws Exception { String toolkitName = Toolkit.getDefaultToolkit().getClass().getName(); + if (!toolkitName.equals("sun.awt.X11.XToolkit")) { - String[] instructions = - { - "This test is not applicable to the current platform. Press PASS" - }; - Sysout.createDialogWithInstructions( instructions ); - } else { - String[] instructions = - { - "0) Please note, that this is only Motif/XAWT test. At first, make the applet active", - "1.1) Click on the choice", - "1.2) Press the left button of the mouse and keep on any item of the choice, for example 5", - "1.3) Drag mouse out of the area of the unfurled list, at the same time hold the X coordinate of the mouse position about the same", - "1.4) To make sure, that when the Y coordinate of the mouse position higher of the upper bound of the list then scrolling UP of the list and selected item changes on the upper. If not, the test failed", - "1.5) To make sure, that when the Y coordinate of the mouse position under of the lower bound of the list then scrolling DOWN of the list and selected item changes on the lower. If not, the test failed", - "-----------------------------------", - "2.1) Click on the single list", - "2.2) Press the left button of the mouse and keep on any item of the list, for example 5", - "2.3) Drag mouse out of the area of the unfurled list, at the same time hold the X coordinate of the mouse position about the same", - "2.4) To make sure, that when the Y coordinate of the mouse position higher of the upper bound of the list then scrolling UP of the list and selected item changes on the upper. If not, the test failed", - "2.5) To make sure, that when the Y coordinate of the mouse position under of the lower bound of the list then scrolling DOWN of the list and selected item changes on the lower. If not, the test failed", - "-----------------------------------", - "3.1) Click on the multiple list", - "3.2) Press the left button of the mouse and keep on any item of the list, for example 5", - "3.3) Drag mouse out of the area of the unfurled list, at the same time hold the X coordinate of the mouse position about the same", - "3.4) To make sure, that when the Y coordinate of the mouse position higher of the upper bound of the list then scrolling of the list NO OCCURED and selected item NO CHANGES on the upper. If not, the test failed", - "3.5) To make sure, that when the Y coordinate of the mouse position under of the lower bound of the list then scrolling of the list NO OCCURED and selected item NO CHANGES on the lower. If not, the test failed", - "4) Test passed." - }; - Sysout.createDialogWithInstructions( instructions ); + System.out.println(INAPPLICABLE); + return; } - }//End init() - - public void start () - { - setSize (400,100); - setVisible(true); - validate(); - - }// start() - -}// class ManualYesNoTest - -/**************************************************** - Standard Test Machinery - DO NOT modify anything below -- it's a standard - chunk of code whose purpose is to make user - interaction uniform, and thereby make it simpler - to read and understand someone else's test. - ****************************************************/ - -/** - This is part of the standard test machinery. - It creates a dialog (with the instructions), and is the interface - for sending text messages to the user. - To print the instructions, send an array of strings to Sysout.createDialog - WithInstructions method. Put one line of instructions per array entry. - To display a message for the tester to see, simply call Sysout.println - with the string to be displayed. - This mimics System.out.println but works within the test harness as well - as standalone. - */ - -class Sysout -{ - private static TestDialog dialog; - - public static void createDialogWithInstructions( String[] instructions ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - dialog.printInstructions( instructions ); - dialog.setVisible(true); - println( "Any messages for the tester will display here." ); - } - - public static void createDialog( ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - String[] defInstr = { "Instructions will appear here. ", "" } ; - dialog.printInstructions( defInstr ); - dialog.setVisible(true); - println( "Any messages for the tester will display here." ); - } - - - public static void printInstructions( String[] instructions ) - { - dialog.printInstructions( instructions ); - } - - - public static void println( String messageIn ) - { - dialog.displayMessage( messageIn ); - } - -}// Sysout class - -/** - This is part of the standard test machinery. It provides a place for the - test instructions to be displayed, and a place for interactive messages - to the user to be displayed. - To have the test instructions displayed, see Sysout. - To have a message to the user be displayed, see Sysout. - Do not call anything in this dialog directly. - */ -class TestDialog extends Dialog -{ - - TextArea instructionsText; - TextArea messageText; - int maxStringLength = 80; - - //DO NOT call this directly, go through Sysout - public TestDialog( Frame frame, String name ) - { - super( frame, name ); - int scrollBoth = TextArea.SCROLLBARS_BOTH; - instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); - add( "North", instructionsText ); - - messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); - add("Center", messageText); - - pack(); - - setVisible(true); - }// TestDialog() - - //DO NOT call this directly, go through Sysout - public void printInstructions( String[] instructions ) - { - //Clear out any current instructions - instructionsText.setText( "" ); - - //Go down array of instruction strings - - String printStr, remainingStr; - for( int i=0; i < instructions.length; i++ ) - { - //chop up each into pieces maxSringLength long - remainingStr = instructions[ i ]; - while( remainingStr.length() > 0 ) - { - //if longer than max then chop off first max chars to print - if( remainingStr.length() >= maxStringLength ) - { - //Try to chop on a word boundary - int posOfSpace = remainingStr. - lastIndexOf( ' ', maxStringLength - 1 ); - - if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; - - printStr = remainingStr.substring( 0, posOfSpace + 1 ); - remainingStr = remainingStr.substring( posOfSpace + 1 ); - } - //else just print - else - { - printStr = remainingStr; - remainingStr = ""; - } - - instructionsText.append( printStr + "\n" ); - - }// while - - }// for - - }//printInstructions() - - //DO NOT call this directly, go through Sysout - public void displayMessage( String messageIn ) - { - messageText.append( messageIn + "\n" ); - System.out.println(messageIn); + PassFailJFrame + .builder() + .instructions(INSTRUCTIONS) + .rows(40) + .columns(70) + .testUI(MouseDraggedOutCauseScrollingTest::createUI) + .build() + .awaitAndCheck(); } -}// TestDialog class + static final String INAPPLICABLE = "The test is not applicable to the current platform. Test PASSES."; + static final String INSTRUCTIONS = """ + 0) Please note, that this is an XAWT/Linux only test. First, make the test window is active. + ----------------------------------- + 1.1) Click on the Choice. + 1.2) Press and hold down the left button of the mouse to select (eg) item 5 in the choice. + 1.3) Drag the mouse vertically out of the area of the open list, + keeping the X coordinate of the mouse position about the same. + 1.4) Check that when the Y coordinate of the mouse position is higher than the upper bound of the list + then the list continues to scrolls UP and the selected item changes at the top until you reach the topmost item. + If not, the test failed. Press FAIL. + 1.5) Check that when the Y coordinate of the mouse position is lower than the lower bound of the list + then the list continues to scroll DOWN and the selected item changes at the bottom until you reach the bottommost item. + If not, the test failed. Press FAIL. + ----------------------------------- + 2.1) Click on the Single List. + 2.2) Press and hold down the left button of the mouse to select (eg) item 5 in the list. + 2.3) Drag the mouse vertically out of the area of the open list, + keeping the X coordinate of the mouse position about the same. + 2.4) Check that when the Y coordinate of the mouse position is higher than the upper bound of the list + then the list continues to scrolls UP and the selected item changes at the top until you reach the topmost item. + If not, the test failed. Press FAIL. + 2.5) Check that when the Y coordinate of the mouse position is lower than the lower bound of the list + then the list continues to scroll DOWN and the selected item changes at the bottom until you reach the bottommost item. + If not, the test failed. Press FAIL. + ----------------------------------- + 3.1) Click on the Multiple List. + 3.2) Press and hold down the left button of the mouse to select (eg) item 5 in the list. + 3.3) Drag the mouse vertically out of the area of the open list, + keeping the X coordinate of the mouse position about the same. + 3.4) Check that when the Y coordinate of the mouse is higher than the upper bound of the list + that scrolling of the list DOES NOT OCCUR and the selected item IS UNCHANGED at the top. + If not, the test failed. Press FAIL. + 3.5) Check that when the Y coordinate of the mouse is below the lower bound of the list + that scrolling of the list DOES NOT OCCUR and the selected item IS UNCHANGED at the bottom. + If not, the test failed. Press FAIL. + ----------------------------------- + 4) The test has now passed. Press PASS. + """; +} diff --git a/test/jdk/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java b/test/jdk/java/awt/Paint/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java similarity index 100% rename from test/jdk/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java rename to test/jdk/java/awt/Paint/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java diff --git a/test/jdk/java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java b/test/jdk/java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java index 179b4594652..b284a033316 100644 --- a/test/jdk/java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java +++ b/test/jdk/java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java @@ -24,6 +24,7 @@ /* @test @bug 4116029 4300383 + @key printer @summary verify that child components can draw only inside their visible bounds @author das@sparc.spb.su area=awt.print diff --git a/test/jdk/java/awt/PrintJob/EdgeTest/EdgeTest.java b/test/jdk/java/awt/PrintJob/EdgeTest/EdgeTest.java index f7bf5e72a60..58f84b43fb2 100644 --- a/test/jdk/java/awt/PrintJob/EdgeTest/EdgeTest.java +++ b/test/jdk/java/awt/PrintJob/EdgeTest/EdgeTest.java @@ -24,9 +24,9 @@ /** * @test * @bug 4092755 + * @key printer * @summary Verifies that (0, 0) is the upper-left corner of the page, not * the upper-left corner adjusted for the margins. - * @author dpm * @run main/manual EdgeTest */ diff --git a/test/jdk/java/awt/PrintJob/HighResTest.java b/test/jdk/java/awt/PrintJob/HighResTest.java index e802214fdaf..dbf7d4a2ce6 100644 --- a/test/jdk/java/awt/PrintJob/HighResTest.java +++ b/test/jdk/java/awt/PrintJob/HighResTest.java @@ -26,7 +26,7 @@ @test @bug 4227128 8066139 @summary Test printing at resolutions > 72dpi - @author dpm: area=awt.print + @key printer @run main/manual HighResTest */ import java.awt.Button; diff --git a/test/jdk/java/awt/PrintJob/JobAttrUpdateTest.java b/test/jdk/java/awt/PrintJob/JobAttrUpdateTest.java index 186b9a6d8ba..cbc8d6a7ae8 100644 --- a/test/jdk/java/awt/PrintJob/JobAttrUpdateTest.java +++ b/test/jdk/java/awt/PrintJob/JobAttrUpdateTest.java @@ -23,6 +23,7 @@ /* * @test * @bug 6357905 + * @key printer * @summary JobAttributes.getFromPage() and getToPage() always returns 1 * @run main/manual JobAttrUpdateTest */ diff --git a/test/jdk/java/awt/PrintJob/MultipleEnd/MultipleEnd.java b/test/jdk/java/awt/PrintJob/MultipleEnd/MultipleEnd.java index b115e8d4a91..88b6a4720d9 100644 --- a/test/jdk/java/awt/PrintJob/MultipleEnd/MultipleEnd.java +++ b/test/jdk/java/awt/PrintJob/MultipleEnd/MultipleEnd.java @@ -23,7 +23,7 @@ /** * @test - * @key headful + * @key headful printer * @bug 4112758 * @summary Checks that a second invocation of PrintJob.end() does not cause * an exception or segmentation violation. diff --git a/test/jdk/java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java b/test/jdk/java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java index 805a2fa5c2c..9fbf48f3eb4 100644 --- a/test/jdk/java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java +++ b/test/jdk/java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java @@ -25,7 +25,7 @@ @test @bug 4507585 @summary Native modal dialog shouldn't block event dispatching when called on EventDispatchThread. - @author tav@sparc.spb.su: area=awt.PrintJob + @key printer @run main/manual=yesno PageSetupDlgBlockingTest */ diff --git a/test/jdk/java/awt/PrintJob/PrintArcTest/PrintArcTest.java b/test/jdk/java/awt/PrintJob/PrintArcTest/PrintArcTest.java index 15cf121607c..ab969f68eb7 100644 --- a/test/jdk/java/awt/PrintJob/PrintArcTest/PrintArcTest.java +++ b/test/jdk/java/awt/PrintJob/PrintArcTest/PrintArcTest.java @@ -23,10 +23,9 @@ /* * @test - * @key headful + * @key headful printer * @bug 4105609 * @summary Test printing of drawArc preceded by drawString - * @author robi.khan */ import java.awt.*; diff --git a/test/jdk/java/awt/PrintJob/PrintCheckboxTest/PrintCheckboxManualTest.java b/test/jdk/java/awt/PrintJob/PrintCheckboxTest/PrintCheckboxManualTest.java index 33ef83bfddd..4fd3ee8ef16 100644 --- a/test/jdk/java/awt/PrintJob/PrintCheckboxTest/PrintCheckboxManualTest.java +++ b/test/jdk/java/awt/PrintJob/PrintCheckboxTest/PrintCheckboxManualTest.java @@ -26,7 +26,7 @@ @bug 5045936 5055171 @summary Tests that there is no ClassCastException thrown in printing checkbox and scrollbar with XAWT - @author art@sparc.spb.su + @key printer @run applet/manual=yesno PrintCheckboxManualTest.html */ diff --git a/test/jdk/java/awt/PrintJob/QuoteAndBackslashTest/QuoteAndBackslashTest.java b/test/jdk/java/awt/PrintJob/QuoteAndBackslashTest/QuoteAndBackslashTest.java index dcc720de23e..c84671b6dc2 100644 --- a/test/jdk/java/awt/PrintJob/QuoteAndBackslashTest/QuoteAndBackslashTest.java +++ b/test/jdk/java/awt/PrintJob/QuoteAndBackslashTest/QuoteAndBackslashTest.java @@ -23,11 +23,10 @@ /** * @test - * @key headful + * @key headful printer * @bug 4040668 * @summary Checks that banner titles which contain double quotation marks * or backslashes still print correctly. - * @author dpm */ import java.awt.*; diff --git a/test/jdk/java/awt/PrintJob/RoundedRectTest/RoundedRectTest.java b/test/jdk/java/awt/PrintJob/RoundedRectTest/RoundedRectTest.java index a8af7b585f1..650203889c7 100644 --- a/test/jdk/java/awt/PrintJob/RoundedRectTest/RoundedRectTest.java +++ b/test/jdk/java/awt/PrintJob/RoundedRectTest/RoundedRectTest.java @@ -23,10 +23,9 @@ /** * @test - * @key headful + * @key headful printer * @bug 4061440 * @summary Checks that rounded rectangles print correctly. - * @author dpm */ import java.awt.*; diff --git a/test/jdk/java/awt/PrintJob/SaveDialogTitleTest.java b/test/jdk/java/awt/PrintJob/SaveDialogTitleTest.java index 4e502290f94..b0d7c9cd238 100644 --- a/test/jdk/java/awt/PrintJob/SaveDialogTitleTest.java +++ b/test/jdk/java/awt/PrintJob/SaveDialogTitleTest.java @@ -24,6 +24,7 @@ /* * @test * @bug 4851363 8025988 8025990 + * @key printer * @summary Tests the save to file dialog has a title. * @run main/manual=yesno/othervm SaveDialogTitleTest */ diff --git a/test/jdk/java/awt/PrintJob/Security/SecurityDialogTest.java b/test/jdk/java/awt/PrintJob/Security/SecurityDialogTest.java index 3bda65e0a71..b84afc6eb9b 100644 --- a/test/jdk/java/awt/PrintJob/Security/SecurityDialogTest.java +++ b/test/jdk/java/awt/PrintJob/Security/SecurityDialogTest.java @@ -23,7 +23,7 @@ /** * @test - * @key headful + * @key headful printer * @bug 6195901 6195923 6195928 6195933 6491273 6888734 * @summary No SecurityException should be thrown when printing to a file using the given policy. diff --git a/test/jdk/java/awt/PrintJob/TestPrintJobFrameAssociation.java b/test/jdk/java/awt/PrintJob/TestPrintJobFrameAssociation.java index 1dd861cf325..2a58cb724d7 100644 --- a/test/jdk/java/awt/PrintJob/TestPrintJobFrameAssociation.java +++ b/test/jdk/java/awt/PrintJob/TestPrintJobFrameAssociation.java @@ -23,6 +23,7 @@ /* * @test * @bug 8154218 + * @key printer * @summary Verifies if owner Frame is associated with print dialog * @run main/manual TestPrintJobFrameAssociation */ diff --git a/test/jdk/java/awt/PrintJob/Text/stringwidth.sh b/test/jdk/java/awt/PrintJob/Text/stringwidth.sh index 32bce9e728b..fea11e5ba5f 100644 --- a/test/jdk/java/awt/PrintJob/Text/stringwidth.sh +++ b/test/jdk/java/awt/PrintJob/Text/stringwidth.sh @@ -23,6 +23,7 @@ # # @test # @bug 4692562 +# @key printer # @summary Requirement: Windows with printer installed. It should print with text "Hello World". # @compile StringWidth.java # @run shell/manual stringwidth.sh diff --git a/test/jdk/java/awt/ScrollPane/ScrollPaneTest.java b/test/jdk/java/awt/ScrollPane/ScrollPaneTest.java new file mode 100644 index 00000000000..7b628d900a5 --- /dev/null +++ b/test/jdk/java/awt/ScrollPane/ScrollPaneTest.java @@ -0,0 +1,216 @@ +/* + * Copyright (c) 1998, 2023, 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. + * + * This code 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 + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.ScrollPane; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; + +/* + * @test + * @bug 4124460 + * @key headful + * @summary Test for initializing a Motif peer component causes a crash. +*/ + +public class ScrollPaneTest { + private static volatile Point p1 = null; + private static volatile Point p2 = null; + private static Robot robot = null; + + private static Point getClickPoint(Component component) { + Point locationOnScreen = component.getLocationOnScreen(); + Dimension size = component.getSize(); + locationOnScreen.x += size.width / 2; + locationOnScreen.y += size.height / 2; + return locationOnScreen; + } + public static void main(String[] args) throws Exception { + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(100); + + try { + doTest(); + } finally { + ScrollPaneTester.disposeAll(); + } + } + + private static void doTest() throws Exception { + EventQueue.invokeAndWait(ScrollPaneTester::initAndShowGui); + + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + p1 = getClickPoint(ScrollPaneTester.st1.buttonRight); + p2 = getClickPoint(ScrollPaneTester.st1.buttonSwap); + }); + + robot.mouseMove(p1.x, p1.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.mouseMove(p2.x, p2.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + p1 = getClickPoint(ScrollPaneTester.st2.buttonRight); + p2 = getClickPoint(ScrollPaneTester.st2.buttonSwap); + }); + + robot.mouseMove(p1.x, p1.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.mouseMove(p2.x, p2.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + } +} + +class ScrollPaneTester implements ActionListener { + static ScrollPaneTester st1, st2; + final Button buttonLeft, buttonRight, buttonQuit, buttonSwap; + protected ScrollPane sp; + protected Frame f; + + public static void initAndShowGui() { + ScrollPaneTester.st1 = new ScrollPaneTester(true); + ScrollPaneTester.st2 = new ScrollPaneTester(false); + } + + public ScrollPaneTester(boolean large) { + sp = new ScrollPane(ScrollPane.SCROLLBARS_NEVER); + + Panel p = new Panel(); + + if (large) { + p.setLayout(new GridLayout(10, 10)); + for (int i = 0; i < 10; i++) + for (int j = 0; j < 10; j++) { + TextField tf = new TextField("I am " + i + j); + tf.setSize(100, 20); + p.add(tf); + } + } else { + TextField tf = new TextField("Smallness:"); + tf.setSize(150, 50); + p.add(tf); + } + + sp.add(p); + + // Button panel + buttonLeft = new Button("Left"); + buttonLeft.addActionListener(this); + buttonQuit = new Button("Quit"); + buttonQuit.addActionListener(this); + buttonSwap = new Button("Swap"); + buttonSwap.addActionListener(this); + buttonRight = new Button("Right"); + buttonRight.addActionListener(this); + + Panel bp = new Panel(); + bp.add(buttonLeft); + bp.add(buttonSwap); + bp.add(buttonQuit); + bp.add(buttonRight); + + // Window w/ button panel and scrollpane + f = new Frame("ScrollPane Test " + (large ? "large" : "small")); + f.setLayout(new BorderLayout()); + f.add("South", bp); + f.add("Center", sp); + + if (large) { + f.setSize(300, 200); + f.setLocation(100, 100); + } else { + f.setSize(200, 100); + f.setLocation(500, 100); + } + + f.setVisible(true); + } + + public static void disposeAll() { + ScrollPaneTester.st1.f.dispose(); + ScrollPaneTester.st2.f.dispose(); + } + + public static void + swapPanels() { + ScrollPane sss = st1.sp; + + st1.f.add("Center", st2.sp); + st1.sp = st2.sp; + + st2.f.add("Center", sss); + st2.sp = sss; + } + + public void + actionPerformed(ActionEvent ev) { + Object s = ev.getSource(); + + if (s == buttonLeft) { + scroll(true); + } else if (s == buttonRight) { + scroll(false); + } else if (s == buttonSwap) { + swapPanels(); + } else if (s == buttonQuit) { + disposeAll(); + } + } + + private void + scroll(boolean scroll_left) { + Point p = sp.getScrollPosition(); + + if (scroll_left) + p.x = Math.max(0, p.x - 20); + else { + int cwidth = sp.getComponent(0).getSize().width; + p.x = Math.min(p.x + 20, cwidth); + } + + sp.setScrollPosition(p); + } +} diff --git a/test/jdk/java/awt/TextArea/Length.java b/test/jdk/java/awt/TextArea/Length.java new file mode 100644 index 00000000000..1ea99659383 --- /dev/null +++ b/test/jdk/java/awt/TextArea/Length.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 1999, 2023, 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. + * + * This code 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 + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.EventQueue; +import java.awt.TextArea; + +/* + * @test + * @bug 4120876 + * @key headful + * @summary Ensure that getText can handle strings of various lengths, + * in particular strings longer than 255 characters + */ + +public class Length { + + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(() -> { + TextArea ta = new TextArea(); + StringBuffer sb = new StringBuffer("x"); + + for (int i = 0; i < 14; i++) { + String s = sb.toString(); + check(ta, s.substring(1)); + check(ta, s); + check(ta, s + "y"); + sb.append(s); + } + }); + } + + static void check(TextArea ta, String s) { + ta.setText(s); + String s2 = ta.getText(); + System.err.println(s.length() + " " + s2.length()); + if (s.length() != s2.length()) { + throw new RuntimeException("Expected " + s.length() + + "chars, got " + s2.length()); + } + } +} diff --git a/test/jdk/java/awt/Window/WindowOwner.java b/test/jdk/java/awt/Window/WindowOwner.java new file mode 100644 index 00000000000..82cb35a1faa --- /dev/null +++ b/test/jdk/java/awt/Window/WindowOwner.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 1998, 2023, 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. + * + * This code 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 + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Panel; +import java.awt.Window; +import java.util.ArrayList; +import java.util.List; + +/* + * @test + * @key headful + * @summary automated test for window-ownership on Windows, Frames, and Dialogs + */ + +public class WindowOwner extends Panel { + + Label status = null; + static List windowsToDispose = new ArrayList<>(); + + public static void main(String[] args) throws Exception { + WindowOwner windowOwner = new WindowOwner(); + try { + EventQueue.invokeAndWait(windowOwner::init); + Thread.sleep(2000); + } finally { + EventQueue.invokeAndWait( + () -> windowsToDispose.forEach(Window::dispose) + ); + } + } + + public void init() { + status = new Label(); + add(status); + + statusMessage("Testing Window Ownership..."); + + // Test Frame as owner + Frame frame0 = new Frame("WindowOwner Test"); + windowsToDispose.add(frame0); + frame0.add("Center", new Label("Frame Level0")); + + Dialog dialog1 = new Dialog(frame0, "WindowOwner Test"); + windowsToDispose.add(dialog1); + dialog1.add("Center", new Label("Dialog Level1")); + verifyOwner(dialog1, frame0); + + Window window1 = new Window(frame0); + windowsToDispose.add(window1); + window1.add("Center", new Label("Window Level1")); + window1.setBounds(10, 10, 140, 70); + verifyOwner(window1, frame0); + + verifyOwnee(frame0, dialog1); + verifyOwnee(frame0, window1); + + // Test Dialog as owner + Dialog dialog2 = new Dialog(dialog1, "WindowOwner Test"); + windowsToDispose.add(dialog2); + dialog2.add("Center", new Label("Dialog Level2")); + verifyOwner(dialog2, dialog1); + + Window window2 = new Window(dialog1); + windowsToDispose.add(window2); + window2.add("Center", new Label("Window Level2")); + window2.setBounds(110, 110, 140, 70); + verifyOwner(window2, dialog1); + + verifyOwnee(dialog1, window2); + verifyOwnee(dialog1, dialog2); + + // Test Window as owner + Window window3 = new Window(window2); + windowsToDispose.add(window3); + window3.add("Center", new Label("Window Level3")); + window3.setBounds(210, 210, 140, 70); + verifyOwner(window3, window2); + verifyOwnee(window2, window3); + + // Ensure native peers handle ownership without errors + frame0.pack(); + frame0.setVisible(true); + + dialog1.pack(); + dialog1.setVisible(true); + + window1.setLocation(50, 50); + window1.setVisible(true); + + dialog2.pack(); + dialog2.setVisible(true); + + window2.setLocation(100, 100); + window2.setVisible(true); + + window3.setLocation(150, 150); + window3.setVisible(true); + + statusMessage("Window Ownership test completed successfully."); + } + + public void statusMessage(String msg) { + status.setText(msg); + status.invalidate(); + validate(); + } + + public static void verifyOwner(Window ownee, Window owner) { + if (ownee.getOwner() != owner) { + throw new RuntimeException("Window owner not valid for " + + ownee.getName()); + } + } + + public static void verifyOwnee(Window owner, Window ownee) { + Window[] ownedWins = owner.getOwnedWindows(); + if (!windowInList(ownedWins, ownee)) { + throw new RuntimeException("Ownee " + ownee.getName() + + " not found in owner list for " + owner.getName()); + } + } + + public static boolean windowInList(Window[] windows, Window target) { + for (Window window : windows) { + if (window == target) { + return true; + } + } + return false; + } +} diff --git a/test/jdk/java/awt/font/Rotate/RotateTest3.java b/test/jdk/java/awt/font/Rotate/RotateTest3.java new file mode 100644 index 00000000000..0241e65e1eb --- /dev/null +++ b/test/jdk/java/awt/font/Rotate/RotateTest3.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 1999, 2023, 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. + * + * This code 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 + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +/* + * @test + * @key headful + * @bug 4240228 + * @summary This test is designed to test for a crashing bug in the zh + * locale on Solaris. Rotated text should be displayed, but + * anything other than a crash passes the specific test. + * For example, the missing glyph empty box may be displayed + * in some locales, or no text at all. + */ + +public class RotateTest3 extends Panel { + static JFrame frame; + + protected Java2DView java2DView; + + public RotateTest3(){ + this.setLayout(new GridLayout(1, 1)); + this.setSize(300, 300); + this.java2DView = new Java2DView(); + this.add(this.java2DView); + } + + public static void main(String[] s) throws Exception { + try { + SwingUtilities.invokeAndWait(RotateTest3::initAndShowGui); + Thread.sleep(1000); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void initAndShowGui() { + RotateTest3 panel = new RotateTest3(); + + frame = new JFrame("RotateTest3"); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + frame.dispose(); + } + }); + frame.getContentPane().setLayout(new GridLayout(1, 1)); + frame.getContentPane().add("Center", panel); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + static public class Java2DView extends Component { + + public void paint(Graphics g){ + Graphics2D g2d = (Graphics2D) g; + Dimension d = this.getSize(); + g.setColor(this.getBackground()); + g.fillRect(0, 0, d.width, d.height); + g2d.setPaint(Color.black); + + g2d.translate(150,150); + g2d.rotate(-Math.PI / 3); + + String testString = + "\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341"; + g2d.drawString(testString, 0, 0); + } + + public Dimension getMinimumSize(){ + return new Dimension(300, 300); + } + + public Dimension getPreferredSize(){ + return new Dimension(300, 300); + } + } +} diff --git a/test/jdk/java/awt/print/Dialog/DestinationTest.java b/test/jdk/java/awt/print/Dialog/DestinationTest.java index 8bb9403b566..933fba3042b 100644 --- a/test/jdk/java/awt/print/Dialog/DestinationTest.java +++ b/test/jdk/java/awt/print/Dialog/DestinationTest.java @@ -24,6 +24,7 @@ /** * @test * @bug 4846344 4851365 4851321 4851316 4863656 5046198 6293139 + * @key printer * @summary Confirm that cancelling the dialog will not prompt for file. * @run main/manual DestinationTest */ diff --git a/test/jdk/java/awt/print/Dialog/DialogCopies.java b/test/jdk/java/awt/print/Dialog/DialogCopies.java index 39d15461de8..1fb874a9d57 100644 --- a/test/jdk/java/awt/print/Dialog/DialogCopies.java +++ b/test/jdk/java/awt/print/Dialog/DialogCopies.java @@ -24,6 +24,7 @@ /* * @test * @bug 6357858 + * @key printer * @summary Job must reports the number of copies set in the dialog. * @run main/manual DialogCopies */ diff --git a/test/jdk/java/awt/print/Dialog/DialogOrient.java b/test/jdk/java/awt/print/Dialog/DialogOrient.java index 92b3c65e642..982e51548bf 100644 --- a/test/jdk/java/awt/print/Dialog/DialogOrient.java +++ b/test/jdk/java/awt/print/Dialog/DialogOrient.java @@ -24,6 +24,7 @@ /* @test @bug 6594374 + @key printer @summary Confirm that the orientation is as specified. @run main/manual DialogOrient */ diff --git a/test/jdk/java/awt/print/Dialog/DialogOwnerTest.java b/test/jdk/java/awt/print/Dialog/DialogOwnerTest.java index 45156e8590a..11c854ecfc3 100644 --- a/test/jdk/java/awt/print/Dialog/DialogOwnerTest.java +++ b/test/jdk/java/awt/print/Dialog/DialogOwnerTest.java @@ -23,6 +23,7 @@ /* @test @bug 8203796 + @key printer @run main/manual DialogOwnerTest @summary Test DialogOwner API */ diff --git a/test/jdk/java/awt/print/Dialog/DialogType.java b/test/jdk/java/awt/print/Dialog/DialogType.java index 00b07930cf0..472b89e44f2 100644 --- a/test/jdk/java/awt/print/Dialog/DialogType.java +++ b/test/jdk/java/awt/print/Dialog/DialogType.java @@ -24,6 +24,7 @@ /** * @test * @bug 6568874 + * @key printer * @summary Verify the native dialog works with attribute sets. * @run main/manual=yesno DialogType */ diff --git a/test/jdk/java/awt/print/Dialog/MediaInPrintable.java b/test/jdk/java/awt/print/Dialog/MediaInPrintable.java index a800f69c74d..cb74cb140f5 100644 --- a/test/jdk/java/awt/print/Dialog/MediaInPrintable.java +++ b/test/jdk/java/awt/print/Dialog/MediaInPrintable.java @@ -24,6 +24,7 @@ /** * @test * @bug 4869575 6361766 + * @key printer * @summary Setting orientation in the page format does not have any effect on the printout. To test 6361766, the application must exit. * @run main/manual MediaInPrintable */ diff --git a/test/jdk/java/awt/print/Dialog/PaperSizeError.java b/test/jdk/java/awt/print/Dialog/PaperSizeError.java index 970c7df2fcc..fea7bb85af8 100644 --- a/test/jdk/java/awt/print/Dialog/PaperSizeError.java +++ b/test/jdk/java/awt/print/Dialog/PaperSizeError.java @@ -24,6 +24,7 @@ /** * @test * @bug 6360339 + * @key printer * @summary Test for fp error in paper size calculations. * @run main/manual PaperSizeError */ diff --git a/test/jdk/java/awt/print/Dialog/PrintApplet.java b/test/jdk/java/awt/print/Dialog/PrintApplet.java index ecd9920571c..c8a3cd955fe 100644 --- a/test/jdk/java/awt/print/Dialog/PrintApplet.java +++ b/test/jdk/java/awt/print/Dialog/PrintApplet.java @@ -24,6 +24,7 @@ /* @test @bug 5024549 + @key printer @summary Pass if dialogs are modal. @run applet/manual PrintApplet.html */ diff --git a/test/jdk/java/awt/print/Dialog/PrintDialog.java b/test/jdk/java/awt/print/Dialog/PrintDialog.java index 870db01a985..c81ebfbc452 100644 --- a/test/jdk/java/awt/print/Dialog/PrintDialog.java +++ b/test/jdk/java/awt/print/Dialog/PrintDialog.java @@ -24,6 +24,7 @@ /* @test @bug 6342748 + @key printer @summary Pass if dialogs display correctly @run main/manual PrintDialog */ diff --git a/test/jdk/java/awt/print/Dialog/PrintDlgPageable.java b/test/jdk/java/awt/print/Dialog/PrintDlgPageable.java index d447874f72a..eadd3cf9cb6 100644 --- a/test/jdk/java/awt/print/Dialog/PrintDlgPageable.java +++ b/test/jdk/java/awt/print/Dialog/PrintDlgPageable.java @@ -24,6 +24,7 @@ /** * @test * @bug 4869502 4869539 + * @key printer * @summary Confirm that ToPage is populated for argument =2. Range is disabled for argument = 0. * @run main/manual PrintDlgPageable */ diff --git a/test/jdk/java/awt/print/Dialog/RestoreActiveWindowTest/RestoreActiveWindowTest.java b/test/jdk/java/awt/print/Dialog/RestoreActiveWindowTest/RestoreActiveWindowTest.java index 8d29dbb5849..2d2e00f2ed7 100644 --- a/test/jdk/java/awt/print/Dialog/RestoreActiveWindowTest/RestoreActiveWindowTest.java +++ b/test/jdk/java/awt/print/Dialog/RestoreActiveWindowTest/RestoreActiveWindowTest.java @@ -24,6 +24,7 @@ /* * @test * @bug 6365992 6379599 8137137 + * @key printer * @summary REG: Showing and disposing a native print dialog makes the main * frame inactive, Win32 * @run main/manual RestoreActiveWindowTest diff --git a/test/jdk/java/awt/print/Headless/HeadlessPrinterJob.java b/test/jdk/java/awt/print/Headless/HeadlessPrinterJob.java index ff7a22ec8a3..143c898e32a 100644 --- a/test/jdk/java/awt/print/Headless/HeadlessPrinterJob.java +++ b/test/jdk/java/awt/print/Headless/HeadlessPrinterJob.java @@ -31,6 +31,7 @@ /* * @test + * @key printer * @summary Check that PrinterJob constructor and methods do not throw unexpected * exceptions in headless mode * @run main/othervm -Djava.awt.headless=true HeadlessPrinterJob diff --git a/test/jdk/java/awt/print/MissedFontFamilyName/PrintFontWithMissedFontFamilyTest.java b/test/jdk/java/awt/print/MissedFontFamilyName/PrintFontWithMissedFontFamilyTest.java index a6808282f37..af655f2d69e 100644 --- a/test/jdk/java/awt/print/MissedFontFamilyName/PrintFontWithMissedFontFamilyTest.java +++ b/test/jdk/java/awt/print/MissedFontFamilyName/PrintFontWithMissedFontFamilyTest.java @@ -25,6 +25,7 @@ /** * @test * @bug 8265761 + * @key printer * @requires (os.family == "windows") * @summary Font with missed font family name is not properly printed on Windows * @run main/othervm/manual PrintFontWithMissedFontFamilyTest diff --git a/test/jdk/java/awt/print/PageFormat/CustomPaper.java b/test/jdk/java/awt/print/PageFormat/CustomPaper.java index 3b8e83d5c1b..1976a20c01f 100644 --- a/test/jdk/java/awt/print/PageFormat/CustomPaper.java +++ b/test/jdk/java/awt/print/PageFormat/CustomPaper.java @@ -25,7 +25,7 @@ * @test * @bug 4355514 * @bug 4385157 - * @author Jennifer Godinez + * @key printer * @summary Prints a rectangle to show the imageable area of a * 12in x 14in custom paper size. * @run main/manual CustomPaper diff --git a/test/jdk/java/awt/print/PageFormat/ImageableAreaTest.java b/test/jdk/java/awt/print/PageFormat/ImageableAreaTest.java index 7bf37415e6e..07f458704a5 100644 --- a/test/jdk/java/awt/print/PageFormat/ImageableAreaTest.java +++ b/test/jdk/java/awt/print/PageFormat/ImageableAreaTest.java @@ -47,7 +47,7 @@ * @test * @bug 8044444 8081491 * @summary The output's 'Page-n' footer does not show completely - * @author Alexandr Scherbatiy + * @key printer * @run main/manual ImageableAreaTest */ public class ImageableAreaTest { diff --git a/test/jdk/java/awt/print/PageFormat/NullPaper.java b/test/jdk/java/awt/print/PageFormat/NullPaper.java index 0bae3aa9592..1a9000b6135 100644 --- a/test/jdk/java/awt/print/PageFormat/NullPaper.java +++ b/test/jdk/java/awt/print/PageFormat/NullPaper.java @@ -23,13 +23,11 @@ /* @test - @key headful @bug 4199506 @summary java.awt.print.PageFormat.setpaper(Paper paper) assertion test fails by not throwing NullPointerException when a null paper instance is passed as argument and this is specified in the doc. - @author rbi: area=PageFormat @run main NullPaper */ @@ -46,9 +44,6 @@ */ -import java.awt.*; -import java.awt.event.*; -import java.awt.geom.*; import java.awt.print.*; // This test is a "main" test as applets would need Runtime permission @@ -154,7 +149,6 @@ public static synchronized void setTimeoutTo( int seconds ) public static synchronized void pass() { System.out.println( "The test passed." ); - System.out.println( "The test is over, hit Ctl-C to stop Java VM" ); //first check if this is executing in main thread if ( mainThread == Thread.currentThread() ) { @@ -180,7 +174,6 @@ public static synchronized void fail() public static synchronized void fail( String whyFailed ) { System.out.println( "The test failed: " + whyFailed ); - System.out.println( "The test is over, hit Ctl-C to stop Java VM" ); //check if this called from main thread if ( mainThread == Thread.currentThread() ) { diff --git a/test/jdk/java/awt/print/PageFormat/Orient.java b/test/jdk/java/awt/print/PageFormat/Orient.java index ac3bb1ed840..ea6facaf570 100644 --- a/test/jdk/java/awt/print/PageFormat/Orient.java +++ b/test/jdk/java/awt/print/PageFormat/Orient.java @@ -27,7 +27,7 @@ @summary Confirm that the you get three pages of output, one each in portrait, landscape, and reverse landscape orientations. - @author rbi: area=PageFormat + @key printer @run main/manual Orient */ diff --git a/test/jdk/java/awt/print/PageFormat/PageFormatFromAttributes.java b/test/jdk/java/awt/print/PageFormat/PageFormatFromAttributes.java index e552db507de..b5ac83969f2 100644 --- a/test/jdk/java/awt/print/PageFormat/PageFormatFromAttributes.java +++ b/test/jdk/java/awt/print/PageFormat/PageFormatFromAttributes.java @@ -25,6 +25,7 @@ * @test * @bug 4500750 6848799 8028584 * @summary Tests creating page format from attributes + * @key printer * @run main PageFormatFromAttributes */ import java.awt.print.*; diff --git a/test/jdk/java/awt/print/PageFormat/PageSetupDialog.java b/test/jdk/java/awt/print/PageFormat/PageSetupDialog.java index 98da138ac22..5284793ef01 100644 --- a/test/jdk/java/awt/print/PageFormat/PageSetupDialog.java +++ b/test/jdk/java/awt/print/PageFormat/PageSetupDialog.java @@ -28,7 +28,7 @@ * @bug 6358747 * @bug 6574633 * @summary Page setup dialog settings - * @author prr + * @key printer * @run main/manual PageSetupDialog */ diff --git a/test/jdk/java/awt/print/PageFormat/PrintContentCutOffTest.java b/test/jdk/java/awt/print/PageFormat/PrintContentCutOffTest.java index d2362cdc815..df07741c907 100644 --- a/test/jdk/java/awt/print/PageFormat/PrintContentCutOffTest.java +++ b/test/jdk/java/awt/print/PageFormat/PrintContentCutOffTest.java @@ -24,6 +24,7 @@ /** * @test + * @key printer * @bug 8295737 * @summary macOS: Print content cut off when width > height with portrait orientation * @run main/othervm/manual PrintContentCutOffTest diff --git a/test/jdk/java/awt/print/PageFormat/ReverseLandscapeTest.java b/test/jdk/java/awt/print/PageFormat/ReverseLandscapeTest.java index 2c6544f4af1..850123aa9a8 100644 --- a/test/jdk/java/awt/print/PageFormat/ReverseLandscapeTest.java +++ b/test/jdk/java/awt/print/PageFormat/ReverseLandscapeTest.java @@ -23,7 +23,7 @@ /* * @test - * @key headful + * @key headful printer * @bug 4254954 * @summary PageFormat would fail on solaris when setting orientation */ diff --git a/test/jdk/java/awt/print/PageFormat/SetOrient.html b/test/jdk/java/awt/print/PageFormat/SetOrient.html index e500872ff05..422d64e4610 100644 --- a/test/jdk/java/awt/print/PageFormat/SetOrient.html +++ b/test/jdk/java/awt/print/PageFormat/SetOrient.html @@ -27,6 +27,7 @@ @bug 4186119 @summary Confirm that the clip and transform of the Graphics2D is affected by the landscape orientation of the PageFormat. + @key printer @run applet/manual=yesno SetOrient.html --> diff --git a/test/jdk/java/awt/print/PageFormat/SmallPaperPrinting.java b/test/jdk/java/awt/print/PageFormat/SmallPaperPrinting.java index e03e9f283b2..e936cd047de 100644 --- a/test/jdk/java/awt/print/PageFormat/SmallPaperPrinting.java +++ b/test/jdk/java/awt/print/PageFormat/SmallPaperPrinting.java @@ -21,43 +21,56 @@ * questions. */ - import java.awt.*; - import java.awt.print.*; +import java.awt.Graphics; +import java.awt.print.PageFormat; +import java.awt.print.Paper; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; - public class SmallPaperPrinting - { - public static void main(String args[]) - { - System.out.println("----------------- Instructions --------------------"); - System.out.println("Arguments: (none) - paper width=1, height=.0001"); - System.out.println(" 1 - paper width=.0001, height=1"); - System.out.println(" 2 - paper width=-1, height=1"); - System.out.println("A passing test should catch a PrinterException"); - System.out.println("and should display \"Print error: (exception msg)\"."); - System.out.println("---------------------------------------------------\n"); - PrinterJob job = PrinterJob.getPrinterJob(); - PageFormat format = job.defaultPage(); - Paper paper = format.getPaper(); +/* + * @test + * @key printer + * @run main/othervm SmallPaperPrinting + * @run main/othervm SmallPaperPrinting 1 + * @run main/othervm SmallPaperPrinting 2 + */ + +public class SmallPaperPrinting +{ + public static void main(String args[]) { + System.out.println("----------------- Instructions --------------------"); + System.out.println("Arguments: (none) - paper width=1, height=.0001"); + System.out.println(" 1 - paper width=.0001, height=1"); + System.out.println(" 2 - paper width=-1, height=1"); + System.out.println("A passing test should catch a PrinterException"); + System.out.println("and should display \"Print error: (exception msg)\"."); + System.out.println("---------------------------------------------------\n"); + PrinterJob job = PrinterJob.getPrinterJob(); + PageFormat format = job.defaultPage(); + Paper paper = format.getPaper(); - double w = 1, h = .0001; // Generates ArithmeticException: / by zero. - if(args.length > 0 && args[0].equals("1")) { - w = .0001; h = 1; } // Generates IllegalArgumentException. - else if(args.length > 0 && args[0].equals("2")) { - w = -1; h = 1; } // Generates NegativeArraySizeException. - paper.setSize(w, h); - paper.setImageableArea(0, 0, w, h); - format.setPaper(paper); - job.setPrintable( - new Printable() { - public int print(Graphics g, PageFormat page_format, int page) { - return NO_SUCH_PAGE; - } - }, format); + double w = 1, h = .0001; // Generates ArithmeticException: / by zero. + if (args.length > 0 && args[0].equals("1")) { + w = .0001; h = 1; + } // Generates IllegalArgumentException. + else if (args.length > 0 && args[0].equals("2")) { + w = -1; h = 1; + } // Generates NegativeArraySizeException. + paper.setSize(w, h); + paper.setImageableArea(0, 0, w, h); + format.setPaper(paper); + job.setPrintable( + new Printable() { + public int print(Graphics g, PageFormat page_format, int page) { + return NO_SUCH_PAGE; + } + }, format); - try { - job.print(); } - catch(PrinterException e) { - System.err.println("Print error:\n" + e.getMessage()); // Passing test! - } + try { + job.print(); + } catch (PrinterException e) { + System.err.println("Print error:\n" + e.getMessage()); // Passing test! } } +} diff --git a/test/jdk/java/awt/print/PageFormat/ValidateCustom.java b/test/jdk/java/awt/print/PageFormat/ValidateCustom.java index e15eebf9bc4..2521609ee4f 100644 --- a/test/jdk/java/awt/print/PageFormat/ValidateCustom.java +++ b/test/jdk/java/awt/print/PageFormat/ValidateCustom.java @@ -24,7 +24,7 @@ /* * @test * @bug 4414987 - * @author Jennifer Godinez + * @key printer * @summary Displays width & height of validated custom paper size * @run main/manual ValidateCustom */ diff --git a/test/jdk/java/awt/print/PageFormat/WrongPaperForBookPrintingTest.java b/test/jdk/java/awt/print/PageFormat/WrongPaperForBookPrintingTest.java index 5c4410e0ee4..1015fab4ed6 100644 --- a/test/jdk/java/awt/print/PageFormat/WrongPaperForBookPrintingTest.java +++ b/test/jdk/java/awt/print/PageFormat/WrongPaperForBookPrintingTest.java @@ -22,7 +22,7 @@ */ /* @test - @key headful + @key printer @bug 8201818 @summary Printing attributes break page size set via "java.awt.print.Book" object diff --git a/test/jdk/java/awt/print/PageFormat/WrongPaperPrintingTest.java b/test/jdk/java/awt/print/PageFormat/WrongPaperPrintingTest.java index 77b46031487..d96d4a4c336 100644 --- a/test/jdk/java/awt/print/PageFormat/WrongPaperPrintingTest.java +++ b/test/jdk/java/awt/print/PageFormat/WrongPaperPrintingTest.java @@ -23,6 +23,7 @@ /* @test @bug 8167102 8181659 + @key printer @summary PrintRequestAttributeSet breaks page size set using PageFormat @run main/manual WrongPaperPrintingTest */ diff --git a/test/jdk/java/awt/print/PathPrecisionScaleFactor/PathPrecisionScaleFactorShapeTest.java b/test/jdk/java/awt/print/PathPrecisionScaleFactor/PathPrecisionScaleFactorShapeTest.java index 3b90d1e2068..9a626eae364 100644 --- a/test/jdk/java/awt/print/PathPrecisionScaleFactor/PathPrecisionScaleFactorShapeTest.java +++ b/test/jdk/java/awt/print/PathPrecisionScaleFactor/PathPrecisionScaleFactorShapeTest.java @@ -25,6 +25,7 @@ /** * @test * @bug 8262470 + * @key printer * @requires (os.family == "windows") * @summary Check thay shapes are properly painted with the precision scale factor * @run main/othervm/manual PathPrecisionScaleFactorShapeTest diff --git a/test/jdk/java/awt/print/PathPrecisionScaleFactor/PathPrecisionScaleFactorTextTest.java b/test/jdk/java/awt/print/PathPrecisionScaleFactor/PathPrecisionScaleFactorTextTest.java index 9b20ab4748a..f959ec9ca7c 100644 --- a/test/jdk/java/awt/print/PathPrecisionScaleFactor/PathPrecisionScaleFactorTextTest.java +++ b/test/jdk/java/awt/print/PathPrecisionScaleFactor/PathPrecisionScaleFactorTextTest.java @@ -25,6 +25,7 @@ /** * @test * @bug 8262470 + * @key printer * @requires (os.family == "windows") * @summary Check that a GlyphVector outline is printed with good quility on low dpi printers * @run main/othervm/manual PathPrecisionScaleFactorTextTest diff --git a/test/jdk/java/awt/print/PrinterJob/BannerTest.java b/test/jdk/java/awt/print/PrinterJob/BannerTest.java index e061e240400..e98bfaaf8d6 100644 --- a/test/jdk/java/awt/print/PrinterJob/BannerTest.java +++ b/test/jdk/java/awt/print/PrinterJob/BannerTest.java @@ -23,6 +23,7 @@ /* * @test * @bug 6575247 8170579 + * @key printer * @summary Verifies if Banner page is printed * @requires os.family == "solaris" * @run main/manual BannerTest diff --git a/test/jdk/java/awt/print/PrinterJob/Cancel/PrinterJobCancel.java b/test/jdk/java/awt/print/PrinterJob/Cancel/PrinterJobCancel.java index 0ad27cb5a53..20197224f56 100644 --- a/test/jdk/java/awt/print/PrinterJob/Cancel/PrinterJobCancel.java +++ b/test/jdk/java/awt/print/PrinterJob/Cancel/PrinterJobCancel.java @@ -25,7 +25,7 @@ * @test * @bug 4245280 * @summary PrinterJob not cancelled when PrinterJob.cancel() is used - * @author prr + * @key printer * @run main/manual PrinterJobCancel */ diff --git a/test/jdk/java/awt/print/PrinterJob/Collate2DPrintingTest.java b/test/jdk/java/awt/print/PrinterJob/Collate2DPrintingTest.java index 8d08da6a4a5..754030c4e9e 100644 --- a/test/jdk/java/awt/print/PrinterJob/Collate2DPrintingTest.java +++ b/test/jdk/java/awt/print/PrinterJob/Collate2DPrintingTest.java @@ -25,6 +25,7 @@ * @test * @bug 6362683 8012381 * @summary Collation should work. + * @key printer * @run main/manual Collate2DPrintingTest */ import java.awt.*; diff --git a/test/jdk/java/awt/print/PrinterJob/CompareImageable.java b/test/jdk/java/awt/print/PrinterJob/CompareImageable.java index 79a78c3b5a8..aec27d09d93 100644 --- a/test/jdk/java/awt/print/PrinterJob/CompareImageable.java +++ b/test/jdk/java/awt/print/PrinterJob/CompareImageable.java @@ -24,6 +24,7 @@ /* @test @bug 4748055 + @key printer @summary PASS if the values are same in both cases (2 and 3) below. @run main/manual CompareImageable */ diff --git a/test/jdk/java/awt/print/PrinterJob/CustomFont/CustomFont.java b/test/jdk/java/awt/print/PrinterJob/CustomFont/CustomFont.java index 2b6c91fc053..e12b7fe1689 100644 --- a/test/jdk/java/awt/print/PrinterJob/CustomFont/CustomFont.java +++ b/test/jdk/java/awt/print/PrinterJob/CustomFont/CustomFont.java @@ -25,7 +25,7 @@ @test @bug 4386025 8231243 @summary fonts not in win32 font directory print incorrectly. - @author prr: area=PrinterJob + @key printer @run main/manual CustomFont */ import java.io.*; diff --git a/test/jdk/java/awt/print/PrinterJob/CustomPrintService/PrintDialog.java b/test/jdk/java/awt/print/PrinterJob/CustomPrintService/PrintDialog.java index d18ee86878d..cf37cf0cfa7 100644 --- a/test/jdk/java/awt/print/PrinterJob/CustomPrintService/PrintDialog.java +++ b/test/jdk/java/awt/print/PrinterJob/CustomPrintService/PrintDialog.java @@ -30,7 +30,6 @@ * @bug 6870661 * @summary Verify that no native dialog is opened for a custom PrintService * @run main/manual PrintDialog - * @author reinhapa */ public class PrintDialog { diff --git a/test/jdk/java/awt/print/PrinterJob/CustomPrintService/SetPrintServiceTest.java b/test/jdk/java/awt/print/PrinterJob/CustomPrintService/SetPrintServiceTest.java index 9c3ebe7d921..5a7fb526e9d 100644 --- a/test/jdk/java/awt/print/PrinterJob/CustomPrintService/SetPrintServiceTest.java +++ b/test/jdk/java/awt/print/PrinterJob/CustomPrintService/SetPrintServiceTest.java @@ -28,7 +28,6 @@ * @test * @bug 6870661 * @summary tests setPrintService() with a custom implementation - * @author reinhapa */ public class SetPrintServiceTest { diff --git a/test/jdk/java/awt/print/PrinterJob/DeviceScale.java b/test/jdk/java/awt/print/PrinterJob/DeviceScale.java index 7320eda70c9..008b5d2f0fa 100644 --- a/test/jdk/java/awt/print/PrinterJob/DeviceScale.java +++ b/test/jdk/java/awt/print/PrinterJob/DeviceScale.java @@ -21,7 +21,7 @@ * questions. */ -/* @test 1.2 02/05/15 +/* @test @bug 4810363 4924441 @key printer @run main DeviceScale diff --git a/test/jdk/java/awt/print/PrinterJob/DlgAttrsBug.java b/test/jdk/java/awt/print/PrinterJob/DlgAttrsBug.java index dc31ffda1fd..93fecd486a3 100644 --- a/test/jdk/java/awt/print/PrinterJob/DlgAttrsBug.java +++ b/test/jdk/java/awt/print/PrinterJob/DlgAttrsBug.java @@ -23,6 +23,7 @@ /* * @test * @bug 8061258 + * @key printer * @summary PrinterJob's native Print Dialog does not reflect * specified Copies or Page Ranges * @run main/manual DlgAttrsBug diff --git a/test/jdk/java/awt/print/PrinterJob/DrawImage.java b/test/jdk/java/awt/print/PrinterJob/DrawImage.java index 977dc946a92..2fcc710719c 100644 --- a/test/jdk/java/awt/print/PrinterJob/DrawImage.java +++ b/test/jdk/java/awt/print/PrinterJob/DrawImage.java @@ -24,8 +24,8 @@ /** * @test * @bug 4329866 + * @key printer * @summary Confirm that no printing exception is generated. - * @author jgodinez * @run main/manual DrawImage */ diff --git a/test/jdk/java/awt/print/PrinterJob/DrawStringMethods.java b/test/jdk/java/awt/print/PrinterJob/DrawStringMethods.java index 37bb3e045a5..f5417ebae4d 100644 --- a/test/jdk/java/awt/print/PrinterJob/DrawStringMethods.java +++ b/test/jdk/java/awt/print/PrinterJob/DrawStringMethods.java @@ -24,6 +24,7 @@ /** * @test * @bug 4185019 + * @key printer * @summary Confirm that all of the drawString methods on Graphics2D * work for printer graphics objects. * @run main/manual DrawStringMethods diff --git a/test/jdk/java/awt/print/PrinterJob/EmptyFill.java b/test/jdk/java/awt/print/PrinterJob/EmptyFill.java index ddf8ebb0150..3da1689bc3d 100644 --- a/test/jdk/java/awt/print/PrinterJob/EmptyFill.java +++ b/test/jdk/java/awt/print/PrinterJob/EmptyFill.java @@ -66,11 +66,11 @@ public static void main(String arg[]) throws Exception { } ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); StreamPrintService svc = spfs[0].getPrintService(baos); - - PrinterJob pj = PrinterJob.getPrinterJob(); if (svc == null) { - return; + throw new RuntimeException("Could not create postscript stream"); } + + PrinterJob pj = PrinterJob.getPrinterJob(); pj.setPrintService(svc); pj.setPrintable(new EmptyFill()); pj.print(); diff --git a/test/jdk/java/awt/print/PrinterJob/GetMediasTest.java b/test/jdk/java/awt/print/PrinterJob/GetMediasTest.java index c70d377c6ef..f4ff1643b00 100644 --- a/test/jdk/java/awt/print/PrinterJob/GetMediasTest.java +++ b/test/jdk/java/awt/print/PrinterJob/GetMediasTest.java @@ -24,6 +24,7 @@ /** * @test * @bug 6653384 + * @key printer * @summary No exception should be thrown. * @run main GetMediasTest */ diff --git a/test/jdk/java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java b/test/jdk/java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java index c33dc0f6718..af655b75d36 100644 --- a/test/jdk/java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java +++ b/test/jdk/java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java @@ -25,7 +25,7 @@ * @test * @bug 4521945 7006865 * @summary Test printing images of different types. - * @author prr + * @key printer * @run main/manual ImageTypes */ diff --git a/test/jdk/java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java b/test/jdk/java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java index 4bef1cce0f5..e16dc17c24f 100644 --- a/test/jdk/java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java +++ b/test/jdk/java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java @@ -34,6 +34,7 @@ /* * @test * @bug 6581756 + * @key printer * @library ../../../regtesthelpers * @build PassFailJFrame * @summary Test printing of images which need to have src area clipped diff --git a/test/jdk/java/awt/print/PrinterJob/InitToBlack.java b/test/jdk/java/awt/print/PrinterJob/InitToBlack.java index a4d7dd0a958..7ca5846fd47 100644 --- a/test/jdk/java/awt/print/PrinterJob/InitToBlack.java +++ b/test/jdk/java/awt/print/PrinterJob/InitToBlack.java @@ -24,6 +24,7 @@ /** * @test * @bug 4184565 + * @key printer * @summary Confirm that the default foreground color on a printer * graphics object is black so that rendering will appear * without having to execute setColor first. diff --git a/test/jdk/java/awt/print/PrinterJob/InvalidPage.java b/test/jdk/java/awt/print/PrinterJob/InvalidPage.java index f84bd2c0d78..fd013032052 100644 --- a/test/jdk/java/awt/print/PrinterJob/InvalidPage.java +++ b/test/jdk/java/awt/print/PrinterJob/InvalidPage.java @@ -25,7 +25,7 @@ * @test InvalidPage.java * @bug 4671634 6506286 * @summary Invalid page format can crash win32 JRE - * @author prr + * @key printer * @run main/manual InvalidPage */ diff --git a/test/jdk/java/awt/print/PrinterJob/JobName/PrinterJobName.java b/test/jdk/java/awt/print/PrinterJob/JobName/PrinterJobName.java index a6c65445912..f1b99487788 100644 --- a/test/jdk/java/awt/print/PrinterJob/JobName/PrinterJobName.java +++ b/test/jdk/java/awt/print/PrinterJob/JobName/PrinterJobName.java @@ -25,7 +25,7 @@ * @test * @bug 4205601 * @summary setJobName should be used by PrinterJob - * @author prr + * @key printer * @run main/manual PrinterJobName */ diff --git a/test/jdk/java/awt/print/PrinterJob/LandscapeStackOverflow.java b/test/jdk/java/awt/print/PrinterJob/LandscapeStackOverflow.java index fc65dc9ddab..398939d125d 100644 --- a/test/jdk/java/awt/print/PrinterJob/LandscapeStackOverflow.java +++ b/test/jdk/java/awt/print/PrinterJob/LandscapeStackOverflow.java @@ -22,7 +22,7 @@ */ /* * @test - * @key headful printer + * @key printer * @bug 6842011 8158758 * @summary Test if StackOverflowError occurs during printing landscape with * scale and transform. diff --git a/test/jdk/java/awt/print/PrinterJob/Legal/PrintTest.java b/test/jdk/java/awt/print/PrinterJob/Legal/PrintTest.java index b4c708e2785..f5ee1c4d65a 100644 --- a/test/jdk/java/awt/print/PrinterJob/Legal/PrintTest.java +++ b/test/jdk/java/awt/print/PrinterJob/Legal/PrintTest.java @@ -24,6 +24,7 @@ /** * @test * @bug 4886069 8023045 + * @key printer * @summary Confirm that printer recognizes the Legal selection either by * prompting the user to put Legal paper or automatically selecting * the tray containing Legal Paper. The printout image should not diff --git a/test/jdk/java/awt/print/PrinterJob/LinearGradientPrintingTest.java b/test/jdk/java/awt/print/PrinterJob/LinearGradientPrintingTest.java index ab1ab17aa7f..456b77614a3 100644 --- a/test/jdk/java/awt/print/PrinterJob/LinearGradientPrintingTest.java +++ b/test/jdk/java/awt/print/PrinterJob/LinearGradientPrintingTest.java @@ -24,6 +24,7 @@ * @test * @bug 8162796 * @summary Verifies if LinearGradientPaint is printed in osx + * @key printer * @run main/manual LinearGradientPrintingTest */ import java.awt.BorderLayout; diff --git a/test/jdk/java/awt/print/PrinterJob/MultiMonPrintDlgTest.java b/test/jdk/java/awt/print/PrinterJob/MultiMonPrintDlgTest.java index 4086f663a5c..9da6e64fedc 100644 --- a/test/jdk/java/awt/print/PrinterJob/MultiMonPrintDlgTest.java +++ b/test/jdk/java/awt/print/PrinterJob/MultiMonPrintDlgTest.java @@ -37,6 +37,7 @@ /** * @test * @bug 8138749 + * @key printer multimon * @summary PrinterJob.printDialog() does not support multi-mon, * always displayed on primary * @run main/manual MultiMonPrintDlgTest diff --git a/test/jdk/java/awt/print/PrinterJob/MultiThread/MultiThreadTest.java b/test/jdk/java/awt/print/PrinterJob/MultiThread/MultiThreadTest.java index 8282a052ee1..609cc6f988b 100644 --- a/test/jdk/java/awt/print/PrinterJob/MultiThread/MultiThreadTest.java +++ b/test/jdk/java/awt/print/PrinterJob/MultiThread/MultiThreadTest.java @@ -24,6 +24,7 @@ /** * @test * @bug 4922036 + * @key printer * @summary Confirm that no Exception is thrown and 2 identical output is produced. * @run main/manual MultiThreadTest */ diff --git a/test/jdk/java/awt/print/PrinterJob/NumCopies.java b/test/jdk/java/awt/print/PrinterJob/NumCopies.java index c851e2403d0..119bcab6f7a 100644 --- a/test/jdk/java/awt/print/PrinterJob/NumCopies.java +++ b/test/jdk/java/awt/print/PrinterJob/NumCopies.java @@ -25,7 +25,7 @@ * @test * @bug 4258003 * @summary Checks the right number of copies are printed - * @author prr + * @key printer * @run main/manual NumCopies */ diff --git a/test/jdk/java/awt/print/PrinterJob/PageDialogMarginTest.java b/test/jdk/java/awt/print/PrinterJob/PageDialogMarginTest.java index de47e70f639..1931de988d1 100644 --- a/test/jdk/java/awt/print/PrinterJob/PageDialogMarginTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PageDialogMarginTest.java @@ -24,6 +24,7 @@ /* * @test * @bug 6801613 + * @key printer * @summary Verifies if cross-platform pageDialog and printDialog top margin * entry is working * @run main/manual PageDialogMarginTest diff --git a/test/jdk/java/awt/print/PrinterJob/PageDialogMarginValidation.java b/test/jdk/java/awt/print/PrinterJob/PageDialogMarginValidation.java index d71f84f1879..674266e7fc8 100644 --- a/test/jdk/java/awt/print/PrinterJob/PageDialogMarginValidation.java +++ b/test/jdk/java/awt/print/PrinterJob/PageDialogMarginValidation.java @@ -23,6 +23,7 @@ /* * @test * @bug 6509729 + * @key printer * @summary Verifies pageDialog margin validation is correct * @run main/manual PageDialogMarginValidation */ diff --git a/test/jdk/java/awt/print/PrinterJob/PageDialogTest.java b/test/jdk/java/awt/print/PrinterJob/PageDialogTest.java index 8a8f9839ddf..eea118733de 100644 --- a/test/jdk/java/awt/print/PrinterJob/PageDialogTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PageDialogTest.java @@ -24,6 +24,7 @@ /* @test @bug 6302514 + @key printer @run main/manual PageDialogTest @summary A toolkit modal dialog should not be blocked by Page/Print dialog. */ diff --git a/test/jdk/java/awt/print/PrinterJob/PageDlgApp.java b/test/jdk/java/awt/print/PrinterJob/PageDlgApp.java index e07e8ffd6cf..96d5f64486d 100644 --- a/test/jdk/java/awt/print/PrinterJob/PageDlgApp.java +++ b/test/jdk/java/awt/print/PrinterJob/PageDlgApp.java @@ -31,6 +31,7 @@ /** * @test * @bug 8067059 + * @key printer * @run main/manual PageDlgApp * @summary Test if cancelling dialog returns null when * PrinterJob.pageDialog() with DialogSelectionType.NATIVE is called diff --git a/test/jdk/java/awt/print/PrinterJob/PageDlgPrnButton.java b/test/jdk/java/awt/print/PrinterJob/PageDlgPrnButton.java index 45a1c71a44a..6c000dc7f5f 100644 --- a/test/jdk/java/awt/print/PrinterJob/PageDlgPrnButton.java +++ b/test/jdk/java/awt/print/PrinterJob/PageDlgPrnButton.java @@ -24,6 +24,7 @@ /** * @test * @bug 4956397 + * @key printer * @run main/manual PageDlgPrnButton */ diff --git a/test/jdk/java/awt/print/PrinterJob/PageDlgStackOverflowTest.java b/test/jdk/java/awt/print/PrinterJob/PageDlgStackOverflowTest.java index ffe695d6f48..048b81f273d 100644 --- a/test/jdk/java/awt/print/PrinterJob/PageDlgStackOverflowTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PageDlgStackOverflowTest.java @@ -28,6 +28,7 @@ /** * @test * @bug 8039412 + * @key printer * @run main/manual PageDlgStackOverflowTest * @summary Calling pageDialog() after printDialog with * DialogTypeSelection.NATIVE should not result in StackOverflowError diff --git a/test/jdk/java/awt/print/PrinterJob/PageFormatChange.java b/test/jdk/java/awt/print/PrinterJob/PageFormatChange.java index 7cb9a2bd3ff..3cb4254c64f 100644 --- a/test/jdk/java/awt/print/PrinterJob/PageFormatChange.java +++ b/test/jdk/java/awt/print/PrinterJob/PageFormatChange.java @@ -24,6 +24,7 @@ /** * @test * @bug 6359283 + * @key printer * @summary pagedialog needs to update based on change of printer. * @run main/manual PageFormatChange */ diff --git a/test/jdk/java/awt/print/PrinterJob/PageRanges.java b/test/jdk/java/awt/print/PrinterJob/PageRanges.java index 9bfd79eacce..accde99ae95 100644 --- a/test/jdk/java/awt/print/PrinterJob/PageRanges.java +++ b/test/jdk/java/awt/print/PrinterJob/PageRanges.java @@ -24,6 +24,7 @@ /** * @test * @bug 6575331 + * @key printer * @summary The specified pages should be printed. * @run main/manual=yesno PageRanges */ diff --git a/test/jdk/java/awt/print/PrinterJob/PolylinePrintingTest.java b/test/jdk/java/awt/print/PrinterJob/PolylinePrintingTest.java index 14a04d5542f..7d8568c01f9 100644 --- a/test/jdk/java/awt/print/PrinterJob/PolylinePrintingTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PolylinePrintingTest.java @@ -23,6 +23,7 @@ /** * @bug 8041902 + * @key printer * @summary Test printing of wide poly lines. * @run main/manual=yesno PolylinePrintingTest */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintAWTImage.java b/test/jdk/java/awt/print/PrinterJob/PrintAWTImage.java index 2612ca6bdad..2397931b4fc 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintAWTImage.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintAWTImage.java @@ -23,6 +23,7 @@ /** * @test * @bug 4257262 6708509 + * @key printer * @summary Image should be sent to printer. * @run main/manual PrintAWTImage */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintAllFonts.java b/test/jdk/java/awt/print/PrinterJob/PrintAllFonts.java index 59ebf21ee5b..0c9f8afb769 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintAllFonts.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintAllFonts.java @@ -23,9 +23,11 @@ /** * + * test * @bug 4884389 7183516 + * @key printer * @summary Font specified with face name loses style on printing - * @run main/manual PrintRotatedText + * @run main/manual PrintAllFonts */ import java.awt.*; diff --git a/test/jdk/java/awt/print/PrinterJob/PrintAttributeUpdateTest.java b/test/jdk/java/awt/print/PrinterJob/PrintAttributeUpdateTest.java index 1b69e0b8b36..fd92f5deda8 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintAttributeUpdateTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintAttributeUpdateTest.java @@ -24,6 +24,7 @@ /* @test @bug 8042713 8170578 + @key printer @summary Print Dialog does not update attribute set with page range @run main/manual PrintAttributeUpdateTest */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintBadImage.java b/test/jdk/java/awt/print/PrinterJob/PrintBadImage.java index ad3b3fd5d83..48e4503db70 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintBadImage.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintBadImage.java @@ -25,7 +25,7 @@ * @test * @bug 4398853 * @summary Printing shouldn't hang on bad images - * @author prr + * @key printer * @run main/manual PrintBadImage */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintCompoundString.java b/test/jdk/java/awt/print/PrinterJob/PrintCompoundString.java index 82560d8964b..95cebd99765 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintCompoundString.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintCompoundString.java @@ -25,7 +25,7 @@ * @test * @bug 4396835 * @summary Compound font string not printing. - * @author prr + * @key printer * @run main/manual PrintCompoundString */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintDialog.java b/test/jdk/java/awt/print/PrinterJob/PrintDialog.java index 9ab5d63f641..fa9569e1aa7 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintDialog.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintDialog.java @@ -25,7 +25,7 @@ @test PrintDialog.java @bug 4257903 @summary Confirm that the you see the print dialog. - @author prr: area=PrinterJob + @key printer @run main/manual PrintDialog */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintDialogCancel.java b/test/jdk/java/awt/print/PrinterJob/PrintDialogCancel.java index 4fe3d29fe5b..b2d3d3a2230 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintDialogCancel.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintDialogCancel.java @@ -25,7 +25,7 @@ @test @bug 4398231 @summary Confirm that the print dialog returns false when cancelled. - @author prr: area=PrinterJob + @key printer @run main/manual PrintDialogCancel */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintDlgPageable.java b/test/jdk/java/awt/print/PrinterJob/PrintDlgPageable.java index f6a74f9f965..6d1d8bcf6df 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintDlgPageable.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintDlgPageable.java @@ -23,6 +23,7 @@ /* * @test * @bug 4885375 + * @key printer * @summary Verifies if PageRanges To Field is populated based on Pageable * for COMMON print dialog * @run main/manual PrintDlgPageable diff --git a/test/jdk/java/awt/print/PrinterJob/PrintDlgSelectionAttribTest.java b/test/jdk/java/awt/print/PrinterJob/PrintDlgSelectionAttribTest.java index 98585478626..65adee3f4f9 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintDlgSelectionAttribTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintDlgSelectionAttribTest.java @@ -23,6 +23,7 @@ /* * @test * @bug 6529030 8159134 + * @key printer * @summary Verifies if Java Printing: Selection radiobutton gets enabled. * @requires (os.family == "windows") * @run main/manual PrintDlgSelectionAttribTest diff --git a/test/jdk/java/awt/print/PrinterJob/PrintFontStyle.java b/test/jdk/java/awt/print/PrinterJob/PrintFontStyle.java index 3d67246eac2..f9997d443a2 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintFontStyle.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintFontStyle.java @@ -21,6 +21,13 @@ * questions. */ +/* + * Not enabled as a test. Needs some work. + * test + * @key printer + * @run main/manual PrintFontStyle + */ + import java.awt.*; import java.awt.print.*; import java.awt.GraphicsEnvironment; diff --git a/test/jdk/java/awt/print/PrinterJob/PrintGlyphVectorTest.java b/test/jdk/java/awt/print/PrinterJob/PrintGlyphVectorTest.java index bd921b5162d..696cf1b7445 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintGlyphVectorTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintGlyphVectorTest.java @@ -24,6 +24,7 @@ /* * @test * @bug 8029204 + * @key printer * @library ../../regtesthelpers * @build PassFailJFrame * @summary Tests GlyphVector is printed in the correct location diff --git a/test/jdk/java/awt/print/PrinterJob/PrintImage.java b/test/jdk/java/awt/print/PrinterJob/PrintImage.java index 7f632bfa94c..7eed8c2c276 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintImage.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintImage.java @@ -25,7 +25,7 @@ * @test %I %W * @bug 4298489 * @summary Confirm that output is same as screen. - * @author jgodinez + * @key printer * @run main/manual PrintImage */ import java.awt.*; diff --git a/test/jdk/java/awt/print/PrinterJob/PrintLatinCJKTest.java b/test/jdk/java/awt/print/PrinterJob/PrintLatinCJKTest.java index f6221aa5706..5ffb34540ce 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintLatinCJKTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintLatinCJKTest.java @@ -27,6 +27,7 @@ * @library ../../regtesthelpers * @build PassFailJFrame * @summary JDK7 Printing: CJK and Latin Text in string overlap + * @key printer * @run main/manual PrintLatinCJKTest */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintNullString.java b/test/jdk/java/awt/print/PrinterJob/PrintNullString.java index 7e3101c6b30..b46db6a1447 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintNullString.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintNullString.java @@ -25,7 +25,7 @@ * @test * @bug 4223328 * @summary Printer graphics must behave the same as screen graphics - * @author prr + * @key printer * @run main/manual PrintNullString */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintParenString.java b/test/jdk/java/awt/print/PrinterJob/PrintParenString.java index dc6d544d126..f3ed7ec1f3e 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintParenString.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintParenString.java @@ -25,7 +25,7 @@ * @test * @bug 4399442 * @summary Brackets should be quoted in Postscript output - * @author prr + * @key printer * @run main/manual PrintParenString */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintRotatedText.java b/test/jdk/java/awt/print/PrinterJob/PrintRotatedText.java index 5f5a6fa69d6..deabc0e6999 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintRotatedText.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintRotatedText.java @@ -26,7 +26,7 @@ * @bug 4271596 * @bug 4460699 * @summary Rotated text printing - * @author prr + * @key printer * @run main/manual PrintRotatedText */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintTest.java b/test/jdk/java/awt/print/PrinterJob/PrintTest.java index 3c3febe414c..321293877ab 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintTest.java @@ -23,6 +23,7 @@ /* * @test * @bug 8151590 + * @key printer * @summary All radio button should be selected when we call * setDefaultSelection(JobAttributes.DefaultSelectionType.ALL); * @run main/manual PrintTest diff --git a/test/jdk/java/awt/print/PrinterJob/PrintTestLexmarkIQ.java b/test/jdk/java/awt/print/PrinterJob/PrintTestLexmarkIQ.java index cb82100efb0..a5c7110c5d5 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintTestLexmarkIQ.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintTestLexmarkIQ.java @@ -25,6 +25,7 @@ * @bug 6966350 8160882 * @summary Verifies if Empty pages are printed on Lexmark E352dn PS3 * with "1200 IQ" setting + * @key printer * @run main/manual PrintTestLexmarkIQ */ import java.awt.BorderLayout; diff --git a/test/jdk/java/awt/print/PrinterJob/PrintTextLayout.java b/test/jdk/java/awt/print/PrinterJob/PrintTextLayout.java index 2dfd10ccd32..9560c6b86ff 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintTextLayout.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintTextLayout.java @@ -25,7 +25,7 @@ * @test * @bug 4480930 * @summary TextLayout prints as filled shapes - * @author prr + * @key printer * @run main/manual PrintTextLayout */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintTextTest.java b/test/jdk/java/awt/print/PrinterJob/PrintTextTest.java index c7d9c984b64..95bf177aa2f 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintTextTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintTextTest.java @@ -24,6 +24,7 @@ /** * @test * @bug 6425068 7157659 8132890 + * @key printer * @summary Confirm that text prints where we expect to the length we expect. * @run main/manual=yesno PrintTextTest */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintTranslatedFont.java b/test/jdk/java/awt/print/PrinterJob/PrintTranslatedFont.java index fefa737990b..51ff6ce57a7 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintTranslatedFont.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintTranslatedFont.java @@ -24,8 +24,8 @@ /** * @test * @bug 6359734 + * @key printer * @summary Test that fonts with a translation print where they should. - * @author prr * @run main/manual PrintTranslatedFont */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrintVolatileImage.java b/test/jdk/java/awt/print/PrinterJob/PrintVolatileImage.java index 82a7c9ed83d..d594b5a31dd 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintVolatileImage.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintVolatileImage.java @@ -25,7 +25,7 @@ * @test * @bug 4511023 * @summary Image should be sent to printer, no exceptions thrown - * @author prr + * @key printer * @run main/manual PrintVolatileImage */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrinterDialogsModalityTest/PrinterDialogsModalityTest.html b/test/jdk/java/awt/print/PrinterJob/PrinterDialogsModalityTest/PrinterDialogsModalityTest.html index 3b6b87f6b03..9cfb86bd479 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrinterDialogsModalityTest/PrinterDialogsModalityTest.html +++ b/test/jdk/java/awt/print/PrinterJob/PrinterDialogsModalityTest/PrinterDialogsModalityTest.html @@ -25,8 +25,8 @@ diff --git a/test/jdk/java/awt/print/PrinterJob/PrinterDialogsModalityTest/PrinterDialogsModalityTest.java b/test/jdk/java/awt/print/PrinterJob/PrinterDialogsModalityTest/PrinterDialogsModalityTest.java index 2178697b170..bb40832e36f 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrinterDialogsModalityTest/PrinterDialogsModalityTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PrinterDialogsModalityTest/PrinterDialogsModalityTest.java @@ -24,8 +24,8 @@ /* test @bug 4784285 4785920 + @key printer @summary check whether Print- and Page- dialogs are modal and correct window activated after their closing - @author son@sparc.spb.su: area=PrinterJob.modality @run applet/manual=yesno PrinterDialogsModalityTest.html */ diff --git a/test/jdk/java/awt/print/PrinterJob/PrinterJobDialogBugDemo.java b/test/jdk/java/awt/print/PrinterJob/PrinterJobDialogBugDemo.java index d06d08dcbe3..d7a18300bd7 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrinterJobDialogBugDemo.java +++ b/test/jdk/java/awt/print/PrinterJob/PrinterJobDialogBugDemo.java @@ -24,6 +24,7 @@ /** * @test * @bug 4775862 + * @key printer * @run main/manual PrinterJobDialogBugDemo */ import java.awt.BorderLayout; diff --git a/test/jdk/java/awt/print/PrinterJob/RadialGradientPrintingTest.java b/test/jdk/java/awt/print/PrinterJob/RadialGradientPrintingTest.java index 61c9faeda24..8cd538f1d62 100644 --- a/test/jdk/java/awt/print/PrinterJob/RadialGradientPrintingTest.java +++ b/test/jdk/java/awt/print/PrinterJob/RadialGradientPrintingTest.java @@ -23,6 +23,7 @@ /* * @test * @bug 8162796 + * @key printer * @summary Verifies if RadialGradientPaint is printed in osx * @run main/manual RadialGradientPrintingTest */ diff --git a/test/jdk/java/awt/print/PrinterJob/RemoveListener.java b/test/jdk/java/awt/print/PrinterJob/RemoveListener.java index 2a467a438a3..0818cd7e7f4 100644 --- a/test/jdk/java/awt/print/PrinterJob/RemoveListener.java +++ b/test/jdk/java/awt/print/PrinterJob/RemoveListener.java @@ -22,8 +22,9 @@ */ /* - * @test 1.1 01/05/17 + * @test * @bug 4459889 + * @key printer * @summary No NullPointerException should occur. * @run main RemoveListener */ diff --git a/test/jdk/java/awt/print/PrinterJob/SameService.java b/test/jdk/java/awt/print/PrinterJob/SameService.java index 4073b55fb92..611cea9ecdb 100644 --- a/test/jdk/java/awt/print/PrinterJob/SameService.java +++ b/test/jdk/java/awt/print/PrinterJob/SameService.java @@ -24,6 +24,7 @@ /** * @test * @bug 6446094 + * @key printer * @summary Don't re-create print services. * @run main SameService */ diff --git a/test/jdk/java/awt/print/PrinterJob/ScaledText/ScaledText.java b/test/jdk/java/awt/print/PrinterJob/ScaledText/ScaledText.java index a440db4f2f9..22da4431117 100644 --- a/test/jdk/java/awt/print/PrinterJob/ScaledText/ScaledText.java +++ b/test/jdk/java/awt/print/PrinterJob/ScaledText/ScaledText.java @@ -25,7 +25,7 @@ @test @bug 4291373 @summary Printing of scaled text is wrong / disappearing - @author prr: area=PrinterJob + @key printer @run main/manual ScaledText */ import java.awt.*; diff --git a/test/jdk/java/awt/print/PrinterJob/SecurityDialogTest.java b/test/jdk/java/awt/print/PrinterJob/SecurityDialogTest.java index c5d356c6118..d6a9efeb97c 100644 --- a/test/jdk/java/awt/print/PrinterJob/SecurityDialogTest.java +++ b/test/jdk/java/awt/print/PrinterJob/SecurityDialogTest.java @@ -24,6 +24,7 @@ /** * @test * @bug 4937672 5100706 6252456 + * @key printer * @run main/othervm/manual -Djava.security.manager=allow SecurityDialogTest */ diff --git a/test/jdk/java/awt/print/PrinterJob/SetCopies/Test.java b/test/jdk/java/awt/print/PrinterJob/SetCopies/Test.java index 7b8d9ce7c00..b32d716bbee 100644 --- a/test/jdk/java/awt/print/PrinterJob/SetCopies/Test.java +++ b/test/jdk/java/awt/print/PrinterJob/SetCopies/Test.java @@ -24,6 +24,7 @@ /** * @test * @bug 4694495 + * @key printer * @summary Check that the dialog shows copies = 3. * @run main/manual Test */ diff --git a/test/jdk/java/awt/print/PrinterJob/SwingUIText.java b/test/jdk/java/awt/print/PrinterJob/SwingUIText.java index c1e47638023..5fcd5e39158 100644 --- a/test/jdk/java/awt/print/PrinterJob/SwingUIText.java +++ b/test/jdk/java/awt/print/PrinterJob/SwingUIText.java @@ -24,6 +24,7 @@ /** * @test * @bug 6488219 6560738 7158350 8017469 + * @key printer * @summary Test that text printed in Swing UI measures and looks OK. * @run main/manual=yesno PrintTextTest */ diff --git a/test/jdk/java/awt/print/PrinterJob/TestCheckSystemDefaultBannerOption.java b/test/jdk/java/awt/print/PrinterJob/TestCheckSystemDefaultBannerOption.java index b9e18d34393..ca07c05a6ef 100644 --- a/test/jdk/java/awt/print/PrinterJob/TestCheckSystemDefaultBannerOption.java +++ b/test/jdk/java/awt/print/PrinterJob/TestCheckSystemDefaultBannerOption.java @@ -23,6 +23,7 @@ /* * @test * @bug 8165947 8170579 + * @key printer * @summary Verifies System default banner page option is honoured by jdk * @requires os.family == "linux" * @run main/manual TestCheckSystemDefaultBannerOption diff --git a/test/jdk/java/awt/print/PrinterJob/TestMediaTraySelection.java b/test/jdk/java/awt/print/PrinterJob/TestMediaTraySelection.java index f75336c2c0d..6a5a91ac89e 100644 --- a/test/jdk/java/awt/print/PrinterJob/TestMediaTraySelection.java +++ b/test/jdk/java/awt/print/PrinterJob/TestMediaTraySelection.java @@ -24,6 +24,7 @@ * @bug 6357887 8165146 8234393 * @summary Verifies if selected printertray is used * @requires (os.family == "linux" | os.family == "mac") + * @key printer * @run main/manual TestMediaTraySelection */ diff --git a/test/jdk/java/awt/print/PrinterJob/TestPageDlgFrameAssociation.java b/test/jdk/java/awt/print/PrinterJob/TestPageDlgFrameAssociation.java index 32ee61ad1c6..5ca2cda4b60 100644 --- a/test/jdk/java/awt/print/PrinterJob/TestPageDlgFrameAssociation.java +++ b/test/jdk/java/awt/print/PrinterJob/TestPageDlgFrameAssociation.java @@ -23,6 +23,7 @@ /* * @test * @bug 7064425 6948907 + * @key printer * @summary Verifies if owner Frame is associated with page dialog of PrinterJob * @run main/manual TestPageDlgFrameAssociation */ diff --git a/test/jdk/java/awt/print/PrinterJob/TestPrintDlgFrameAssociation.java b/test/jdk/java/awt/print/PrinterJob/TestPrintDlgFrameAssociation.java index d1d54307ab5..e5d58c8baea 100644 --- a/test/jdk/java/awt/print/PrinterJob/TestPrintDlgFrameAssociation.java +++ b/test/jdk/java/awt/print/PrinterJob/TestPrintDlgFrameAssociation.java @@ -23,6 +23,7 @@ /* * @test * @bug 7064425 6948907 + * @key printer * @summary Verifies if owner Frame is associated with print dialog of PrinterJob * @run main/manual TestPrintDlgFrameAssociation */ diff --git a/test/jdk/java/awt/print/PrinterJob/TexturePaintPrintingTest.java b/test/jdk/java/awt/print/PrinterJob/TexturePaintPrintingTest.java index 8ac81c8bbad..3d8c6815f95 100644 --- a/test/jdk/java/awt/print/PrinterJob/TexturePaintPrintingTest.java +++ b/test/jdk/java/awt/print/PrinterJob/TexturePaintPrintingTest.java @@ -23,6 +23,7 @@ /* * @test * @bug 8040635 + * @key printer * @summary Verifies if TexturePaint is printed in osx * @run main/manual TexturePaintPrintingTest */ diff --git a/test/jdk/java/awt/print/PrinterJob/ThinLines.java b/test/jdk/java/awt/print/PrinterJob/ThinLines.java index 2d880a44006..f8e4e60b319 100644 --- a/test/jdk/java/awt/print/PrinterJob/ThinLines.java +++ b/test/jdk/java/awt/print/PrinterJob/ThinLines.java @@ -25,7 +25,7 @@ @test @bug 4190081 @summary Confirm that the you see "Z" shapes on the printed page. - @author prr/rbi: area=PrinterJob + @key printer @run main/manual ThinLines */ diff --git a/test/jdk/java/awt/print/PrinterJob/ValidatePage/ValidatePage.java b/test/jdk/java/awt/print/PrinterJob/ValidatePage/ValidatePage.java index 8c9f81b11df..ccf0bed43bb 100644 --- a/test/jdk/java/awt/print/PrinterJob/ValidatePage/ValidatePage.java +++ b/test/jdk/java/awt/print/PrinterJob/ValidatePage/ValidatePage.java @@ -24,8 +24,8 @@ /** * @test * @bug 4252108 6229507 + * @key printer * @summary PrinterJob.validatePage() is unimplemented. - * @author prr * @run main/manual ValidatePage */ diff --git a/test/jdk/java/awt/print/PrinterJob/XparColor.java b/test/jdk/java/awt/print/PrinterJob/XparColor.java index dd39578f2cb..9a85a78af55 100644 --- a/test/jdk/java/awt/print/PrinterJob/XparColor.java +++ b/test/jdk/java/awt/print/PrinterJob/XparColor.java @@ -24,6 +24,7 @@ /** * @test * @bug 4179262 + @ @key printer * @summary Confirm that transparent colors are printed correctly. The * printout should show transparent rings with increasing darkness toward * the center. diff --git a/test/jdk/java/awt/print/PrinterJob/raster/RasterTest.java b/test/jdk/java/awt/print/PrinterJob/raster/RasterTest.java index 56adc8552f7..29709429913 100644 --- a/test/jdk/java/awt/print/PrinterJob/raster/RasterTest.java +++ b/test/jdk/java/awt/print/PrinterJob/raster/RasterTest.java @@ -25,7 +25,7 @@ * @test * @bug 4242639 * @summary Printing quality problem on Canon and NEC - * @author prr + * @key printer * @run main/manual RasterTest */ import java.awt.*; diff --git a/test/jdk/java/awt/print/RemotePrinterStatusRefresh/RemotePrinterStatusRefresh.java b/test/jdk/java/awt/print/RemotePrinterStatusRefresh/RemotePrinterStatusRefresh.java index 3bfedb463a7..7768c54481a 100644 --- a/test/jdk/java/awt/print/RemotePrinterStatusRefresh/RemotePrinterStatusRefresh.java +++ b/test/jdk/java/awt/print/RemotePrinterStatusRefresh/RemotePrinterStatusRefresh.java @@ -23,6 +23,7 @@ /* * @test + * @key printer * @bug 8153732 8212202 8221263 8221412 8222108 8263311 * @requires (os.family == "Windows") * @summary Windows remote printer changes do not reflect in lookupPrintServices() diff --git a/test/jdk/java/awt/print/bug8023392/bug8023392.html b/test/jdk/java/awt/print/bug8023392/bug8023392.html index c51ae001e2e..178fba9b230 100644 --- a/test/jdk/java/awt/print/bug8023392/bug8023392.html +++ b/test/jdk/java/awt/print/bug8023392/bug8023392.html @@ -26,7 +26,7 @@ @test @bug 8023392 @summary Swing text components printed with spaces between chars - @author Anton Nashatyrev + @key printer @modules java.desktop/sun.swing @run applet/manual=yesno bug8023392.html --> diff --git a/test/jdk/java/awt/print/bug8023392/bug8023392.java b/test/jdk/java/awt/print/bug8023392/bug8023392.java index 071c9021ddf..d792562ea25 100644 --- a/test/jdk/java/awt/print/bug8023392/bug8023392.java +++ b/test/jdk/java/awt/print/bug8023392/bug8023392.java @@ -25,7 +25,7 @@ test @bug 8023392 8259232 @summary Swing text components printed with spaces between chars - @author Anton Nashatyrev + @key printer @run applet/manual=yesno bug8023392.html */ diff --git a/test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java b/test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java index 1ca682e3345..75ea2c8003a 100644 --- a/test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java +++ b/test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java @@ -27,7 +27,7 @@ * that support it, tests using /tmp directory. * @library ../.. /test/lib * @build jdk.test.lib.Platform - * @run main CreationTime + * @run main/native CreationTime */ /* @test id=cwd @@ -36,7 +36,7 @@ * scratch directory maybe at diff disk partition to /tmp on linux. * @library ../.. /test/lib * @build jdk.test.lib.Platform - * @run main CreationTime . + * @run main/native CreationTime . */ import java.nio.file.Path; diff --git a/test/jdk/javax/print/DialogMargins.java b/test/jdk/javax/print/DialogMargins.java index cb5b488369c..ca45a1690a6 100644 --- a/test/jdk/javax/print/DialogMargins.java +++ b/test/jdk/javax/print/DialogMargins.java @@ -24,12 +24,12 @@ /** * @test * @bug 4485755 6361370 6448717 5080051 6939417 8016343 + * @key printer * @summary dialog doesn't have way to specify margins * for 6361370, verify exception for offline printer in Windows * for 6448717, faster display of print dialog * for 6500903, verify status of printer if accepting jobs or not * for 8016343, verify printing to non-default printer - * @author prr * @run main/manual DialogMargins */ diff --git a/test/jdk/javax/print/LookupServices.java b/test/jdk/javax/print/LookupServices.java index 7f6b9f1f604..a5685dbc57c 100644 --- a/test/jdk/javax/print/LookupServices.java +++ b/test/jdk/javax/print/LookupServices.java @@ -24,6 +24,7 @@ /* * @test * @bug 4510477 6520186 + * @key printer * @summary No crash with HP OfficeJet 600 installed. * @run main LookupServices */ diff --git a/test/jdk/javax/print/PrintServiceLookup/GetPrintServices.java b/test/jdk/javax/print/PrintServiceLookup/GetPrintServices.java index 544428566cb..092f7f17da5 100644 --- a/test/jdk/javax/print/PrintServiceLookup/GetPrintServices.java +++ b/test/jdk/javax/print/PrintServiceLookup/GetPrintServices.java @@ -29,6 +29,7 @@ /* * @test + * @key printer * @bug 8013810 8025439 * @summary Test that print service returned without filter are of the same class * as with name filter diff --git a/test/jdk/javax/print/PrintSubInputStream/Example.java b/test/jdk/javax/print/PrintSubInputStream/Example.java index 27acae8af6e..b2aa913dccb 100644 --- a/test/jdk/javax/print/PrintSubInputStream/Example.java +++ b/test/jdk/javax/print/PrintSubInputStream/Example.java @@ -23,9 +23,9 @@ /** * @test + * key printer * @bug 4700712 4707777 * @summary Should submit only 1 job in Windows and print only 1 page. - * @author jgodinez * @run main/manual Example */ import java.awt.*; diff --git a/test/jdk/javax/print/ServiceUIPropBtnTest.java b/test/jdk/javax/print/ServiceUIPropBtnTest.java index ccb57ba4037..189b9b3ac25 100644 --- a/test/jdk/javax/print/ServiceUIPropBtnTest.java +++ b/test/jdk/javax/print/ServiceUIPropBtnTest.java @@ -23,6 +23,7 @@ /* @test @bug 8246742 + @key printer @summary Verifies ServiceUI.printDialog does not support properties dialog @run main/manual ServiceUIPropBtnTest */ diff --git a/test/jdk/javax/print/TextFlavorTest.java b/test/jdk/javax/print/TextFlavorTest.java index f703e8aacc5..18b5e08f6b4 100644 --- a/test/jdk/javax/print/TextFlavorTest.java +++ b/test/jdk/javax/print/TextFlavorTest.java @@ -24,6 +24,7 @@ /* @test @bug 6334074 8022536 + @key printer @summary test supported text flavors reported properly @run main TextFlavorTest */ diff --git a/test/jdk/javax/print/attribute/Chroma.java b/test/jdk/javax/print/attribute/Chroma.java index 5968f951409..60ce9f6719a 100644 --- a/test/jdk/javax/print/attribute/Chroma.java +++ b/test/jdk/javax/print/attribute/Chroma.java @@ -21,7 +21,7 @@ * questions. */ /* - * @test 1.3 01/05/11 + * @test * @bug 4456750 * @summary Test for supported chromaticity values with null DocFlavor. * No exception should be thrown. diff --git a/test/jdk/javax/print/attribute/CollateAttr.java b/test/jdk/javax/print/attribute/CollateAttr.java index 5ea8a78be37..0c6cef60bce 100644 --- a/test/jdk/javax/print/attribute/CollateAttr.java +++ b/test/jdk/javax/print/attribute/CollateAttr.java @@ -24,6 +24,7 @@ /** * @test * @bug 6574117 + * @key printer * @summary Verify no NPE testing service support of SheetCollate * @run main CollateAttr */ diff --git a/test/jdk/javax/print/attribute/PSCopiesFlavorTest.java b/test/jdk/javax/print/attribute/PSCopiesFlavorTest.java index 25b5d955fa5..3f78fa38537 100644 --- a/test/jdk/javax/print/attribute/PSCopiesFlavorTest.java +++ b/test/jdk/javax/print/attribute/PSCopiesFlavorTest.java @@ -24,6 +24,7 @@ /** * @test * @bug 6527316 6732647 + * @key printer * @summary Copies isn't supported for PS flavors. * @run main PSCopiesFlavorTest */ diff --git a/test/jdk/javax/print/attribute/PrintResAttr.java b/test/jdk/javax/print/attribute/PrintResAttr.java index c5467b32532..dee94ae1b78 100644 --- a/test/jdk/javax/print/attribute/PrintResAttr.java +++ b/test/jdk/javax/print/attribute/PrintResAttr.java @@ -23,6 +23,7 @@ /** * @test + * @key printer * @bug 8048328 * @summary CUPS Printing does not report supported printer resolutions. * @run main PrintResAttr diff --git a/test/jdk/javax/print/attribute/ServiceDialogTest.java b/test/jdk/javax/print/attribute/ServiceDialogTest.java index bce24e749cf..626325ab1a4 100644 --- a/test/jdk/javax/print/attribute/ServiceDialogTest.java +++ b/test/jdk/javax/print/attribute/ServiceDialogTest.java @@ -25,6 +25,7 @@ /** * @test * @bug 4910388 4871089 4998624 + * @key printer * @summary Confirm that * 1. After choosing Reverse Landscape in the system default print * Print Service (2nd in the list), it diff --git a/test/jdk/javax/print/attribute/ServiceDialogValidateTest.java b/test/jdk/javax/print/attribute/ServiceDialogValidateTest.java index 929f76869cf..3598d4ae7bd 100644 --- a/test/jdk/javax/print/attribute/ServiceDialogValidateTest.java +++ b/test/jdk/javax/print/attribute/ServiceDialogValidateTest.java @@ -23,6 +23,7 @@ /* * @test * @bug 5049012 8163922 + * @key printer * @summary Verify if PrintToFile option is disabled for flavors that do not * support Destination * @requires (os.family == "linux") diff --git a/test/jdk/javax/print/attribute/ServiceDlgPageRangeTest.java b/test/jdk/javax/print/attribute/ServiceDlgPageRangeTest.java index ab17680cefc..5d38d4b1e11 100644 --- a/test/jdk/javax/print/attribute/ServiceDlgPageRangeTest.java +++ b/test/jdk/javax/print/attribute/ServiceDlgPageRangeTest.java @@ -23,6 +23,7 @@ /* * @test * @bug 5080098 8164205 + * @key printer * @summary Verify if PageRanges option is disabled for Non service-formatted * flavors. * @run main/manual ServiceDlgPageRangeTest diff --git a/test/jdk/javax/print/attribute/ServiceDlgSheetCollateTest.java b/test/jdk/javax/print/attribute/ServiceDlgSheetCollateTest.java index 4f80acc29aa..dd569639f25 100644 --- a/test/jdk/javax/print/attribute/ServiceDlgSheetCollateTest.java +++ b/test/jdk/javax/print/attribute/ServiceDlgSheetCollateTest.java @@ -23,6 +23,7 @@ /* * @test * @bug 5080830 + * @key printer * @summary Verify if SheetCollate option is disabled for flavors that do not * support SheetCollate * @run main/manual ServiceDlgSheetCollateTest diff --git a/test/jdk/javax/print/attribute/Services_getDocFl.java b/test/jdk/javax/print/attribute/Services_getDocFl.java index ca926b39928..63986e46a93 100644 --- a/test/jdk/javax/print/attribute/Services_getDocFl.java +++ b/test/jdk/javax/print/attribute/Services_getDocFl.java @@ -28,6 +28,7 @@ /* * @test + * @key printer * @bug 4901243 8040139 8167291 * @summary JPG, GIF, and PNG DocFlavors (URL) should be supported if Postscript is supported. * @run main Services_getDocFl diff --git a/test/jdk/javax/print/attribute/SidesAttributeTest.java b/test/jdk/javax/print/attribute/SidesAttributeTest.java index 60454f30407..09890c7211b 100644 --- a/test/jdk/javax/print/attribute/SidesAttributeTest.java +++ b/test/jdk/javax/print/attribute/SidesAttributeTest.java @@ -25,6 +25,7 @@ /* * @test * @bug JDK-8311033 + * @key printer * @summary [macos] PrinterJob does not take into account Sides attribute * @run main/manual SidesAttributeTest */ diff --git a/test/jdk/javax/print/attribute/TestUnsupportedResolution.java b/test/jdk/javax/print/attribute/TestUnsupportedResolution.java index 0ecf842af2a..78e7e93c5f5 100644 --- a/test/jdk/javax/print/attribute/TestUnsupportedResolution.java +++ b/test/jdk/javax/print/attribute/TestUnsupportedResolution.java @@ -25,6 +25,7 @@ /** * @test * @bug 8033277 + * @key printer * @summary Confirm that scaling of printout is correct. Manual comparison with printout using a supported resolution is needed. * @run main/manual TestUnsupportedResolution */ diff --git a/test/jdk/javax/print/attribute/autosense/PrintAutoSenseData.java b/test/jdk/javax/print/attribute/autosense/PrintAutoSenseData.java index f5ddc0d15e2..008e0917342 100644 --- a/test/jdk/javax/print/attribute/autosense/PrintAutoSenseData.java +++ b/test/jdk/javax/print/attribute/autosense/PrintAutoSenseData.java @@ -24,6 +24,7 @@ /* * @test * @bug 4468109 8021583 + * @key printer * @summary Test for printing AUTOSENSE DocFlavor. No exception should be thrown. * @run main PrintAutoSenseData */ diff --git a/test/jdk/javax/swing/JButton/bug4234034.java b/test/jdk/javax/swing/JButton/bug4234034.java new file mode 100644 index 00000000000..e1e65345f73 --- /dev/null +++ b/test/jdk/javax/swing/JButton/bug4234034.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1999, 2023, 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. + * + * This code 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 + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4234034 + * @summary Tests NullPointerException when ToolTip invoked via keyboard + * @key headful + * @run main bug4234034 + */ + +import java.awt.Robot; +import java.awt.event.KeyEvent; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +public class bug4234034 { + static JFrame frame; + static JButton button; + + public static void main(String args[]) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(100); + try { + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame("bug4323121"); + button = new JButton("Press tab, then Ctrl+F1"); + button.setToolTipText("Tooltip for button"); + frame.getContentPane().add(button); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_F1); + robot.keyRelease(KeyEvent.VK_F1); + robot.keyRelease(KeyEvent.VK_CONTROL); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/javax/swing/JButton/bug4323121.java b/test/jdk/javax/swing/JButton/bug4323121.java new file mode 100644 index 00000000000..0b352ce57eb --- /dev/null +++ b/test/jdk/javax/swing/JButton/bug4323121.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2000, 2023, 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. + * + * This code 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 + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4323121 + * @summary Tests whether any button that extends JButton always + returns true for isArmed() + * @key headful + * @run main bug4323121 + */ + +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +public class bug4323121 { + + static JFrame frame; + static testButton button; + static volatile Point pt; + static volatile int buttonW; + static volatile int buttonH; + static volatile boolean failed = false; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(100); + try { + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame("bug4323121"); + button = new testButton("gotcha"); + frame.getContentPane().add(button); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + SwingUtilities.invokeAndWait(() -> { + pt = button.getLocationOnScreen(); + buttonW = button.getSize().width; + buttonH = button.getSize().height; + }); + robot.mouseMove(pt.x + buttonW / 2, pt.y + buttonH / 2); + robot.waitForIdle(); + if (failed) { + throw new RuntimeException("Any created button returns " + + "true for isArmed()"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + static class testButton extends JButton implements MouseMotionListener, MouseListener { + public testButton(String label) { + super(label); + addMouseMotionListener(this); + addMouseListener(this); + } + + protected void paintComponent(Graphics g) { + super.paintComponent(g); + } + + protected void paintBorder(Graphics g) { + } + + public void mousePressed(MouseEvent e) { + } + + public void mouseDragged(MouseEvent e) { + } + + public void mouseMoved(MouseEvent e) { + } + + public void mouseReleased(MouseEvent e) { + } + + public void mouseEntered(MouseEvent e) { + if (getModel().isArmed()) { + failed = true; + } + } + + public void mouseExited(MouseEvent e) { + } + + public void mouseClicked(MouseEvent e) { + } + } +} diff --git a/test/jdk/javax/swing/JButton/bug4490179.java b/test/jdk/javax/swing/JButton/bug4490179.java new file mode 100644 index 00000000000..94b141e5030 --- /dev/null +++ b/test/jdk/javax/swing/JButton/bug4490179.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2002, 2023, 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. + * + * This code 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 + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4490179 + * @summary Tests that JButton only responds to left mouse clicks. + * @key headful + * @run main bug4490179 + */ + +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +public class bug4490179 { + static JFrame frame; + static JButton button; + static volatile Point pt; + static volatile int buttonW; + static volatile int buttonH; + static volatile boolean passed = true; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(100); + try { + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame("bug4490179"); + button = new JButton("Button"); + frame.getContentPane().add(button); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + passed = false; + } + }); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + SwingUtilities.invokeAndWait(() -> { + pt = button.getLocationOnScreen(); + buttonW = button.getSize().width; + buttonH = button.getSize().height; + }); + + robot.mouseMove(pt.x + buttonW / 2, pt.y + buttonH / 2); + robot.waitForIdle(); + robot.mousePress(InputEvent.BUTTON3_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK); + + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mousePress(InputEvent.BUTTON3_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK); + + if (!passed) { + throw new RuntimeException("Test Failed"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/jdk/jfr/api/consumer/filestream/TestOrdered.java b/test/jdk/jdk/jfr/api/consumer/filestream/TestOrdered.java index e4eea51d754..8ddc5357b37 100644 --- a/test/jdk/jdk/jfr/api/consumer/filestream/TestOrdered.java +++ b/test/jdk/jdk/jfr/api/consumer/filestream/TestOrdered.java @@ -66,6 +66,11 @@ public void run() { e.printStackTrace(); throw new Error("Unexpected exception in barrier"); } + Instant timestamp = Instant.now(); + // Wait for clock to increment + while (Instant.now().equals(timestamp)) { + ; + } OrderedEvent e2 = new OrderedEvent(); e2.commit(); } @@ -108,6 +113,7 @@ private static void testSetOrderedFalse(Path p) throws Exception { es.setOrdered(false); es.onEvent(e -> { Instant endTime = e.getEndTime(); + System.out.println("testSetOrderedFalse: endTime: " + endTime); if (endTime.isBefore(timestamp.get())) { unoreded.set(true); es.close();