/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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 4252108 6229507
* @summary PrinterJob.validatePage() is unimplemented.
* @author prr
*/
protected void displayPageFormatAttributes() {
int o = myPageFormat.getOrientation();
("Format Orientation = " +
"<invalid>"));
}
d = d * 10.0 + 0.5;
} else {
return ds;
}
}
public ValidatePage() {
super ("Validate Page Test");
myPageFormat = new PageFormat();
myPageFormat.setPaper(p);
setLayout(new FlowLayout());
public void actionPerformed (ActionEvent e) {
}
});
public void actionPerformed (ActionEvent e) {
}
});
public void actionPerformed (ActionEvent e) {
try {
//if (myPrinterJob.printDialog()) {
// }
} catch (PrinterException pe ) {
}
}
});
public void actionPerformed (ActionEvent e) {
}
});
public void actionPerformed (ActionEvent e) {
}
});
public void actionPerformed (ActionEvent e) {
try {
myPageFormat.setPaper(p);
} catch (NumberFormatException nfe) {
}
}
});
"When validating a page, the process is 1st to find the closest matching " + ls +
"paper size, next to make sure the requested imageable area fits within " + ls +
"the printer's imageable area for that paper size. Finally the top and " + ls +
"left margins will be shrunk if they are too great for the adjusted " + ls +
"imageable area to fit at that position. They will shrink by the minimum" + ls +
"To test 6229507, put the minimum margins (all 0s) in Page Setup dialog."+ls+
"Compare Imageable width, height, and margins of portrait against landscape.");
ta.setEditable(false);
addWindowListener (new WindowAdapter() {
public void windowClosing (WindowEvent e) {
dispose();
}
});
setVisible (true);
}
if (pageIndex > 0) {
return Printable.NO_SUCH_PAGE;
}
int o = pageFormat.getOrientation();
"<invalid>"));
(int)pageFormat.getImageableHeight());
return Printable.PAGE_EXISTS;
}
String[] instructions =
{
"You must have a printer available to perform this test",
"This test is very flexible and requires much interaction.",
"There are several buttons.",
"Set Paper: if all fields are valid numbers it sets the Paper object.",
"This is used to create arbitrary nonsensical paper sizes to help",
"test validatePage.",
"Default Page: sets a default page. This should always be valid.",
"Page Setup: brings up the page dialog. You must OK this dialog",
"for it to have any effect. You can use this to set different size,",
"orientation and margins - which of course affect imageable area.",
"Printer: Used to set the current printer. Useful because current",
"printer affects the choice of paper sizes available.",
"You must OK this dialog for it to have any effect.",
"Validate Page:",
"The most important button in the test. By setting nonsensical",
"or valid papers with varying margins etc, this should always find",
"the closest",
"match within the limits of what is possible on the current printer.",
"Print: to the current printer. Not vital for this test.",
"request."
};
Sysout.createDialog( );
new ValidatePage();
}
}
class Sysout {
{
println( "Any messages for the tester will display here." );
}
public static void createDialog( )
{
println( "Any messages for the tester will display here." );
}
{
}
{
}
}// 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.
*/
//DO NOT call this directly, go through Sysout
{
pack();
show();
}// TestDialog()
//DO NOT call this directly, go through Sysout
{
//Clear out any current instructions
//Go down array of instruction strings
{
//chop up each into pieces maxSringLength long
remainingStr = instructions[ i ];
{
//if longer than max then chop off first max chars to print
{
//Try to chop on a word boundary
int posOfSpace = remainingStr.
}
//else just print
else
{
remainingStr = "";
}
}// while
}// for
}//printInstructions()
//DO NOT call this directly, go through Sysout
{
}
}// TestDialog class