diff options
author | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2016-03-31 14:48:28 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-04-13 12:29:54 +0000 |
commit | 181928775bb5456c88e0528c639274bc7da259c2 (patch) | |
tree | 74c3995c2cd791e0745c182a51f74e9a9ae0a365 /tests | |
parent | 9968c72f7cac511235ab6aab2e948d29da4ff059 (diff) |
Validate IDs and event names, and handle them well in C++ generation.
Change-Id: I2e4e15496e7b2adc2f452745b1341f8fa0140b12
Task-number: QTBUG-51818
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/auto.pro | 2 | ||||
-rw-r--r-- | tests/auto/compiled/anonymousstate.scxml | 7 | ||||
-rw-r--r-- | tests/auto/compiled/compiled.pro | 21 | ||||
-rw-r--r-- | tests/auto/compiled/eventnames1.scxml | 46 | ||||
-rw-r--r-- | tests/auto/compiled/eventnames2.scxml | 44 | ||||
-rw-r--r-- | tests/auto/compiled/ids1.scxml | 42 | ||||
-rw-r--r-- | tests/auto/compiled/statemachineunicodename.scxml | 6 | ||||
-rw-r--r-- | tests/auto/compiled/submachineunicodename.scxml | 23 | ||||
-rw-r--r-- | tests/auto/compiled/tst_compiled.cpp | 88 | ||||
-rw-r--r-- | tests/auto/parser/eventnames.scxml | 55 | ||||
-rw-r--r-- | tests/auto/parser/ids1.scxml | 37 | ||||
-rw-r--r-- | tests/auto/parser/ids2.scxml | 38 | ||||
-rw-r--r-- | tests/auto/parser/namespaces1.scxml | 2 | ||||
-rw-r--r-- | tests/auto/parser/tst_parser.cpp | 22 | ||||
-rw-r--r-- | tests/auto/parser/tst_parser.qrc | 3 | ||||
-rw-r--r-- | tests/auto/qscxmlc/data/invalidstatemachinename.scxml | 6 | ||||
-rw-r--r-- | tests/auto/qscxmlc/tst_qscxmlc.qrc | 1 | ||||
-rw-r--r-- | tests/auto/statemachine/ids1.scxml | 36 | ||||
-rw-r--r-- | tests/auto/statemachine/tst_statemachine.cpp | 7 | ||||
-rw-r--r-- | tests/auto/statemachine/tst_statemachine.qrc | 1 |
20 files changed, 482 insertions, 5 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 2c2bcce..3b89fa0 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,2 +1,2 @@ TEMPLATE = subdirs -SUBDIRS = cmake parser scion statemachine qscxmlc +SUBDIRS = cmake parser scion statemachine qscxmlc compiled diff --git a/tests/auto/compiled/anonymousstate.scxml b/tests/auto/compiled/anonymousstate.scxml new file mode 100644 index 0000000..016b339 --- /dev/null +++ b/tests/auto/compiled/anonymousstate.scxml @@ -0,0 +1,7 @@ +<?xml version="1.0" ?> +<!-- enable-qt-mode: no --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + name="Pinball2" datamodel="ecmascript"> + <state> + </state> +</scxml> diff --git a/tests/auto/compiled/compiled.pro b/tests/auto/compiled/compiled.pro new file mode 100644 index 0000000..7dc62ba --- /dev/null +++ b/tests/auto/compiled/compiled.pro @@ -0,0 +1,21 @@ +QT = core gui qml testlib scxml +CONFIG += testcase + +TARGET = tst_compiled +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + +SOURCES += \ + tst_compiled.cpp + +STATECHARTS = \ + ids1.scxml \ + eventnames1.scxml \ + eventnames2.scxml \ + statemachineunicodename.scxml \ + anonymousstate.scxml \ + submachineunicodename.scxml + +load(qscxmlc) diff --git a/tests/auto/compiled/eventnames1.scxml b/tests/auto/compiled/eventnames1.scxml new file mode 100644 index 0000000..150f6c0 --- /dev/null +++ b/tests/auto/compiled/eventnames1.scxml @@ -0,0 +1,46 @@ +<?xml version="1.0" ?> +<!-- +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" name="eventnames1"> + <state id="a"> + <onentry> + <send event="valid"/> + <send event="still.valid"/> + <send event="-valid-"/> + <send event="ÿvalid"/> + </onentry> + + <transition event="valid"/> + <transition event="still.valid"/> + <transition event="-valid-"/> + <transition event="also valid"/> + <transition event="ÿvalid"/> + </state> +</scxml> diff --git a/tests/auto/compiled/eventnames2.scxml b/tests/auto/compiled/eventnames2.scxml new file mode 100644 index 0000000..32c80d5 --- /dev/null +++ b/tests/auto/compiled/eventnames2.scxml @@ -0,0 +1,44 @@ +<?xml version="1.0" ?> +<!-- +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +--> +<!-- enable-qt-mode: yes --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" name="eventnames2"> + <state id="a"> + <onentry> + <send event="valid"/> + <send event="still.valid"/> + <send event="-valid-"/> + </onentry> + + <transition event="valid"/> + <transition event="still.valid"/> + <transition event="also valid"/> + </state> +</scxml> diff --git a/tests/auto/compiled/ids1.scxml b/tests/auto/compiled/ids1.scxml new file mode 100644 index 0000000..4410678 --- /dev/null +++ b/tests/auto/compiled/ids1.scxml @@ -0,0 +1,42 @@ +<?xml version="1.0" ?> +<!-- +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" name="ids1"> + <!-- valid IDs: --> + <state id="foo.bar"/> + <state id="foo-bar"/> + <state id="foo_bar"/> + <state id="_"/> + <state id="näl"/> + <state id="n_0xe4_l"/> + <state id="_VALID"/> + <state id="__valid"/> + <state id="qÿ̀i"/> +</scxml> diff --git a/tests/auto/compiled/statemachineunicodename.scxml b/tests/auto/compiled/statemachineunicodename.scxml new file mode 100644 index 0000000..9bacbe8 --- /dev/null +++ b/tests/auto/compiled/statemachineunicodename.scxml @@ -0,0 +1,6 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initial="wrapper" name="CalculatorätateMachine"> + <state id="wrapper"> + </state> +</scxml> diff --git a/tests/auto/compiled/submachineunicodename.scxml b/tests/auto/compiled/submachineunicodename.scxml new file mode 100644 index 0000000..b62e751 --- /dev/null +++ b/tests/auto/compiled/submachineunicodename.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- enable-qt-mode: yes --> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + name="Directions1" + initial="anyplace" +> + <state id="anyplace"> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml name="änywhere" version="1.0"> + <state id="here"> + <transition event="goThere" target="there"/> + </state> + <state id="there"> + <transition event="goHere" target="here"/> + </state> + </scxml> + </content> + </invoke> + </state> +</scxml> diff --git a/tests/auto/compiled/tst_compiled.cpp b/tests/auto/compiled/tst_compiled.cpp new file mode 100644 index 0000000..9c4c1e4 --- /dev/null +++ b/tests/auto/compiled/tst_compiled.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** 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 <QtTest> +#include <QObject> +#include <QXmlStreamReader> +#include <QtScxml/qscxmlparser.h> +#include <QtScxml/qscxmlstatemachine.h> +#include "ids1.h" +#include "statemachineunicodename.h" + +Q_DECLARE_METATYPE(QScxmlError); + +enum { SpyWaitTime = 8000 }; + +class tst_Compiled: public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void stateNames(); +}; + +void tst_Compiled::stateNames() +{ + ids1 stateMachine; + + QStringList ids1States({ + "_", + "_VALID", + "__valid", + "foo-bar", + "foo.bar", + "foo_bar", + "n_0xe4_l", + "näl", + "qÿ̀i", + }); + + QCOMPARE(stateMachine.stateNames(false), ids1States); + + foreach (const QString &state, ids1States) { + QVariant prop = stateMachine.property(state.toUtf8().constData()); + QVERIFY(!prop.isNull()); + QVERIFY(prop.isValid()); + QCOMPARE(prop.toBool(), false); + } + + QVariant invalidProp = stateMachine.property("blabla"); + QVERIFY(invalidProp.isNull()); + QVERIFY(!invalidProp.isValid()); + + QStringList calculatorStates(QLatin1String("wrapper")); + + Calculator_0xe4_tateMachine stateMachine3; + QCOMPARE(stateMachine3.stateNames(false), calculatorStates); +} + +QTEST_MAIN(tst_Compiled) + +#include "tst_compiled.moc" + + diff --git a/tests/auto/parser/eventnames.scxml b/tests/auto/parser/eventnames.scxml new file mode 100644 index 0000000..d5e4ff7 --- /dev/null +++ b/tests/auto/parser/eventnames.scxml @@ -0,0 +1,55 @@ +<?xml version="1.0" ?> +<!-- +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" name="eventnames"> + <state id="a"> + <onentry> + <send event="valid"/> + <send event="still.valid"/> + <send event="still-valid"/> + <send event="still:valid"/> + <send event="-valid-"/> + <send event=".invalid"/> + <send event="invalid."/> + <send event="in valid"/> + <send event="ÿvalid"/> + </onentry> + + <transition event="valid"/> + <transition event="still.valid"/> + <transition event="still-valid"/> + <transition event="still:valid"/> + <transition event="-valid-"/> + <transition event=".invalid"/> + <transition event="invalid."/> + <transition event="also valid"/> + <transition event="ÿvalid"/> + </state> +</scxml> diff --git a/tests/auto/parser/ids1.scxml b/tests/auto/parser/ids1.scxml new file mode 100644 index 0000000..7e8bd15 --- /dev/null +++ b/tests/auto/parser/ids1.scxml @@ -0,0 +1,37 @@ +<?xml version="1.0" ?> +<!-- +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" name="ids1"> + <state id="foo.bar"/> + <state id="foo-bar"/> + <state id="foo_bar"/> + <state id="mooze_1"/> + <state id="_"/> +</scxml> diff --git a/tests/auto/parser/ids2.scxml b/tests/auto/parser/ids2.scxml new file mode 100644 index 0000000..228b487 --- /dev/null +++ b/tests/auto/parser/ids2.scxml @@ -0,0 +1,38 @@ +<?xml version="1.0" ?> +<!-- +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +--> +<!-- enable-qt-mode: yes --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" name="ids2"> + <state id="foo.bar"/> + <state id="foo-bar"/> + <state id="foo_bar"/> + <state id="1"/> + <state id="_"/> +</scxml> diff --git a/tests/auto/parser/namespaces1.scxml b/tests/auto/parser/namespaces1.scxml index c691302..551c130 100644 --- a/tests/auto/parser/namespaces1.scxml +++ b/tests/auto/parser/namespaces1.scxml @@ -33,7 +33,7 @@ <qt:editorinfo initialGeometry="135;83;-20;-20;40;40"/> <state id="State_1"> <qt:editorinfo geometry="134;218;-60;-50;122;100" scenegeometry="134;218;74;168;122;100"/> - <transition type="external" event="Transition_2" target="State_2"> + <transition type="external" event="Transition-2" target="State_2"> <qt:editorinfo movePoint="-26;0"/> </transition> </state> diff --git a/tests/auto/parser/tst_parser.cpp b/tests/auto/parser/tst_parser.cpp index 9fc24a7..68ca9db 100644 --- a/tests/auto/parser/tst_parser.cpp +++ b/tests/auto/parser/tst_parser.cpp @@ -49,10 +49,28 @@ void tst_Parser::error_data() QTest::addColumn<QVector<QScxmlError> >("expectedErrors"); QVector<QScxmlError> errors; - errors << QScxmlError(QString(":/tst_parser/test1.scxml"), 34, 46, QString("unknown state 'b' in target")); + errors << QScxmlError(QString(":/tst_parser/test1.scxml"), 34, 46, + QString("unknown state 'b' in target")); QTest::newRow("test1") << QString(":/tst_parser/test1.scxml") << errors; - QTest::newRow("namespaces 1") << QStringLiteral(":/tst_parser/namespaces1.scxml") << QVector<QScxmlError>(); + QTest::newRow("namespaces 1") << QStringLiteral(":/tst_parser/namespaces1.scxml") + << QVector<QScxmlError>(); + QTest::newRow("IDs 1") << QStringLiteral(":/tst_parser/ids1.scxml") << QVector<QScxmlError>(); + QTest::newRow("IDs 2") << QStringLiteral(":/tst_parser/ids2.scxml") << (QVector<QScxmlError>() + << QScxmlError(":/tst_parser/ids2.scxml", 33, 25, + "state id 'foo.bar' is not a valid C++ identifier in Qt mode") + << QScxmlError(":/tst_parser/ids2.scxml", 34, 25, + "state id 'foo-bar' is not a valid C++ identifier in Qt mode") + << QScxmlError(":/tst_parser/ids2.scxml", 36, 19, "'1' is not a valid XML ID") + ); + QTest::newRow("eventnames") << QStringLiteral(":/tst_parser/eventnames.scxml") + << (QVector<QScxmlError>() + << QScxmlError(":/tst_parser/eventnames.scxml", 50, 38, "'.invalid' is not a valid event") + << QScxmlError(":/tst_parser/eventnames.scxml", 51, 38, "'invalid.' is not a valid event") + << QScxmlError(":/tst_parser/eventnames.scxml", 39, 36, "'.invalid' is not a valid event") + << QScxmlError(":/tst_parser/eventnames.scxml", 40, 36, "'invalid.' is not a valid event") + << QScxmlError(":/tst_parser/eventnames.scxml", 41, 36, "'in valid' is not a valid event") + ); } void tst_Parser::error() diff --git a/tests/auto/parser/tst_parser.qrc b/tests/auto/parser/tst_parser.qrc index d7c6124..3c6c944 100644 --- a/tests/auto/parser/tst_parser.qrc +++ b/tests/auto/parser/tst_parser.qrc @@ -2,5 +2,8 @@ <qresource prefix="/tst_parser"> <file>test1.scxml</file> <file>namespaces1.scxml</file> + <file>ids1.scxml</file> + <file>ids2.scxml</file> + <file>eventnames.scxml</file> </qresource> </RCC> diff --git a/tests/auto/qscxmlc/data/invalidstatemachinename.scxml b/tests/auto/qscxmlc/data/invalidstatemachinename.scxml new file mode 100644 index 0000000..e47a699 --- /dev/null +++ b/tests/auto/qscxmlc/data/invalidstatemachinename.scxml @@ -0,0 +1,6 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initial="wrapper" name="CalculatortateMachine"> + <state id="wrapper"> + </state> +</scxml> diff --git a/tests/auto/qscxmlc/tst_qscxmlc.qrc b/tests/auto/qscxmlc/tst_qscxmlc.qrc index 69a14f0..85911ca 100644 --- a/tests/auto/qscxmlc/tst_qscxmlc.qrc +++ b/tests/auto/qscxmlc/tst_qscxmlc.qrc @@ -35,5 +35,6 @@ <file>data/id000031sig11src000004opflip1pos12612.scxml</file> <file>data/id000032sig11src000004opflip1pos12831.scxml</file> <file>data/id000033sig06src000004opflip4pos10704.scxml</file> + <file>data/invalidstatemachinename.scxml</file> </qresource> </RCC> diff --git a/tests/auto/statemachine/ids1.scxml b/tests/auto/statemachine/ids1.scxml new file mode 100644 index 0000000..bcf00d6 --- /dev/null +++ b/tests/auto/statemachine/ids1.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" ?> +<!-- +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" name="ids1"> + <state id="foo.bar"/> + <state id="foo-bar"/> + <state id="foo_bar"/> + <state id="_"/> +</scxml> diff --git a/tests/auto/statemachine/tst_statemachine.cpp b/tests/auto/statemachine/tst_statemachine.cpp index fccfd25..14628d3 100644 --- a/tests/auto/statemachine/tst_statemachine.cpp +++ b/tests/auto/statemachine/tst_statemachine.cpp @@ -67,6 +67,11 @@ void tst_StateMachine::stateNames_data() QTest::newRow("stateNamesNested-notCompressed") << QString(":/tst_statemachine/statenamesnested.scxml") << false << (QStringList() << QString("a") << QString("b") << QString("super_top")); + + QTest::newRow("ids1") << QString(":/tst_statemachine/ids1.scxml") + << false + << (QStringList() << QString("_") << QString("foo-bar") + << QString("foo.bar") << QString("foo_bar")); } void tst_StateMachine::stateNames() @@ -77,7 +82,7 @@ void tst_StateMachine::stateNames() QScopedPointer<QScxmlStateMachine> stateMachine(QScxmlStateMachine::fromFile(scxmlFileName)); QVERIFY(!stateMachine.isNull()); - QVERIFY(!stateMachine->parseErrors().count()); + QCOMPARE(stateMachine->parseErrors().count(), 0); QCOMPARE(stateMachine->stateNames(compressed), expectedStates); } diff --git a/tests/auto/statemachine/tst_statemachine.qrc b/tests/auto/statemachine/tst_statemachine.qrc index 8a006d7..59c39af 100644 --- a/tests/auto/statemachine/tst_statemachine.qrc +++ b/tests/auto/statemachine/tst_statemachine.qrc @@ -3,5 +3,6 @@ <file>eventoccurred.scxml</file> <file>statenames.scxml</file> <file>statenamesnested.scxml</file> + <file>ids1.scxml</file> </qresource> </RCC> |