From e22ab608d254c03d58f094e0f25d9e83c2f56be8 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 1 Apr 2016 13:58:39 +0200 Subject: Add an (initially empty) test for qscxmlc Change-Id: I68b78d2a186ea88d9aa5ff243d441b9890693a79 Reviewed-by: Erik Verbruggen --- tests/auto/auto.pro | 2 +- tests/auto/qscxmlc/data/empty.scxml | 1 + tests/auto/qscxmlc/qscxmlc.pro | 24 ++++++++++++++ tests/auto/qscxmlc/tst_qscxmlc.cpp | 65 +++++++++++++++++++++++++++++++++++++ tests/auto/qscxmlc/tst_qscxmlc.qrc | 5 +++ 5 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 tests/auto/qscxmlc/data/empty.scxml create mode 100644 tests/auto/qscxmlc/qscxmlc.pro create mode 100644 tests/auto/qscxmlc/tst_qscxmlc.cpp create mode 100644 tests/auto/qscxmlc/tst_qscxmlc.qrc (limited to 'tests') diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index b4876f0..2c2bcce 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,2 +1,2 @@ TEMPLATE = subdirs -SUBDIRS = cmake parser scion statemachine +SUBDIRS = cmake parser scion statemachine qscxmlc diff --git a/tests/auto/qscxmlc/data/empty.scxml b/tests/auto/qscxmlc/data/empty.scxml new file mode 100644 index 0000000..10c563b --- /dev/null +++ b/tests/auto/qscxmlc/data/empty.scxml @@ -0,0 +1 @@ + diff --git a/tests/auto/qscxmlc/qscxmlc.pro b/tests/auto/qscxmlc/qscxmlc.pro new file mode 100644 index 0000000..285ed87 --- /dev/null +++ b/tests/auto/qscxmlc/qscxmlc.pro @@ -0,0 +1,24 @@ +QT = core testlib scxml-private +CONFIG += testcase console c++11 +CONFIG -= app_bundle + +TARGET = tst_qscxmlc +TEMPLATE = app + +RESOURCES += tst_qscxmlc.qrc + +SOURCES += \ + $$PWD/tst_qscxmlc.cpp \ + $$PWD/../../../tools/qscxmlc/generator.cpp \ + $$PWD/../../../tools/qscxmlc/scxmlcppdumper.cpp + +HEADERS += \ + $$PWD/../../../tools/qscxmlc/qscxmlc.cpp \ # yes, that's a header. We want to #define scxmlcmain main + $$PWD/../../../tools/qscxmlc/moc.h \ + $$PWD/../../../tools/qscxmlc/generator.h \ + $$PWD/../../../tools/qscxmlc/outputrevision.h \ + $$PWD/../../../tools/qscxmlc/utils.h \ + $$PWD/../../../tools/qscxmlc/scxmlcppdumper.h + +INCLUDEPATH += ../../../tools/qscxmlc/ + diff --git a/tests/auto/qscxmlc/tst_qscxmlc.cpp b/tests/auto/qscxmlc/tst_qscxmlc.cpp new file mode 100644 index 0000000..a529144 --- /dev/null +++ b/tests/auto/qscxmlc/tst_qscxmlc.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtScxml module 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 +#include +#include + +#define main qscxmlcmain +#include "qscxmlc.cpp" +#undef main + +class tst_Qscxmlc: public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void parsing_data(); + void parsing(); +}; + +void tst_Qscxmlc::parsing_data() +{ + QTest::addColumn("scxmlFileName"); + QDir dir(QLatin1String(":/tst_qscxmlc/data/")); + foreach (const QString &entry, dir.entryList()) { + QTest::newRow(entry.toLatin1().constData()) << dir.filePath(entry); + } +} + +void tst_Qscxmlc::parsing() +{ + QFETCH(QString, scxmlFileName); + QVERIFY(run(QStringList() << QLatin1String("qcsxmlc") << scxmlFileName)); +} + +QTEST_MAIN(tst_Qscxmlc) + +#include "tst_qscxmlc.moc" + + diff --git a/tests/auto/qscxmlc/tst_qscxmlc.qrc b/tests/auto/qscxmlc/tst_qscxmlc.qrc new file mode 100644 index 0000000..df21b44 --- /dev/null +++ b/tests/auto/qscxmlc/tst_qscxmlc.qrc @@ -0,0 +1,5 @@ + + + data/empty.scxml + + -- cgit v1.2.3