Skip to content

Commit

Permalink
Update OutputBinAttributePrintDialogTest to print to all available ou…
Browse files Browse the repository at this point in the history
…tput trays
  • Loading branch information
AlexanderScherbatiy committed May 7, 2024
1 parent b50d209 commit e13edb2
Showing 1 changed file with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
Expand All @@ -70,21 +71,15 @@ public static void main(String[] args) throws Exception {

final DialogTypeSelection dialogTypeSelection = getDialogTypeSelection(args[0]);

OutputBin[] supportedOutputBins = getSupportedOutputBinttributes();
if (supportedOutputBins.length < 1) {
final OutputBin[] supportedOutputBins = getSupportedOutputBinttributes();
if (supportedOutputBins.length < 2) {
return;
}

// Test only the first and the last output bins to reduce number of tests
final Set<OutputBin> outputBins = new HashSet<>();
outputBins.add(supportedOutputBins[0]);
outputBins.add(supportedOutputBins[supportedOutputBins.length - 1]);


SwingUtilities.invokeLater(() -> {
testTotalCount = outputBins.size();
for (OutputBin outputBin : outputBins) {
testPrint(dialogTypeSelection, outputBin, outputBins);
testTotalCount = supportedOutputBins.length;
for (OutputBin outputBin : supportedOutputBins) {
testPrint(dialogTypeSelection, outputBin, supportedOutputBins);
}
testFinished = true;
});
Expand Down Expand Up @@ -196,13 +191,13 @@ private static void runPrint(DialogTypeSelection dialogTypeSelection, OutputBin
}
}

private static void testPrint(DialogTypeSelection dialogTypeSelection, OutputBin outputBin, Set<OutputBin> supportedOutputBins) {
private static void testPrint(DialogTypeSelection dialogTypeSelection, OutputBin outputBin, OutputBin[] supportedOutputBins) {

System.out.printf("Test dialog: %s%n", dialogTypeSelection);

String[] instructions = {
"Up to " + testTotalCount + " tests will run and it will test all output bins:",
supportedOutputBins.toString(),
Arrays.toString(supportedOutputBins),
"supported by the printer.",
"",
"The test is " + (testCount + 1) + " from " + testTotalCount + ".",
Expand Down

0 comments on commit e13edb2

Please sign in to comment.