diff options
Diffstat (limited to 'tests/auto/gui/text/qstatictext')
-rw-r--r-- | tests/auto/gui/text/qstatictext/CMakeLists.txt | 15 | ||||
-rw-r--r-- | tests/auto/gui/text/qstatictext/qstatictext.pro | 7 | ||||
-rw-r--r-- | tests/auto/gui/text/qstatictext/tst_qstatictext.cpp | 103 |
3 files changed, 18 insertions, 107 deletions
diff --git a/tests/auto/gui/text/qstatictext/CMakeLists.txt b/tests/auto/gui/text/qstatictext/CMakeLists.txt index a7ba4e392a..bdad2609fe 100644 --- a/tests/auto/gui/text/qstatictext/CMakeLists.txt +++ b/tests/auto/gui/text/qstatictext/CMakeLists.txt @@ -1,21 +1,28 @@ -# Generated from qstatictext.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_qstatictext Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qstatictext LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qstatictext SOURCES tst_qstatictext.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui ) ## Scopes: ##################################################################### -qt_internal_extend_target(tst_qstatictext CONDITION QT_FEATURE_private_tests - PUBLIC_LIBRARIES +qt_internal_extend_target(tst_qstatictext CONDITION QT_FEATURE_developer_build + LIBRARIES Qt::CorePrivate Qt::GuiPrivate ) diff --git a/tests/auto/gui/text/qstatictext/qstatictext.pro b/tests/auto/gui/text/qstatictext/qstatictext.pro deleted file mode 100644 index 09d0dd4126..0000000000 --- a/tests/auto/gui/text/qstatictext/qstatictext.pro +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG += testcase -TARGET = tst_qstatictext -QT += testlib - -SOURCES += tst_qstatictext.cpp - -qtConfig(private_tests): QT += core-private gui-private diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp index 8908d8b9d1..add2303199 100644 --- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp @@ -1,32 +1,8 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#include <QtTest/QtTest> +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QTest> +#include <QtCore/QSet> #include <QtGui/QGuiApplication> #include <QtGui/QPainter> #include <QtGui/QImage> @@ -74,10 +50,6 @@ private slots: void rotatedPainter(); void scaledPainter(); void projectedPainter(); -#if 0 - void rotatedScaledAndTranslatedPainter_data(); - void rotatedScaledAndTranslatedPainter(); -#endif void transformationChanged(); void plainTextVsRichText(); @@ -261,8 +233,8 @@ 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); @@ -461,9 +433,6 @@ void tst_QStaticText::rotatedPainter() QVERIFY(imageDrawText.toImage() != m_whiteSquare); -#ifdef Q_OS_ANDROID - QEXPECT_FAIL("", "QTBUG-69218", Continue); -#endif if (!supportsTransformations()) QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); @@ -528,61 +497,6 @@ void tst_QStaticText::projectedPainter() QCOMPARE(imageDrawStaticText, imageDrawText); } -#if 0 -void tst_QStaticText::rotatedScaledAndTranslatedPainter_data() -{ - QTest::addColumn<qreal>("offset"); - - for (int i=0; i<100; ++i) { - qreal offset = 300 + i / 100.; - QTest::newRow(QByteArray::number(offset).constData()) << offset; - } -} - -void tst_QStaticText::rotatedScaledAndTranslatedPainter() -{ - QFETCH(qreal, offset); - - QPixmap imageDrawText(1000, 1000); - imageDrawText.fill(Qt::white); - { - QPainter p(&imageDrawText); - p.translate(offset, 0); - p.rotate(45.0); - p.scale(2.0, 2.0); - p.translate(100, 200); - - p.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - } - - QPixmap imageDrawStaticText(1000, 1000); - imageDrawStaticText.fill(Qt::white); - { - QPainter p(&imageDrawStaticText); - p.translate(offset, 0); - p.rotate(45.0); - p.scale(2.0, 2.0); - p.translate(100, 200); - - QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - text.setTextFormat(Qt::PlainText); - - p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text); - } - -#if defined(DEBUG_SAVE_IMAGE) - imageDrawText.save("rotatedScaledAndPainter_imageDrawText.png"); - imageDrawStaticText.save("rotatedScaledAndPainter_imageDrawStaticText.png"); -#endif - - QVERIFY(imageDrawText.toImage() != m_whiteSquare); - - if (!supportsTransformations()) - QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); - QCOMPARE(imageDrawStaticText, imageDrawText); -} -#endif - void tst_QStaticText::transformationChanged() { QPixmap imageDrawText(1000, 1000); @@ -621,9 +535,6 @@ void tst_QStaticText::transformationChanged() QVERIFY(imageDrawText.toImage() != m_whiteSquare); -#ifdef Q_OS_ANDROID - QEXPECT_FAIL("", "QTBUG-69220", Continue); -#endif if (!supportsTransformations()) QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); |