From e0dabfb4bfd93a4407518177043d3dbc85c4bbd9 Mon Sep 17 00:00:00 2001
From: Tejesh R
Date: Thu, 17 Oct 2024 06:38:23 +0000
Subject: [PATCH] 8340279: Open source several AWT Dialog tests - Batch 2
Reviewed-by: abhiscxk, prr
---
test/jdk/ProblemList.txt | 2 +
.../DialogSystemMenu/DialogSystemMenu.java | 122 ++++++++++++++
.../awt/Dialog/DialogSystemMenu/icon24x24.gif | Bin 0 -> 108 bytes
.../awt/Dialog/DialogSystemMenu/iconone.gif | Bin 0 -> 109 bytes
.../awt/Dialog/DialogSystemMenu/icontwo.gif | Bin 0 -> 109 bytes
.../java/awt/Dialog/FileDialogFilterTest.java | 68 ++++++++
.../PrintToFileTest/PrintToFileFrame.java | 40 +++++
.../PrintToFileTest/PrintToFileGranted.java | 70 ++++++++
.../PrintToFileTest/PrintToFileRevoked.java | 69 ++++++++
.../java/awt/Dialog/PrintToFileTest/granted | 10 ++
.../java/awt/Dialog/PrintToFileTest/revoked | 9 ++
.../awt/Dialog/TopmostModalDialogTest.java | 152 ++++++++++++++++++
12 files changed, 542 insertions(+)
create mode 100644 test/jdk/java/awt/Dialog/DialogSystemMenu/DialogSystemMenu.java
create mode 100644 test/jdk/java/awt/Dialog/DialogSystemMenu/icon24x24.gif
create mode 100644 test/jdk/java/awt/Dialog/DialogSystemMenu/iconone.gif
create mode 100644 test/jdk/java/awt/Dialog/DialogSystemMenu/icontwo.gif
create mode 100644 test/jdk/java/awt/Dialog/FileDialogFilterTest.java
create mode 100644 test/jdk/java/awt/Dialog/PrintToFileTest/PrintToFileFrame.java
create mode 100644 test/jdk/java/awt/Dialog/PrintToFileTest/PrintToFileGranted.java
create mode 100644 test/jdk/java/awt/Dialog/PrintToFileTest/PrintToFileRevoked.java
create mode 100644 test/jdk/java/awt/Dialog/PrintToFileTest/granted
create mode 100644 test/jdk/java/awt/Dialog/PrintToFileTest/revoked
create mode 100644 test/jdk/java/awt/Dialog/TopmostModalDialogTest.java
diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
index 942e15002bd..8aa3fea3fde 100644
--- a/test/jdk/ProblemList.txt
+++ b/test/jdk/ProblemList.txt
@@ -478,6 +478,8 @@ java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemoni
java/awt/Window/GetScreenLocation/GetScreenLocationTest.java 8225787 linux-x64
java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java 8266243 macosx-aarch64
+java/awt/Dialog/PrintToFileTest/PrintToFileRevoked.java 8029249 macosx-all
+java/awt/Dialog/PrintToFileTest/PrintToFileGranted.java 8029249 macosx-all
java/awt/Dialog/ChoiceModalDialogTest.java 8161475 macosx-all
java/awt/Dialog/FileDialogUserFilterTest.java 8001142 generic-all
diff --git a/test/jdk/java/awt/Dialog/DialogSystemMenu/DialogSystemMenu.java b/test/jdk/java/awt/Dialog/DialogSystemMenu/DialogSystemMenu.java
new file mode 100644
index 00000000000..3f1639e90a4
--- /dev/null
+++ b/test/jdk/java/awt/Dialog/DialogSystemMenu/DialogSystemMenu.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 1999, 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
+ * 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.Frame;
+import java.awt.event.WindowListener;
+import java.util.List;
+
+/*
+ * @test
+ * @bug 4058953 4094035
+ * @summary Test to verify system menu of a dialog on win32
+ * @requires (os.family == "windows")
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual DialogSystemMenu
+ */
+
+public class DialogSystemMenu {
+ public static void main(String[] args) throws Exception {
+ String INSTRUCTIONS = """
+ 1. Check the following on the first dialog window:
+ Right-clicking on the title bar
+ should bring up a system menu.
+ The system menu should not allow any
+ of the Maximize, Minimize and
+ Restore actions
+
+ 2. The second dialog should be non-resizable
+ and have no application icon.
+ """;
+ PassFailJFrame.builder()
+ .title("Test Instructions")
+ .instructions(INSTRUCTIONS)
+ .rows((int) INSTRUCTIONS.lines().count() + 2)
+ .columns(35)
+ .testUI(initialize())
+ .build()
+ .awaitAndCheck();
+ }
+
+ public static List