From 0dfcc4baf8e064f0abc14c1eeee7c78df90a50fb Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 24 Oct 2018 09:43:59 +0200 Subject: tst_qquicktext: use new QQuickTest::qWaitForItemPolished() function This is a public function that encapsulates the behavior of the old checks without requiring use of private API. Change-Id: I78b8e0aa2df43df7ff863f076f07cf3a9b8b5d34 Reviewed-by: Gatis Paeglis --- tests/auto/quick/qquicktext/tst_qquicktext.cpp | 157 +++++++++++++------------ 1 file changed, 79 insertions(+), 78 deletions(-) (limited to 'tests/auto/quick/qquicktext/tst_qquicktext.cpp') diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 63e023644f..d8ff2f6e13 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -3140,7 +3141,7 @@ void tst_qquicktext::fontSizeMode() QVERIFY(myText != nullptr); myText->setText(text); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); qreal originalWidth = myText->contentWidth(); qreal originalHeight = myText->contentHeight(); @@ -3154,7 +3155,7 @@ void tst_qquicktext::fontSizeMode() myText->setFont(font); myText->setFontSizeMode(QQuickText::HorizontalFit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // Font size reduced to fit within the width of the item. qreal horizontalFitWidth = myText->contentWidth(); qreal horizontalFitHeight = myText->contentHeight(); @@ -3163,28 +3164,28 @@ void tst_qquicktext::fontSizeMode() // Elide won't affect the size with HorizontalFit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); myText->setElideMode(QQuickText::ElideLeft); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); myText->setElideMode(QQuickText::ElideMiddle); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::VerticalFit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // Font size increased to fill the height of the item. qreal verticalFitHeight = myText->contentHeight(); QVERIFY(myText->contentWidth() > myText->width()); @@ -3193,57 +3194,57 @@ void tst_qquicktext::fontSizeMode() // Elide won't affect the height of a single line with VerticalFit but will crop the width. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(myText->truncated()); QVERIFY(myText->contentWidth() <= myText->width() + 2); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideLeft); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(myText->truncated()); QVERIFY(myText->contentWidth() <= myText->width() + 2); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideMiddle); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(myText->truncated()); QVERIFY(myText->contentWidth() <= myText->width() + 2); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::Fit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // Should be the same as HorizontalFit with no wrapping. QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); // Elide won't affect the size with Fit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); myText->setElideMode(QQuickText::ElideLeft); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); myText->setElideMode(QQuickText::ElideMiddle); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::FixedSize); myText->setWrapMode(QQuickText::Wrap); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); originalWidth = myText->contentWidth(); originalHeight = myText->contentHeight(); @@ -3253,7 +3254,7 @@ void tst_qquicktext::fontSizeMode() QVERIFY(originalHeight > myText->height()); myText->setFontSizeMode(QQuickText::HorizontalFit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // HorizontalFit should reduce the font size to minimize wrapping, which brings it back to the // same size as without text wrapping. QCOMPARE(myText->contentWidth(), horizontalFitWidth); @@ -3261,16 +3262,16 @@ void tst_qquicktext::fontSizeMode() // Elide won't affect the size with HorizontalFit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::VerticalFit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // VerticalFit should reduce the size to the wrapped text within the vertical height. verticalFitHeight = myText->contentHeight(); qreal verticalFitWidth = myText->contentWidth(); @@ -3280,40 +3281,40 @@ void tst_qquicktext::fontSizeMode() // Elide won't affect the height or width of a wrapped text with VerticalFit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::Fit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // Should be the same as VerticalFit with wrapping. QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); // Elide won't affect the size with Fit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::FixedSize); myText->setMaximumLineCount(2); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // The original text wrapped should exceed the height of the item. QVERIFY(originalWidth <= myText->width() + 2); QVERIFY(originalHeight > myText->height()); myText->setFontSizeMode(QQuickText::HorizontalFit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // HorizontalFit should reduce the font size to minimize wrapping, which brings it back to the // same size as without text wrapping. QCOMPARE(myText->contentWidth(), horizontalFitWidth); @@ -3321,16 +3322,16 @@ void tst_qquicktext::fontSizeMode() // Elide won't affect the size with HorizontalFit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::VerticalFit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // VerticalFit should reduce the size to the wrapped text within the vertical height. verticalFitHeight = myText->contentHeight(); verticalFitWidth = myText->contentWidth(); @@ -3340,29 +3341,29 @@ void tst_qquicktext::fontSizeMode() // Elide won't affect the height or width of a wrapped text with VerticalFit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::Fit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // Should be the same as VerticalFit with wrapping. QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); // Elide won't affect the size with Fit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); } void tst_qquicktext::fontSizeModeMultiline_data() @@ -3383,7 +3384,7 @@ void tst_qquicktext::fontSizeModeMultiline() QVERIFY(myText != nullptr); myText->setText(text); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); qreal originalWidth = myText->contentWidth(); qreal originalHeight = myText->contentHeight(); @@ -3398,7 +3399,7 @@ void tst_qquicktext::fontSizeModeMultiline() myText->setFont(font); myText->setFontSizeMode(QQuickText::HorizontalFit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // Font size reduced to fit within the width of the item. QCOMPARE(myText->lineCount(), 2); qreal horizontalFitWidth = myText->contentWidth(); @@ -3408,7 +3409,7 @@ void tst_qquicktext::fontSizeModeMultiline() // Right eliding will remove the last line myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(myText->truncated()); QCOMPARE(myText->lineCount(), 1); QVERIFY(myText->contentWidth() <= myText->width() + 2); @@ -3416,22 +3417,22 @@ void tst_qquicktext::fontSizeModeMultiline() // Left or middle eliding wont have any effect. myText->setElideMode(QQuickText::ElideLeft); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); myText->setElideMode(QQuickText::ElideMiddle); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::VerticalFit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // Font size reduced to fit within the height of the item. qreal verticalFitWidth = myText->contentWidth(); qreal verticalFitHeight = myText->contentHeight(); @@ -3440,58 +3441,58 @@ void tst_qquicktext::fontSizeModeMultiline() // Elide will have no effect. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QVERIFY(myText->contentWidth() <= myText->width() + 2); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideLeft); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideMiddle); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::Fit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // Should be the same as VerticalFit with no wrapping. QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); // Elide won't affect the size with Fit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideLeft); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideMiddle); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::FixedSize); myText->setWrapMode(QQuickText::Wrap); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); originalWidth = myText->contentWidth(); originalHeight = myText->contentHeight(); @@ -3501,7 +3502,7 @@ void tst_qquicktext::fontSizeModeMultiline() QVERIFY(originalHeight > myText->height()); myText->setFontSizeMode(QQuickText::HorizontalFit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // HorizontalFit should reduce the font size to minimize wrapping, which brings it back to the // same size as without text wrapping. QCOMPARE(myText->contentWidth(), horizontalFitWidth); @@ -3509,16 +3510,16 @@ void tst_qquicktext::fontSizeModeMultiline() // Text will be elided vertically with HorizontalFit myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(myText->truncated()); QVERIFY(myText->contentWidth() <= myText->width() + 2); QVERIFY(myText->contentHeight() <= myText->height() + 2); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::VerticalFit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // VerticalFit should reduce the size to the wrapped text within the vertical height. verticalFitHeight = myText->contentHeight(); verticalFitWidth = myText->contentWidth(); @@ -3528,40 +3529,40 @@ void tst_qquicktext::fontSizeModeMultiline() // Elide won't affect the height or width of a wrapped text with VerticalFit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::Fit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // Should be the same as VerticalFit with wrapping. QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); // Elide won't affect the size with Fit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::FixedSize); myText->setMaximumLineCount(2); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // The original text wrapped should exceed the height of the item. QVERIFY(originalWidth <= myText->width() + 2); QVERIFY(originalHeight > myText->height()); myText->setFontSizeMode(QQuickText::HorizontalFit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // HorizontalFit should reduce the font size to minimize wrapping, which brings it back to the // same size as without text wrapping. QCOMPARE(myText->contentWidth(), horizontalFitWidth); @@ -3569,16 +3570,16 @@ void tst_qquicktext::fontSizeModeMultiline() // Elide won't affect the size with HorizontalFit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(myText->truncated()); QVERIFY(myText->contentWidth() <= myText->width() + 2); QVERIFY(myText->contentHeight() <= myText->height() + 2); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::VerticalFit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // VerticalFit should reduce the size to the wrapped text within the vertical height. verticalFitHeight = myText->contentHeight(); verticalFitWidth = myText->contentWidth(); @@ -3588,29 +3589,29 @@ void tst_qquicktext::fontSizeModeMultiline() // Elide won't affect the height or width of a wrapped text with VerticalFit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); myText->setFontSizeMode(QQuickText::Fit); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); // Should be the same as VerticalFit with wrapping. QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); // Elide won't affect the size with Fit. myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QVERIFY(!myText->truncated()); QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); } void tst_qquicktext::multilengthStrings_data() @@ -3635,17 +3636,17 @@ void tst_qquicktext::multilengthStrings() const QString shortText = "fox jumped dog"; myText->setText(longText); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); const qreal longWidth = myText->contentWidth(); const qreal longHeight = myText->contentHeight(); myText->setText(mediumText); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); const qreal mediumWidth = myText->contentWidth(); const qreal mediumHeight = myText->contentHeight(); myText->setText(shortText); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); const qreal shortWidth = myText->contentWidth(); const qreal shortHeight = myText->contentHeight(); @@ -3653,21 +3654,21 @@ void tst_qquicktext::multilengthStrings() myText->setText(longText + QLatin1Char('\x9c') + mediumText + QLatin1Char('\x9c') + shortText); myText->setSize(QSizeF(longWidth, longHeight)); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QCOMPARE(myText->contentWidth(), longWidth); QCOMPARE(myText->contentHeight(), longHeight); QCOMPARE(myText->truncated(), false); myText->setSize(QSizeF(mediumWidth, mediumHeight)); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QCOMPARE(myText->contentWidth(), mediumWidth); QCOMPARE(myText->contentHeight(), mediumHeight); QCOMPARE(myText->truncated(), true); myText->setSize(QSizeF(shortWidth, shortHeight)); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(QQuickTest::qWaitForItemPolished(myText)); QCOMPARE(myText->contentWidth(), shortWidth); QCOMPARE(myText->contentHeight(), shortHeight); -- cgit v1.2.3