diff options
Diffstat (limited to 'tests/auto/gui/util/qundogroup')
-rw-r--r-- | tests/auto/gui/util/qundogroup/CMakeLists.txt | 13 | ||||
-rw-r--r-- | tests/auto/gui/util/qundogroup/qundogroup.pro | 4 | ||||
-rw-r--r-- | tests/auto/gui/util/qundogroup/tst_qundogroup.cpp | 63 |
3 files changed, 32 insertions, 48 deletions
diff --git a/tests/auto/gui/util/qundogroup/CMakeLists.txt b/tests/auto/gui/util/qundogroup/CMakeLists.txt index 9aa35ba9a7..98c2f64f88 100644 --- a/tests/auto/gui/util/qundogroup/CMakeLists.txt +++ b/tests/auto/gui/util/qundogroup/CMakeLists.txt @@ -1,12 +1,19 @@ -# Generated from qundogroup.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_qundogroup Test: ##################################################################### -qt_add_test(tst_qundogroup +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qundogroup LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + +qt_internal_add_test(tst_qundogroup SOURCES tst_qundogroup.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui ) diff --git a/tests/auto/gui/util/qundogroup/qundogroup.pro b/tests/auto/gui/util/qundogroup/qundogroup.pro deleted file mode 100644 index fbae557207..0000000000 --- a/tests/auto/gui/util/qundogroup/qundogroup.pro +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG += testcase -QT += testlib -SOURCES += tst_qundogroup.cpp -TARGET = tst_qundogroup diff --git a/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp b/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp index e915fd7e24..36f72b2ca0 100644 --- a/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp +++ b/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp @@ -1,34 +1,15 @@ -/**************************************************************************** -** -** 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 <QUndoGroup> #include <QUndoStack> #include <QAction> +#include <QSignalSpy> +#if QT_CONFIG(process) +#include <QProcess> +#endif +#include <QLibraryInfo> +#include <QTranslator> /****************************************************************************** ** Commands @@ -38,7 +19,7 @@ class InsertCommand : public QUndoCommand { public: InsertCommand(QString *str, int idx, const QString &text, - QUndoCommand *parent = 0); + QUndoCommand *parent = nullptr); virtual void undo() override; virtual void redo() override; @@ -52,7 +33,7 @@ private: class RemoveCommand : public QUndoCommand { public: - RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent = 0); + RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent = nullptr); virtual void undo() override; virtual void redo() override; @@ -66,7 +47,7 @@ private: class AppendCommand : public QUndoCommand { public: - AppendCommand(QString *str, const QString &text, QUndoCommand *parent = 0); + AppendCommand(QString *str, const QString &text, QUndoCommand *parent = nullptr); virtual void undo() override; virtual void redo() override; @@ -84,7 +65,7 @@ InsertCommand::InsertCommand(QString *str, int idx, const QString &text, QUndoCommand *parent) : QUndoCommand(parent) { - QVERIFY(str->length() >= idx); + QVERIFY(str->size() >= idx); setText("insert"); @@ -95,22 +76,22 @@ InsertCommand::InsertCommand(QString *str, int idx, const QString &text, void InsertCommand::redo() { - QVERIFY(m_str->length() >= m_idx); + QVERIFY(m_str->size() >= m_idx); m_str->insert(m_idx, m_text); } void InsertCommand::undo() { - QCOMPARE(m_str->mid(m_idx, m_text.length()), m_text); + QCOMPARE(m_str->mid(m_idx, m_text.size()), m_text); - m_str->remove(m_idx, m_text.length()); + m_str->remove(m_idx, m_text.size()); } RemoveCommand::RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent) : QUndoCommand(parent) { - QVERIFY(str->length() >= idx + len); + QVERIFY(str->size() >= idx + len); setText("remove"); @@ -121,14 +102,14 @@ RemoveCommand::RemoveCommand(QString *str, int idx, int len, QUndoCommand *paren void RemoveCommand::redo() { - QCOMPARE(m_str->mid(m_idx, m_text.length()), m_text); + QCOMPARE(m_str->mid(m_idx, m_text.size()), m_text); - m_str->remove(m_idx, m_text.length()); + m_str->remove(m_idx, m_text.size()); } void RemoveCommand::undo() { - QVERIFY(m_str->length() >= m_idx); + QVERIFY(m_str->size() >= m_idx); m_str->insert(m_idx, m_text); } @@ -150,9 +131,9 @@ void AppendCommand::redo() void AppendCommand::undo() { - QCOMPARE(m_str->mid(m_str->length() - m_text.length()), m_text); + QCOMPARE(m_str->mid(m_str->size() - m_text.size()), m_text); - m_str->truncate(m_str->length() - m_text.length()); + m_str->truncate(m_str->size() - m_text.size()); } int AppendCommand::id() const |