summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJohn Layt <john@layt.net>2010-02-16 01:13:13 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2010-03-04 14:21:03 (GMT)
commit4984b36c73fb59006a28051ea82bdca0b7aeb457 (patch)
treed4ef8c6f08866bd73c532ef20ae08a0a946b08bd /tests/auto
parentc5264c89b7710dc2f2d8c7c604f0b23852cb2eef (diff)
downloadQt-4984b36c73fb59006a28051ea82bdca0b7aeb457.zip
Qt-4984b36c73fb59006a28051ea82bdca0b7aeb457.tar.gz
Qt-4984b36c73fb59006a28051ea82bdca0b7aeb457.tar.bz2
QPrinter: Add Current Page print range support
Support the selection of Current Page option in the print dialog by activating a new QPrintDialog::PrintDialogOption. If selected the PrintRange is set to CurrentPage. It is the responsibility of the application to read the PrintRange and apply the Current Page selection when rendering the pages. Merge-request: 2311 Reviewed-by: Trond
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qprinter/tst_qprinter.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp
index 7e8ce84..49bddb2 100644
--- a/tests/auto/qprinter/tst_qprinter.cpp
+++ b/tests/auto/qprinter/tst_qprinter.cpp
@@ -107,6 +107,7 @@ private slots:
void printDialogCompleter();
void testCopyCount();
+ void testCurrentPage();
void taskQTBUG4497_reusePrinterOnDifferentFiles();
@@ -1005,5 +1006,27 @@ void tst_QPrinter::taskQTBUG4497_reusePrinterOnDifferentFiles()
QCOMPARE(file1.readAll(), file2.readAll());
}
+void tst_QPrinter::testCurrentPage()
+{
+ QPrinter printer;
+ printer.setFromTo(1, 10);
+
+ // Test set print range
+ printer.setPrintRange(QPrinter::CurrentPage);
+ QCOMPARE(printer.printRange(), QPrinter::CurrentPage);
+ QCOMPARE(printer.fromPage(), 1);
+ QCOMPARE(printer.toPage(), 10);
+
+ QPrintDialog dialog(&printer);
+
+ // Test default Current Page option to off
+ QCOMPARE(dialog.isOptionEnabled(QPrintDialog::PrintCurrentPage), false);
+
+ // Test enable Current Page option
+ dialog.setOption(QPrintDialog::PrintCurrentPage);
+ QCOMPARE(dialog.isOptionEnabled(QPrintDialog::PrintCurrentPage), true);
+
+}
+
QTEST_MAIN(tst_QPrinter)
#include "tst_qprinter.moc"