summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp')
-rw-r--r--tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp51
1 files changed, 24 insertions, 27 deletions
diff --git a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
index f6700eb43a..678eb0393f 100644
--- a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
@@ -59,6 +34,8 @@ private slots:
void zeroWidthMetrics();
void verticalMetrics_data();
void verticalMetrics();
+ void largeText_data();
+ void largeText(); // QTBUG-123339
};
void tst_QFontMetrics::same()
@@ -413,5 +390,25 @@ void tst_QFontMetrics::verticalMetrics()
QVERIFY(fm.ascent() != 0 || fm.descent() != 0);
}
+void tst_QFontMetrics::largeText_data()
+{
+ QTest::addColumn<qsizetype>("size");
+ for (int i = 1; i < 20; ++i) {
+ qsizetype size = qsizetype(1) << i;
+ QByteArray rowText = QByteArray::number(size);
+ QTest::newRow(rowText.constData()) << size;
+ }
+}
+
+void tst_QFontMetrics::largeText()
+{
+ QFont font;
+ QFontMetrics fm(font);
+ QFETCH(qsizetype, size);
+ QString string(size, QLatin1Char('A'));
+ QRect boundingRect = fm.boundingRect(string);
+ QVERIFY(boundingRect.isValid());
+}
+
QTEST_MAIN(tst_QFontMetrics)
#include "tst_qfontmetrics.moc"