Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/awt/PrintJob/SaveDialogTitleTest.java
38811 views
1
/*
2
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 4851363 8025988 8025990
27
* @summary Tests the save to file dialog has a title.
28
* @run main/manual=yesno/othervm SaveDialogTitleTest
29
*/
30
31
import java.awt.*;
32
33
public class SaveDialogTitleTest {
34
35
public static void main(String args[]) {
36
37
System.out.print("Once the dialog appears, press OK and the ");
38
System.out.print("Save to File dialog should appear and it ");
39
System.out.println("must have a window title else the test fails.");
40
System.out.println("To test 8025988: Range should be selected with pages 3 to 8.");
41
System.out.println("To test 8025990: Paper should be Legal and in Landscape.");
42
Toolkit tk = Toolkit.getDefaultToolkit();
43
JobAttributes jobAttributes = new JobAttributes();
44
jobAttributes.setDestination(JobAttributes.DestinationType.FILE);
45
jobAttributes.setDefaultSelection(JobAttributes.DefaultSelectionType.RANGE);
46
jobAttributes.setPageRanges(new int[][]{new int[]{3,8}});
47
PageAttributes page = new PageAttributes();
48
page.setMedia(PageAttributes.MediaType.LEGAL);
49
page.setOrientationRequested(PageAttributes.
50
OrientationRequestedType.LANDSCAPE);
51
52
PrintJob printJob =
53
tk.getPrintJob(new Frame(), "Save Title Test",
54
jobAttributes, page);
55
if (printJob != null) { // in case user cancels.
56
printJob.end();
57
}
58
System.exit(0); // safe because use 'othervm'
59
}
60
}
61
62