mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
8343224: print/Dialog/PaperSizeError.java fails with MediaSizeName is not A4: A4
Backport-of: b3e63631c7
This commit is contained in:
committed by
Vitaly Provodin
parent
825d308a62
commit
11627dba0b
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@@ -203,16 +203,17 @@ class CustomMediaSizeName extends MediaSizeName {
|
||||
if (value == null) {
|
||||
value = new CustomMediaSizeName(name, choice, width, length);
|
||||
customMap.put(key, value);
|
||||
|
||||
// add this new custom media size name to MediaSize array
|
||||
if ((width > 0.0) && (length > 0.0)) {
|
||||
try {
|
||||
new MediaSize(width, length, Size2DSyntax.INCH, value);
|
||||
} catch (IllegalArgumentException e) {
|
||||
if (value.getStandardMedia() == null) {
|
||||
// add this new custom media size name to MediaSize array
|
||||
if ((width > 0.0) && (length > 0.0)) {
|
||||
try {
|
||||
new MediaSize(width, length, Size2DSyntax.INCH, value);
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* PDF printer in Linux for Ledger paper causes
|
||||
"IllegalArgumentException: X dimension > Y dimension".
|
||||
We rotate based on IPP spec. */
|
||||
new MediaSize(length, width, Size2DSyntax.INCH, value);
|
||||
new MediaSize(length, width, Size2DSyntax.INCH, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@@ -23,16 +23,22 @@
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 6360339
|
||||
* @bug 6360339 8343224
|
||||
* @key printer
|
||||
* @summary Test for fp error in paper size calculations.
|
||||
* @run main/manual PaperSizeError
|
||||
*/
|
||||
|
||||
import java.awt.print.*;
|
||||
import javax.print.*;
|
||||
import javax.print.attribute.*;
|
||||
import javax.print.attribute.standard.*;
|
||||
import javax.print.PrintService;
|
||||
import javax.print.attribute.HashPrintRequestAttributeSet;
|
||||
import javax.print.attribute.PrintRequestAttributeSet;
|
||||
import javax.print.attribute.Size2DSyntax;
|
||||
import javax.print.attribute.standard.MediaSize;
|
||||
import javax.print.attribute.standard.MediaSizeName;
|
||||
import javax.print.attribute.standard.OrientationRequested;
|
||||
import java.awt.print.PageFormat;
|
||||
import java.awt.print.Paper;
|
||||
import java.awt.print.PrinterJob;
|
||||
|
||||
public class PaperSizeError {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user