diff options
Diffstat (limited to 'tests/auto/quick/qquickscreen')
-rw-r--r-- | tests/auto/quick/qquickscreen/CMakeLists.txt | 26 | ||||
-rw-r--r-- | tests/auto/quick/qquickscreen/tst_qquickscreen.cpp | 44 |
2 files changed, 34 insertions, 36 deletions
diff --git a/tests/auto/quick/qquickscreen/CMakeLists.txt b/tests/auto/quick/qquickscreen/CMakeLists.txt index 65c5538be3..0b269c736c 100644 --- a/tests/auto/quick/qquickscreen/CMakeLists.txt +++ b/tests/auto/quick/qquickscreen/CMakeLists.txt @@ -1,21 +1,35 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from qquickscreen.pro. ##################################################################### ## tst_qquickscreen Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qquickscreen LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + +# Collect test data +file(GLOB_RECURSE test_data_glob + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + data/*) +list(APPEND test_data ${test_data_glob}) + qt_internal_add_test(tst_qquickscreen SOURCES - ../../shared/util.cpp ../../shared/util.h tst_qquickscreen.cpp - INCLUDE_DIRECTORIES - ../../shared - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::Gui Qt::GuiPrivate Qt::QmlPrivate Qt::QuickPrivate + Qt::QuickTestUtilsPrivate + TESTDATA ${test_data} ) ## Scopes: @@ -23,10 +37,10 @@ qt_internal_add_test(tst_qquickscreen qt_internal_extend_target(tst_qquickscreen CONDITION ANDROID OR IOS DEFINES - QT_QMLTEST_DATADIR=\\\":/data\\\" + QT_QMLTEST_DATADIR=":/data" ) qt_internal_extend_target(tst_qquickscreen CONDITION NOT ANDROID AND NOT IOS DEFINES - QT_QMLTEST_DATADIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\" + QT_QMLTEST_DATADIR="${CMAKE_CURRENT_SOURCE_DIR}/data" ) diff --git a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp index ff6031619c..74d50eed22 100644 --- a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp +++ b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp @@ -1,49 +1,33 @@ -/**************************************************************************** -** -** 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.h> #include <QDebug> #include <QQmlEngine> +#include <QQmlComponent> #include <QtQuick/QQuickItem> #include <QtQuick/QQuickView> #include <QtGui/QScreen> -#include "../../shared/util.h" +#include <QtQuickTestUtils/private/qmlutils_p.h> #include <QtQuick/private/qquickscreen_p.h> #include <QDebug> class tst_qquickscreen : public QQmlDataTest { Q_OBJECT +public: + tst_qquickscreen(); + private slots: void basicProperties(); void screenOnStartup(); void fullScreenList(); }; +tst_qquickscreen::tst_qquickscreen() + : QQmlDataTest(QT_QMLTEST_DATADIR) +{ +} + void tst_qquickscreen::basicProperties() { QQuickView view; @@ -66,7 +50,7 @@ void tst_qquickscreen::basicProperties() QCOMPARE(screen->geometry().x(), root->property("vx").toInt()); QCOMPARE(screen->geometry().y(), root->property("vy").toInt()); - QVERIFY(root->property("screenCount").toInt() == QGuiApplication::screens().count()); + QVERIFY(root->property("screenCount").toInt() == QGuiApplication::screens().size()); } void tst_qquickscreen::screenOnStartup() @@ -105,7 +89,7 @@ void tst_qquickscreen::fullScreenList() QVERIFY(screensArray.isArray()); int length = screensArray.property("length").toInt(); const QList<QScreen *> screenList = QGuiApplication::screens(); - QVERIFY(length == screenList.count()); + QVERIFY(length == screenList.size()); for (int i = 0; i < length; ++i) { QQuickScreenInfo *info = qobject_cast<QQuickScreenInfo *>(screensArray.property(i).toQObject()); |