summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2022-06-29 07:53:29 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-07-15 09:00:55 +0000
commit6a1a2e00a9f6446b209a8d7f20550bfb7662479d (patch)
treeb4d3f6ecce213d5a4f806b25702b08ee27015acb /tests
parentc67660844257883d7ff8874014f460389a234aa9 (diff)
Relayout QStaticText when dpi changes
If the cached font has a different DPI than the one used in QPainter, we need to treat this the same as if other font properties have changed and redo the layout. This happened when running the QStaticText test on Wayland, because the default dpi was 100 and the QPixmap we ended up drawing to was 96. This caused the pixel size of the font to be calculated differently when doing drawText() (using 96 dpi) and drawStaticText() (using the cached 100 dpi). Fixes: QTBUG-100982 Change-Id: Ie4270341bb8a64b6458eb67ba460a282c65dc26b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit ade2df4c4b2df638fefd42d9b755ee7a789da503) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/text/qstatictext/tst_qstatictext.cpp27
1 files changed, 2 insertions, 25 deletions
diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
index 397a116a73..e6e16374d3 100644
--- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
@@ -82,11 +82,6 @@ private:
Q_DECLARE_METATYPE(QImage::Format);
-static bool isPlatformWayland()
-{
- return QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive);
-}
-
void tst_QStaticText::constructionAndDestruction()
{
QStaticText text("My text");
@@ -148,8 +143,6 @@ void tst_QStaticText::drawToPoint()
}
QVERIFY(imageDrawText.toImage() != m_whiteSquare);
- if (isPlatformWayland())
- QEXPECT_FAIL("", "Wayland: This fails. See QTBUG-100982.", Abort);
QCOMPARE(imageDrawStaticText, imageDrawText);
}
@@ -190,8 +183,6 @@ void tst_QStaticText::drawToRect()
#endif
QVERIFY(imageDrawText.toImage() != m_whiteSquare);
- if (isPlatformWayland())
- QEXPECT_FAIL("", "Wayland: This fails. See QTBUG-100982.", Abort);
QCOMPARE(imageDrawStaticText, imageDrawText);
}
@@ -246,13 +237,11 @@ void tst_QStaticText::compareToDrawText()
#if defined(DEBUG_SAVE_IMAGE)
imageDrawText.save("compareToDrawText_imageDrawText.png");
- imageDrawStaticText.save("compareToDrawText_imageDrawStaticPlainText.png");
- imageDrawStaticText.save("compareToDrawText_imageDrawStaticRichText.png");
+ imageDrawStaticPlainText.save("compareToDrawText_imageDrawStaticPlainText.png");
+ imageDrawStaticRichText.save("compareToDrawText_imageDrawStaticRichText.png");
#endif
QVERIFY(imageDrawText.toImage() != m_whiteSquare);
- if (isPlatformWayland() && font == QFont())
- QEXPECT_FAIL("", "Wayland: This fails. See QTBUG-100982.", Abort);
QCOMPARE(imageDrawStaticPlainText, imageDrawText);
QCOMPARE(imageDrawStaticRichText, imageDrawText);
}
@@ -360,8 +349,6 @@ void tst_QStaticText::setFont()
#endif
QVERIFY(imageDrawText.toImage() != m_whiteSquare);
- if (isPlatformWayland())
- QEXPECT_FAIL("", "Wayland: This fails. See QTBUG-100982.", Abort);
QCOMPARE(imageDrawStaticText, imageDrawText);
}
@@ -385,8 +372,6 @@ void tst_QStaticText::setTextWidth()
}
QVERIFY(imageDrawText.toImage() != m_whiteSquare);
- if (isPlatformWayland())
- QEXPECT_FAIL("", "Wayland: This fails. See QTBUG-100982.", Abort);
QCOMPARE(imageDrawStaticText, imageDrawText);
}
@@ -414,8 +399,6 @@ void tst_QStaticText::translatedPainter()
}
QVERIFY(imageDrawText.toImage() != m_whiteSquare);
- if (isPlatformWayland())
- QEXPECT_FAIL("", "Wayland: This fails. See QTBUG-100982.", Abort);
QCOMPARE(imageDrawStaticText, imageDrawText);
}
@@ -456,8 +439,6 @@ void tst_QStaticText::rotatedPainter()
if (!supportsTransformations())
QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort);
- if (isPlatformWayland())
- QEXPECT_FAIL("", "Wayland: This fails. See QTBUG-100982.", Abort);
QCOMPARE(imageDrawStaticText, imageDrawText);
}
@@ -488,8 +469,6 @@ void tst_QStaticText::scaledPainter()
if (!supportsTransformations())
QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort);
- if (isPlatformWayland())
- QEXPECT_FAIL("", "Wayland: This fails. See QTBUG-100982.", Abort);
QCOMPARE(imageDrawStaticText, imageDrawText);
}
@@ -617,8 +596,6 @@ void tst_QStaticText::transformationChanged()
if (!supportsTransformations())
QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort);
- if (isPlatformWayland())
- QEXPECT_FAIL("", "Wayland: This fails. See QTBUG-100982.", Abort);
QCOMPARE(imageDrawStaticText, imageDrawText);
}