aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp')
-rw-r--r--tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp b/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp
index 94dccf6115..3ee9cc2328 100644
--- a/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp
+++ b/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp
@@ -33,6 +33,7 @@
#include <QtQuickTestUtils/private/visualtestutils_p.h>
#include <QtQuickTemplates2/private/qquickbutton_p.h>
#include <QtQuickControlsTestUtils/private/qtest_quickcontrols_p.h>
+#include <QtQuick/private/qquicktext_p_p.h>
using namespace QQuickVisualTestUtils;
@@ -46,6 +47,7 @@ public:
private slots:
void initTestCase() override;
void flickable();
+ void fractionalFontSize();
private:
QScopedPointer<QPointingDevice> touchDevice;
@@ -93,6 +95,24 @@ void tst_QQuickControl::flickable()
QTRY_COMPARE(buttonClickedSpy.count(), 1);
}
+void tst_QQuickControl::fractionalFontSize()
+{
+ QQuickApplicationHelper helper(this, QStringLiteral("fractionalFontSize.qml"));
+ QQuickWindow *window = helper.window;
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ const QQuickControl *control = window->property("control").value<QQuickControl *>();
+ QVERIFY(control);
+ QQuickText *contentItem = qobject_cast<QQuickText *>(control->contentItem());
+ QVERIFY(contentItem);
+
+ QVERIFY(!contentItem->truncated());
+
+ QVERIFY2(qFuzzyCompare(contentItem->contentWidth(),
+ QQuickTextPrivate::get(contentItem)->layout.boundingRect().width()),
+ "The QQuickText::contentWidth() doesn't match the layout's preferred text width");
+}
+
QTEST_QUICKCONTROLS_MAIN(tst_QQuickControl)
#include "tst_qquickcontrol.moc"