diff options
author | Peng Wenhao <pengwenhao@uniontech.com> | 2020-08-27 14:21:07 +0800 |
---|---|---|
committer | Peng Wenhao <pengwenhao@uniontech.com> | 2020-09-01 04:57:48 +0800 |
commit | f0ae973244026ca5382f05630bd799b44154d224 (patch) | |
tree | 630eef965e2fe07745c41fffdfa00b30c3ce2485 /tests/auto/printsupport | |
parent | 90358f6042d1fe2db849e17e1b0c875fb0560b20 (diff) |
Qpagedpaintdevice: Use marginsF instead of internal struct margins
resolve remaining Qt6 TODOs
Change-Id: Iad659a09ddfe136bdc545bc0635b4c695540c58b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/printsupport')
-rw-r--r-- | tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index 7529bad833..f3a6c4c695 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -1816,16 +1816,12 @@ void tst_QPrinter::testPageMetrics() if (setMargins) { // Setup the given margins - QPrinter::Margins margins; - margins.left = leftMMf; - margins.right = rightMMf; - margins.top = topMMf; - margins.bottom = bottomMMf; + QMarginsF margins(leftMMf, topMMf, rightMMf, bottomMMf); printer.setMargins(margins); - QCOMPARE(printer.margins().left, leftMMf); - QCOMPARE(printer.margins().right, rightMMf); - QCOMPARE(printer.margins().top, topMMf); - QCOMPARE(printer.margins().bottom, bottomMMf); + QCOMPARE(printer.margins().left(), leftMMf); + QCOMPARE(printer.margins().right(), rightMMf); + QCOMPARE(printer.margins().top(), topMMf); + QCOMPARE(printer.margins().bottom(), bottomMMf); } @@ -1840,17 +1836,17 @@ void tst_QPrinter::testPageMetrics() QCOMPARE(printer.orientation(), QPrinter::Portrait); if (setMargins) { // Check margins unchanged from page size change - QCOMPARE(printer.margins().left, leftMMf); - QCOMPARE(printer.margins().right, rightMMf); - QCOMPARE(printer.margins().top, topMMf); - QCOMPARE(printer.margins().bottom, bottomMMf); + QCOMPARE(printer.margins().left(), leftMMf); + QCOMPARE(printer.margins().right(), rightMMf); + QCOMPARE(printer.margins().top(), topMMf); + QCOMPARE(printer.margins().bottom(), bottomMMf); } else { // Fetch the default margins for the printer and page size // TODO Check against margins from print device when api added - leftMMf = printer.margins().left; - rightMMf = printer.margins().right; - topMMf = printer.margins().top; - bottomMMf = printer.margins().bottom; + leftMMf = printer.margins().left(); + rightMMf = printer.margins().right(); + topMMf = printer.margins().top(); + bottomMMf = printer.margins().bottom(); } // QPagedPaintDevice::pageSizeMM() always returns Portrait @@ -1880,17 +1876,17 @@ void tst_QPrinter::testPageMetrics() QCOMPARE(printer.orientation(), QPrinter::Landscape); if (setMargins) { // Check margins unchanged from page size change - QCOMPARE(printer.margins().left, leftMMf); - QCOMPARE(printer.margins().right, rightMMf); - QCOMPARE(printer.margins().top, topMMf); - QCOMPARE(printer.margins().bottom, bottomMMf); + QCOMPARE(printer.margins().left(), leftMMf); + QCOMPARE(printer.margins().right(), rightMMf); + QCOMPARE(printer.margins().top(), topMMf); + QCOMPARE(printer.margins().bottom(), bottomMMf); } else { // Fetch the default margins for the printer and page size // TODO Check against margins from print device when api added - leftMMf = printer.margins().left; - rightMMf = printer.margins().right; - topMMf = printer.margins().top; - bottomMMf = printer.margins().bottom; + leftMMf = printer.margins().left(); + rightMMf = printer.margins().right(); + topMMf = printer.margins().top(); + bottomMMf = printer.margins().bottom(); } // QPagedPaintDevice::pageSizeMM() always returns Portrait @@ -1921,17 +1917,17 @@ void tst_QPrinter::testPageMetrics() QCOMPARE(printer.orientation(), QPrinter::Landscape); if (setMargins) { // Check margins unchanged from page size change - QCOMPARE(printer.margins().left, leftMMf); - QCOMPARE(printer.margins().right, rightMMf); - QCOMPARE(printer.margins().top, topMMf); - QCOMPARE(printer.margins().bottom, bottomMMf); + QCOMPARE(printer.margins().left(), leftMMf); + QCOMPARE(printer.margins().right(), rightMMf); + QCOMPARE(printer.margins().top(), topMMf); + QCOMPARE(printer.margins().bottom(), bottomMMf); } else { // Fetch the default margins for the printer and page size // TODO Check against margins from print device when api added - leftMMf = printer.margins().left; - rightMMf = printer.margins().right; - topMMf = printer.margins().top; - bottomMMf = printer.margins().bottom; + leftMMf = printer.margins().left(); + rightMMf = printer.margins().right(); + topMMf = printer.margins().top(); + bottomMMf = printer.margins().bottom(); } // QPagedPaintDevice::pageSizeMM() always returns Portrait |