From 2f33e030b8c80b4665cc2c120df7833469c05145 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Wed, 10 Jul 2019 17:04:42 +0200 Subject: Remove usages of deprecated APIs of qtbase/gui - Replaced the usages of deprecated APIs by corresponding alternatives in the library code and documentation. - Modified the tests to make them build when deprecated APIs disabled: * Made the the parts of the tests testing the deprecated APIs to be compiled conditionally, only when the corresponding methods are enabled. * If the test-case tests only the deprecated API, but not the corresponding replacement, added tests for the replacement. Change-Id: Ic38245015377fc0c8127eb5458c184ffd4b450f1 Reviewed-by: Volker Hilsheimer --- tests/auto/gui/text/qtexttable/tst_qtexttable.cpp | 42 +++++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'tests/auto/gui/text/qtexttable/tst_qtexttable.cpp') diff --git a/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp index 22f00c677d..f21b969aa7 100644 --- a/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp +++ b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp @@ -44,6 +44,7 @@ #include #include #endif +#include typedef QList IntList; @@ -91,7 +92,7 @@ private slots: void QTBUG11282_insertBeforeMergedEnding(); #endif void QTBUG22011_insertBeforeRowSpan(); -#ifndef QT_NO_PRINTER +#if !defined(QT_NO_PRINTER) && defined(QT_BUILD_INTERNAL) void QTBUG31330_renderBackground(); #endif @@ -1025,7 +1026,7 @@ void tst_QTextTable::QTBUG22011_insertBeforeRowSpan() QCOMPARE(table->columns(), 6); } -#ifndef QT_NO_PRINTER +#if !defined(QT_NO_PRINTER) && defined(QT_BUILD_INTERNAL) namespace { class QTBUG31330_PaintDevice : public QPagedPaintDevice { @@ -1065,11 +1066,46 @@ public: {} }; + class QDummyPagedPaintDevicePrivate : public QPagedPaintDevicePrivate + { + bool setPageLayout(const QPageLayout &newPageLayout) override + { + m_pageLayout = newPageLayout; + return m_pageLayout.isEquivalentTo(newPageLayout); + } + + bool setPageSize(const QPageSize &pageSize) override + { + m_pageLayout.setPageSize(pageSize); + return m_pageLayout.pageSize().isEquivalentTo(pageSize); + } + + bool setPageOrientation(QPageLayout::Orientation orientation) override + { + m_pageLayout.setOrientation(orientation); + return m_pageLayout.orientation() == orientation; + } + + bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override + { + m_pageLayout.setUnits(units); + m_pageLayout.setMargins(margins); + return m_pageLayout.margins() == margins && m_pageLayout.units() == units; + } + + QPageLayout pageLayout() const override + { + return m_pageLayout; + } + + QPageLayout m_pageLayout; + }; + int pages; QPaintEngine* engine; QTBUG31330_PaintDevice(QPaintEngine* engine) - : pages(1), engine(engine) + : QPagedPaintDevice(new QDummyPagedPaintDevicePrivate), pages(1), engine(engine) { QPageLayout layout = pageLayout(); layout.setUnits(QPageLayout::Point); -- cgit v1.2.3