diff options
Diffstat (limited to 'tests/auto/gui/util/qundogroup/tst_qundogroup.cpp')
-rw-r--r-- | tests/auto/gui/util/qundogroup/tst_qundogroup.cpp | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp b/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp index 7c45a60c72..36f72b2ca0 100644 --- a/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp +++ b/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp @@ -1,36 +1,13 @@ -/**************************************************************************** -** -** 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> #include <QUndoGroup> #include <QUndoStack> #include <QAction> #include <QSignalSpy> +#if QT_CONFIG(process) #include <QProcess> +#endif #include <QLibraryInfo> #include <QTranslator> @@ -88,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"); @@ -99,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"); @@ -125,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); } @@ -154,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 |