diff options
Diffstat (limited to 'tests/auto/widgets/itemviews/qdatawidgetmapper')
3 files changed, 24 insertions, 46 deletions
diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/CMakeLists.txt b/tests/auto/widgets/itemviews/qdatawidgetmapper/CMakeLists.txt index 6cf9cbca43..e4b2c52fb2 100644 --- a/tests/auto/widgets/itemviews/qdatawidgetmapper/CMakeLists.txt +++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/CMakeLists.txt @@ -1,13 +1,21 @@ -# Generated from qdatawidgetmapper.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_qdatawidgetmapper Test: ##################################################################### -qt_add_test(tst_qdatawidgetmapper +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qdatawidgetmapper LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + +qt_internal_add_test(tst_qdatawidgetmapper SOURCES tst_qdatawidgetmapper.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::Widgets + Qt::WidgetsPrivate ) diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/qdatawidgetmapper.pro b/tests/auto/widgets/itemviews/qdatawidgetmapper/qdatawidgetmapper.pro deleted file mode 100644 index 53b23b5ef2..0000000000 --- a/tests/auto/widgets/itemviews/qdatawidgetmapper/qdatawidgetmapper.pro +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG += testcase -TARGET = tst_qdatawidgetmapper -QT += widgets testlib -SOURCES += tst_qdatawidgetmapper.cpp - - diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp index 856672b957..c3527e4215 100644 --- a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp +++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.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 <QComboBox> #include <QDataWidgetMapper> @@ -36,6 +11,8 @@ #include <QTextEdit> #include <QVBoxLayout> +#include <QtWidgets/private/qapplication_p.h> + class tst_QDataWidgetMapper: public QObject { Q_OBJECT @@ -277,22 +254,22 @@ void tst_QDataWidgetMapper::currentIndexChanged() QSignalSpy spy(&mapper, &QDataWidgetMapper::currentIndexChanged); mapper.toFirst(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.takeFirst().at(0).toInt(), 0); mapper.toNext(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.takeFirst().at(0).toInt(), 1); mapper.setCurrentIndex(7); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.takeFirst().at(0).toInt(), 7); mapper.setCurrentIndex(-1); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); mapper.setCurrentIndex(42); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QDataWidgetMapper::changingValues() @@ -443,27 +420,26 @@ void tst_QDataWidgetMapper::textEditDoesntChangeFocusOnTab_qtbug3305() container.show(); - QApplication::setActiveWindow(&container); QVERIFY(QTest::qWaitForWindowActive(&container)); int closeEditorSpyCount = 0; const QString textEditContents = textEdit->toPlainText(); - QCOMPARE(closeEditorSpy.count(), closeEditorSpyCount); + QCOMPARE(closeEditorSpy.size(), closeEditorSpyCount); QVERIFY(lineEdit->hasFocus()); QVERIFY(!textEdit->hasFocus()); // this will generate a closeEditor for the tab key, and another for the focus out QTest::keyClick(QApplication::focusWidget(), Qt::Key_Tab); closeEditorSpyCount += 2; - QTRY_COMPARE(closeEditorSpy.count(), closeEditorSpyCount); + QTRY_COMPARE(closeEditorSpy.size(), closeEditorSpyCount); QTRY_VERIFY(textEdit->hasFocus()); QVERIFY(!lineEdit->hasFocus()); // now that the text edit is focused, a tab keypress will insert a tab, not change focus QTest::keyClick(QApplication::focusWidget(), Qt::Key_Tab); - QTRY_COMPARE(closeEditorSpy.count(), closeEditorSpyCount); + QTRY_COMPARE(closeEditorSpy.size(), closeEditorSpyCount); QVERIFY(!lineEdit->hasFocus()); QVERIFY(textEdit->hasFocus()); @@ -474,7 +450,7 @@ void tst_QDataWidgetMapper::textEditDoesntChangeFocusOnTab_qtbug3305() QTRY_VERIFY(lineEdit->hasFocus()); QVERIFY(!textEdit->hasFocus()); ++closeEditorSpyCount; - QCOMPARE(closeEditorSpy.count(), closeEditorSpyCount); + QCOMPARE(closeEditorSpy.size(), closeEditorSpyCount); } QTEST_MAIN(tst_QDataWidgetMapper) |