8352109: java/awt/Desktop/MailTest.java fails in platforms where Action.MAIL is not supported

Reviewed-by: aivanov
This commit is contained in:
Manukumar V S
2025-03-19 15:25:22 +00:00
committed by Alexey Ivanov
parent fed34e46b8
commit c7f333888b

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2025, 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
@@ -21,21 +21,23 @@
* questions.
*/
/*
* @test
* @bug 6255196
* @summary Verifies the function of methods mail() and mail(java.net.URI uri).
* @library /java/awt/regtesthelpers
* @build PassFailJFrame
* @run main/manual MailTest
*/
import java.awt.Desktop;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import javax.swing.JPanel;
import jtreg.SkippedException;
/*
* @test
* @bug 6255196
* @summary Verifies the function of methods mail() and mail(java.net.URI uri).
* @library /java/awt/regtesthelpers /test/lib
* @build PassFailJFrame jtreg.SkippedException
* @run main/manual MailTest
*/
public class MailTest extends JPanel {
static final String INSTRUCTIONS = """
@@ -48,18 +50,7 @@ public class MailTest extends JPanel {
""";
private MailTest() {
if (!Desktop.isDesktopSupported()) {
PassFailJFrame.log("Class java.awt.Desktop is not supported on " +
"current platform. Farther testing will not be performed");
PassFailJFrame.forcePass();
}
Desktop desktop = Desktop.getDesktop();
if (!desktop.isSupported(Desktop.Action.MAIL)) {
PassFailJFrame.log("Action.MAIL is not supported.");
PassFailJFrame.forcePass();
}
/*
* Part 1: launch the mail composing window without a mailto URI.
*/
@@ -103,6 +94,15 @@ public class MailTest extends JPanel {
public static void main(String[] args) throws InterruptedException,
InvocationTargetException {
if (!Desktop.isDesktopSupported()) {
throw new SkippedException("Class java.awt.Desktop is not supported " +
"on current platform. Further testing will not be performed");
}
if (!Desktop.getDesktop().isSupported(Desktop.Action.MAIL)) {
throw new SkippedException("Action.MAIL is not supported.");
}
PassFailJFrame.builder()
.title("Mail Test")
.splitUI(MailTest::new)