The page size test can get confused when two printer papers have the
same size, but the code being tested is actaully correct. Put a temp
QEXPECT_FAIL on the test and some debug statements so we can see why it
fails and fix the test as required.
Change-Id: I160ba2ed7344500d89bdcb9bb416863713fef84b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix the QT_NO_PRINTER build for issues that have accumulated over last
few months, and in the new changes already approved.
Change-Id: I9aed21dee861837fd1a68a96692c873a4f5be293
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Using QPageSize internally provides the Windows ID on all platforms so
remove the conditional compile on the QPrinter api and add support to
the print engines.
Change-Id: I31e23d5090a9b6ceb087c29dead050b0ee1855a5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Use QPageSize and QPageMargins to get/set values in the print engines,
add api to directly set the values, and rewrite the docs to make the
paper-based api obsolete instead of the page-based api.
Add new PPK keys to pass QPageSize, QPageMargins and QPageLayout to the
print engines to ensure no level of detail is lost, e.g. for custom
sizes passed to QPrinter.
[ChangeLog][QtPrintSupport][QPrinter] QPrinter can now use QPageSize
and QPageLayout in the public api to control the page layout for a
print job.
Change-Id: Iee39a4042bcd6141d29b0a82b49066d7a7a78120
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Change the Windows QPrintEngine implementation to use the
QPlatformPrintDevice to obtain device information, and use QPageSize to
obtain page size conversions. A following change will use QPageLayout
to store that page size.
Change-Id: I990943e2b62ab6dab2c4d4a292c7ed7261beadf2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Change the QPrinterInfo implementation to use QPlatformPrintDevice as
the backend. Remove all the old QPrinterInfo related code from the
QPA plugin. Add public api to QPrinterInfo to support some features
from QPlatformPrintDevice.
[ChangeLog][QtPrintSupport][QPrinterInfo] Added new public api for
isRemote(), state(), defaultPageSize(), supportedPageSizes(),
supportsCustomPageSizes(), minimumPhysicalPageSize(),
maximumPhysicalPageSize(), supportedResolutions(),
availablePrinterNames(), and defaultPrinterName(). The use of
availablePrinters() is discouraged due to performance concerns.
Task-number: QTBUG-35248
Change-Id: Ic38323a930549ad67bf04a1a6bb43d623dfe6a33
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Add a new QPA class to abstract Print Devices. Each platform instance
will encapsulate all required details about a print device instead of
the code being distributed throughout the print engine and print
plugin.
Change-Id: I7f6a537ad55a6e7f599d83f461b1e2ee62b15094
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Add more page metrics tests to expose the many bugs and inconsistencies
in the page layout handling. No platform or pdf backend passes all
these tests so they are skipped for now, but following commits will use
the tests to ensure the re-write of the page layout handling fixes the
many problems in a consistent way for all backends.
Change-Id: Ic5b16aa08dfe2bd9a9191662fd2bbe6b913e15c9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Make the printer selection option api public on Windows to be
consistent with Mac, and with the print program api which is already
public.
Change-Id: I3da9684288348eaa43276ca8534a1d5809f7027b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Add support to the Mac and Windows print engines to preserve the
creator name when switching between native and pdf format.
Change-Id: Ie036af3140f24d8e34aa886f091384f93aa0157b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Mac supports Collate Copies using native api, so add support. Note
this is mostly only useful for setting the print dialog default, as
Mac supports server-side multiple copies so the app will never need to
collate the copies itself.
Change PDF and Windows to default to collate true to match Mac as this
is the behavior users expect.
Task-number: QTBUG-27724
Task-number: QTBUG-35251
Task-number: QTBUG-22144
Change-Id: Ia43dbc260b3a71aa5b267cca54c168ffbea794fc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Add support to the Mac print engine for set/get the Document Name using
the Job Name setting. Our documentation states this is one use that the
document name will be put to so is appropriate to be used.
Change the Windows print engine to default to a blank Docuemnt Name
consistent with the other print engines. If still blank when printing
then use a default value.
Task-number: QTBUG-27724
Task-number: QTBUG-22144
Change-Id: If590811b5720e6f759eabc290b578b94e221f9f4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
The PrintEngine keys are not consistently treated across the platforms
and are not properly tested. Start the process of making the print
engines behave consistently by documenting and testing the current
behavior. Ensure all unsupported features return a consistent
default value.
The auto test for valuePreservation() has been flaky depending on the
platform and installed printers so remove it and replace it with more
complete testing. If no native printers available then don't test
the native engines.
Fixes for the individual inconsistent keys will follow.
Task-number: QTBUG-26430
Change-Id: Iab914d7e0a5ae4a2cdc24c8645751f0910cf440c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Currently the QPrinter constructor, setOutputFormat() and
setPrinterName() make bad assumptions about the availability of printers
when configuring NativeFormat which can lead to inconsistent print
engine set-ups leading to crashes in the print dialog, especially on
Windows where a valid DEVMODE is needed.
This change cleans up the init and methods to ensure NativeFormat can
only ever be set if we have both a valid plugin and a valid printer,
if not the PdfFormat is used. One side-effect of this is that it is
now impossible to set an invalid printer name via QPrinter (but still
able to be done via QPrintEngine if really needed). Also if no
default printer is set then use the first available one.
This also fixes a bug where setting a new printer name on Windows
reset all the saved settings.
[ChangeLog][Important Behavior Changes] QPrinter no longer allows you
to set an invalid printer name.
Task-number: QTBUG-34345
Task-number: QTBUG-26008
Task-number: QTBUG-26430
Change-Id: I19737e4209d8c8df5817ea83246b3dd0c483ee85
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
For the conflicts in msvc_nmake.cpp the ifdefs are extended since we
need to support windows phone in the target branch while it is not there
in the current stable branch (as of Qt 5.2).
Conflicts:
configure
qmake/generators/win32/msvc_nmake.cpp
src/3rdparty/angle/src/libEGL/Surface.cpp
src/angle/src/common/common.pri
src/corelib/global/qglobal.h
src/corelib/io/qstandardpaths.cpp
src/plugins/platforms/qnx/qqnxintegration.cpp
src/plugins/platforms/qnx/qqnxscreeneventhandler.h
src/plugins/platforms/xcb/qglxintegration.h
src/widgets/kernel/win.pri
tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
tools/configure/configureapp.cpp
Change-Id: I00b579eefebaf61d26ab9b00046d2b5bd5958812
The QPrinterInfo copy and QPrinter constructors and the assignment
operator were not taking the shared_null into account, and so any use
of them resulted in a new null QPrinterInfo different to shared_null,
which lead to isNull() always returning true in anything other than
the simplest use case. While fixing this also make the shared_null a
Q_GLOBAL_STATIC.
Task-number: QTBUG-21087
Change-Id: I0beb24088208e9ed58d21ca26b0c8d00b02e5b8f
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
When EnumForms was used then the dmPaperSize was not always correct for
the custom paper sizes available on some printers. By using
DeviceCapabilities we can be sure that the information is correct in this
respect.
This also fixes respecting of the custom paper size if one is given and
there is no corresponding existing paper size for it.
Task-number: QTBUG-34276
Change-Id: I9924d5be8527027fc434261e37f6c7aae66210c3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Move the test for QAbstractPrintDialog from widgets into printsupport
Change-Id: Ia7595fa650a7ad565df3090207500ed06564e842
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This simplifies the code a bit and ensures that it is respecting what
the relevant function expects the size to be as.
Change-Id: Iec88fab84c27a33d6f1a9e9413ea6beb0a39c68d
Reviewed-by: John Layt <jlayt@kde.org>
Use the correct metrics for the requested PageSize instead of always
defaulting to A4.
Task-number: QTBUG-30494
Change-Id: Ia3978afe3f7cc9b1ded1065416e5c3def44e7a05
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
These types are either built-in or 'automatically declared' and so
don't need to be explicitly declared as metatypes.
Change-Id: Ifd116dee32a450ff89a9a1011e26b434765d6e95
Reviewed-by: David Faure <david.faure@kdab.com>
When the QPrinter is initalized then it will set up page margins based
on the default paper size. If the paper size is changed to be a custom
one then it should disregard the margins for the default paper size.
If the page margins are set explicitly beforehand then it will use these
page margins.
Change-Id: Ic535c3a80b8b217dbd5eb5f4fb2cbc0ab1354563
Reviewed-by: Titta Heikkala <titta.heikkala@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reverting change: Ia6bc9ae14d79a646e61bfc97652f9f5af90738b3
The previous change does not set the printer correctly. It looks
based on the tests that the correct printer is set, but in reality
the default printer is used (even though printerName() is returning
the printer set).
Updated taskQTBUG4497_reusePrinterOnDifferentFiles() test case
so that it generates PDF instead of PS. Testing the binary output
can't be guaranteed to work in this case.
Change-Id: Iee111f2c2dec84f86344a38816c21e191f5373ea
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
CUPS paper sizes may differ from Qt paper sizes slightly and thus fail
the strict comparison in qprinter tests. This is needed for the
followup patch which initializes the cupsplugin with CUPS/PPD defaults.
Change-Id: Ie66f77ead0204de0fc7c7913005fa516d57d34eb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Change copyrights and license headers from Nokia to Digia
Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
Redoing 5704cbc462
This can't work, because the define comes from qconfig.h, not qmake.
Skipping initTestCase and cleanupTestCase when QT_NO_PRINTER is
defined.
Change-Id: I2527c018294b7518a4692f2c93da933848640b5d
Reviewed-by: J-P Nurmi <j-p.nurmi@nokia.com>
Exclude printsupport tests from the build when QT_NO_PRINTER is
defined.
Change-Id: Iedae91666a599f4b77250abc8aac14c256fde34e
Reviewed-by: J-P Nurmi <j-p.nurmi@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
The CreationDate entry in the two PDF files can potentially
be different depending on when the test is run. We ignore the
line for this entry when comparing the two results.
Task-number: QTBUG-27171
Change-Id: I8978678295217edd537edb0d2c25260813aa3d93
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
The simplePen property was not reset when reusing the QPrinter,
thus we would output two identical setPen() commands in the PDF
making the autotest that compares the results fail.
Task-number: QTBUG-27171
Change-Id: I601042ec59e45ef72a56f230f6112a91a259b4a5
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
After setting the printer name the initialization is no longer done for
a printer with a name. Instead doReinit() method is called to preserve
the orientation (set with setOrientation() method before calling
setPrinterName()). Before the orientation was changed back to default
when setPrinterName() method was called ignoring the orientation set.
Updated also the autotest because the case:
taskQTBUG4497_reusePrinterOnDifferentFiles() is no longer expected to
fail on Windows.
Task-number: QTBUG-26008
Change-Id: Ia6bc9ae14d79a646e61bfc97652f9f5af90738b3
Reviewed-by: Andy Shaw
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Qt 5.0 beta requires changing the default to the 5.0 API, disabling
the deprecated code. However, tests should test (and often do) the
compatibility API too, so turn it back on.
Task-number: QTBUG-25053
Change-Id: I8129c3ef3cb58541c95a32d083850d9e7f768927
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
A previous commit changed the Mac behaviour for printerName()
from returning the CUPS Description to returning the CUPS Name.
In case anyone was relying on this for a human-readable name
add new api to return the CUPS Description. Also add the
Location and Make and Model which will be used in the Unix
print dialog instead of directly calling CUPS.
Change-Id: I9901bf8d6368466adf111580f5db5a3f01ca9170
Reviewed-by: Teemu Katajisto <teemu.katajisto@digia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: John Layt <jlayt@kde.org>
These tests have passed a parallel stress test on all three of Linux,
Mac, Windows. Mark them with CONFIG+=parallel_test to allow CI to run
them in parallel, saving time.
Change-Id: I19fd333c3c645a67374ca998f6c8530dd236b0f8
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Much of the current QPrinterInfo tests fail due to being dependent on
specific physical or network printers being attached. This change
removes all printer specific tests and replaces them with generic
tests that will use whatever printers are installed.
Note if no printers are installed then the tests will still pass. A
later change will add virtual printers to test returned results are
correct.
Windows test code is also required and will come later.
This does not yet remove the "insignificant" status from the test,
further improvements and code fixes are still required.
Change-Id: I60802445924edb126aadf78337a8cb6f2f3b3d37
Reviewed-by: John Layt <jlayt@kde.org>
Change the way the printsupport plugin creates QPrinterInfo
objects, provide platform api to return a named printer, and
expose this as static public api in QPrinterInfo.
Only the Mac plugin used the old api, the other plugins will
have direct support added in separate commits, but will use
the default implementation for now.
Change-Id: I7d6b6556eb39919cfb15bc0e814afbaf13c5712c
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Mac in Qt4 and 5 has been using the PMPrinter Name for the QPrinter
and QPrinterInfo printerName() value, but this is incorrect. This
is in fact the CUPS Description field, is in human readable form
and is not guaranteed to be unique. The CUPS Name field is the
PMPrinter ID value and should be used as the unique identifier
when accessing printers. This has worked up to now due to an
undocumented feature in the OSX api that accepted the Name when
the ID should be used.
Changing all uses of PMPrinterGetName to PMPrinterGetID fixes this
and allows the QPrinterInfo test of names to pass without
munging the names.
Change-Id: I25322aa1a924bed9f67f4ad5e208274c8b700e17
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: John Layt <jlayt@kde.org>
This doesn't compile with a typical cross-compilation setup, which
generally won't include cups headers. The commit should have been
rejected, but wasn't, due to a bug in the Qt Project CI.
Since it now causes all other modules depending on qtbase to fail their
CI, it must be reverted to minimize disruption while the commit can be
amended and/or the test toolchain updated to include cups headers.
This reverts commit 80f7a38890.
Change-Id: I315ae275b37de358a74af28ab7bd691c9849acba
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
CUPS is the only supported print system on UNIX, LPR/PS support has
already been dropped but some LPR specific code still remains.
* Move qt_getCupsPrinterPaperSizes from qprinterinfo_unix to
QCUPSSupport
* Remove qprinterinfo_unix as no longer used
* Remove LPR related code from QPdfPrintEngine
* Remove all QT_NO_LPR uses
* Remove most QT_NO_CUPS uses, use QT_NO_PRINTER where necessary
Some QT_NO_CUPS uses remain in QPdfPrintEngine, these will be removed
in a following change implementing a CUPS plugin.
Change-Id: I439b6fad9cf88c3d24aa48e49475f49ad310dbad
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This test has not failed in the last 1000 CI runs on Mac. It only fails
when the test machine has some printers configured, which is not
presently true for the CI machines.
The two options are to disable the test on all unix platforms (because
it fails on all unicies when there are printers present) or to enable
the test for all platforms so that CI can catch regressions that don't
depend on having printers connected. I choose the latter option.
If the CI machines are configured with printers before the known bug is
fixed, the failures should be marked with QEXPECT_FAIL rather than
disabling the whole test again.
Task-number: QTBUG-23060
Change-Id: I3cebed4aefdd088ff00215ea9d7413f90bd9e9b1
Reviewed-by: John Layt <jlayt@kde.org>
If we want to have any chance of getting the missing printers
reported, we cannot check the size beforehand.
Change-Id: I450897fe53c04aeb1a4b217bd0c1f548c455a428
Reviewed-by: John Layt <jlayt@kde.org>