summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qsyntaxhighlighter
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/text/qsyntaxhighlighter')
-rw-r--r--tests/auto/gui/text/qsyntaxhighlighter/CMakeLists.txt17
-rw-r--r--tests/auto/gui/text/qsyntaxhighlighter/qsyntaxhighlighter.pro5
-rw-r--r--tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp44
3 files changed, 22 insertions, 44 deletions
diff --git a/tests/auto/gui/text/qsyntaxhighlighter/CMakeLists.txt b/tests/auto/gui/text/qsyntaxhighlighter/CMakeLists.txt
index 4c66cf94a7..f1c9146ce1 100644
--- a/tests/auto/gui/text/qsyntaxhighlighter/CMakeLists.txt
+++ b/tests/auto/gui/text/qsyntaxhighlighter/CMakeLists.txt
@@ -1,20 +1,27 @@
-# Generated from qsyntaxhighlighter.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qsyntaxhighlighter Test:
#####################################################################
-qt_add_test(tst_qsyntaxhighlighter
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qsyntaxhighlighter LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
+qt_internal_add_test(tst_qsyntaxhighlighter
SOURCES
tst_qsyntaxhighlighter.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
)
## Scopes:
#####################################################################
-qt_extend_target(tst_qsyntaxhighlighter CONDITION TARGET Qt::Widgets
- PUBLIC_LIBRARIES
+qt_internal_extend_target(tst_qsyntaxhighlighter CONDITION TARGET Qt::Widgets
+ LIBRARIES
Qt::Widgets
)
diff --git a/tests/auto/gui/text/qsyntaxhighlighter/qsyntaxhighlighter.pro b/tests/auto/gui/text/qsyntaxhighlighter/qsyntaxhighlighter.pro
deleted file mode 100644
index c91eaad944..0000000000
--- a/tests/auto/gui/text/qsyntaxhighlighter/qsyntaxhighlighter.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qsyntaxhighlighter
-SOURCES += tst_qsyntaxhighlighter.cpp
-QT += testlib
-qtHaveModule(widgets): QT += widgets
diff --git a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
index da73e7846a..748f494a41 100644
--- a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
+++ b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
@@ -1,38 +1,14 @@
-/****************************************************************************
-**
-** 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 <QTextDocument>
#include <QTextLayout>
#include <QDebug>
#include <QAbstractTextDocumentLayout>
#include <QSyntaxHighlighter>
+#include <QSignalSpy>
#ifndef QT_NO_WIDGETS
#include <QTextEdit>
@@ -124,7 +100,7 @@ public:
virtual void highlightBlock(const QString &text) override
{
- for (int i = 0; i < formats.count(); ++i) {
+ for (int i = 0; i < formats.size(); ++i) {
const QTextLayout::FormatRange &range = formats.at(i);
setFormat(range.start, range.length, range.format);
}
@@ -185,7 +161,7 @@ public:
commentFormat.setForeground(Qt::darkGreen);
commentFormat.setFontWeight(QFont::StyleItalic);
commentFormat.setFontFixedPitch(true);
- int textLength = text.length();
+ int textLength = text.size();
if (text.startsWith(QLatin1Char(';'))){
// The entire line is a comment
@@ -438,7 +414,7 @@ void tst_QSyntaxHighlighter::preservePreeditArea()
QCOMPARE(hl->callCount, 1);
formats = layout->formats();
- QCOMPARE(formats.count(), 3);
+ QCOMPARE(formats.size(), 3);
range = formats.at(0);
@@ -517,7 +493,7 @@ void tst_QSyntaxHighlighter::noContentsChangedDuringHighlight()
QSignalSpy contentsChangedSpy(doc, SIGNAL(contentsChanged()));
cursor.insertText("Hello World");
- QCOMPARE(contentsChangedSpy.count(), 1);
+ QCOMPARE(contentsChangedSpy.size(), 1);
QVERIFY(hl->highlighted);
QVERIFY(lout->documentChangedCalled);
}