summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qstatictext
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2022-06-29 07:53:29 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2022-07-14 14:09:33 +0200
commitade2df4c4b2df638fefd42d9b755ee7a789da503 (patch)
tree7e185057db4156bb6eba128a891a2dce5e29ba44 /tests/auto/gui/text/qstatictext
parentfef9e0e216d07d7e8a144f57a8ec4133ff94fac7 (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). Pick-to: 6.4 Fixes: QTBUG-100982 Change-Id: Ie4270341bb8a64b6458eb67ba460a282c65dc26b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests/auto/gui/text/qstatictext')
-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);
}