aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmldom/errormessage
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qmldom/errormessage')
-rw-r--r--tests/auto/qmldom/errormessage/CMakeLists.txt14
-rw-r--r--tests/auto/qmldom/errormessage/tst_qmldomerrormessage.cpp87
-rw-r--r--tests/auto/qmldom/errormessage/tst_qmldomerrormessage.h20
3 files changed, 56 insertions, 65 deletions
diff --git a/tests/auto/qmldom/errormessage/CMakeLists.txt b/tests/auto/qmldom/errormessage/CMakeLists.txt
index 4a8f5043b9..7c82876827 100644
--- a/tests/auto/qmldom/errormessage/CMakeLists.txt
+++ b/tests/auto/qmldom/errormessage/CMakeLists.txt
@@ -1,15 +1,23 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from errormessage.pro.
#####################################################################
## tst_qmldomerrormessage Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qmldomerrormessage LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qmldomerrormessage
SOURCES
- tst_qmldomerrormessage.cpp
+ tst_qmldomerrormessage.cpp tst_qmldomerrormessage.h
DEFINES
QT_DEPRECATED_WARNINGS
- PUBLIC_LIBRARIES
- Qt::QmlDevToolsPrivate
+ LIBRARIES
Qt::QmlDomPrivate
)
diff --git a/tests/auto/qmldom/errormessage/tst_qmldomerrormessage.cpp b/tests/auto/qmldom/errormessage/tst_qmldomerrormessage.cpp
index e36278771d..2c2007c119 100644
--- a/tests/auto/qmldom/errormessage/tst_qmldomerrormessage.cpp
+++ b/tests/auto/qmldom/errormessage/tst_qmldomerrormessage.cpp
@@ -1,40 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "tst_qmldomerrormessage.h"
#include <QtQmlDom/private/qqmldomerrormessage_p.h>
#include <QtTest/QtTest>
@@ -62,35 +29,31 @@ void registerMyError() {
static auto myError1 = ErrorMessage::msg("my.company.error1", myErrors().warning(u"Error number 1"));
static auto myError2 = ErrorMessage::msg("my.company.error2", myErrors().error(u"Error number 2 on %1"));
-class TestErrorMessage: public QObject
+void TestErrorMessage::testError()
{
- Q_OBJECT
-private slots:
- void testError()
- {
- registerMyError();
- auto err0 = ErrorMessage::load(myError0);
- QCOMPARE(err0.errorId, QLatin1String(myError0));
- QCOMPARE(err0.message, dumperToString(u"Error number 0"));
- QCOMPARE(err0.level, ErrorLevel::Warning);
- auto err1 = ErrorMessage::load(QLatin1String("my.company.error1"));
- QCOMPARE(err1.errorId, myError1);
- QCOMPARE(err1.message, dumperToString(u"Error number 1"));
- QCOMPARE(err1.level, ErrorLevel::Warning);
- auto err1bis = ErrorMessage::load("my.company.error1");
- QCOMPARE(err1bis.errorId, myError1);
- QCOMPARE(err1bis.message, dumperToString(u"Error number 1"));
- QCOMPARE(err1bis.level, ErrorLevel::Warning);
- auto err2 = ErrorMessage::load(myError2, QLatin1String("extra info"));
- QCOMPARE(err2.errorId, myError2);
- QCOMPARE(err2.message, dumperToString(u"Error number 2 on extra info"));
- QCOMPARE(err2.level, ErrorLevel::Error);
- }
-};
+ registerMyError();
+ auto err0 = ErrorMessage::load(myError0);
+ QCOMPARE(err0.errorId, QLatin1String(myError0));
+ QCOMPARE(err0.message, dumperToString(u"Error number 0"));
+ QCOMPARE(err0.level, ErrorLevel::Warning);
+ auto err1 = ErrorMessage::load(QLatin1String("my.company.error1"));
+ QCOMPARE(err1.errorId, myError1);
+ QCOMPARE(err1.message, dumperToString(u"Error number 1"));
+ QCOMPARE(err1.level, ErrorLevel::Warning);
+ auto err1bis = ErrorMessage::load("my.company.error1");
+ QCOMPARE(err1bis.errorId, myError1);
+ QCOMPARE(err1bis.message, dumperToString(u"Error number 1"));
+ QCOMPARE(err1bis.level, ErrorLevel::Warning);
+ auto err2 = ErrorMessage::load(myError2, QLatin1String("extra info"));
+ QCOMPARE(err2.errorId, myError2);
+ QCOMPARE(err2.message, dumperToString(u"Error number 2 on extra info"));
+ QCOMPARE(err2.level, ErrorLevel::Error);
+}
}
}
QT_END_NAMESPACE
+#ifndef NO_QTEST_MAIN
QTEST_MAIN(QQmlJS::Dom::TestErrorMessage)
-#include "tst_qmldomerrormessage.moc"
+#endif
diff --git a/tests/auto/qmldom/errormessage/tst_qmldomerrormessage.h b/tests/auto/qmldom/errormessage/tst_qmldomerrormessage.h
new file mode 100644
index 0000000000..31628ef52d
--- /dev/null
+++ b/tests/auto/qmldom/errormessage/tst_qmldomerrormessage.h
@@ -0,0 +1,20 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtQmlDom/qqmldom_global.h>
+#include <QtTest/QtTest>
+
+QT_BEGIN_NAMESPACE
+namespace QQmlJS {
+namespace Dom {
+
+class QMLDOM_EXPORT TestErrorMessage: public QObject
+{
+ Q_OBJECT
+private slots:
+ void testError();
+};
+
+} // Dom
+} // QQmlJS
+QT_END_NAMESPACE