From e507b0148bc2c3159a88f670c826f6f5165606bd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 30 Jan 2015 20:39:32 +0100 Subject: add test for the qmake library the existing test is a blackbox test. this one is going to be different. the first test is a bit trivial ... Change-Id: Iba1b0b5c32490677551ee92c36f381b884c2765d Reviewed-by: Joerg Bornemann --- tests/auto/tools/qmakelib/.gitignore | 1 + tests/auto/tools/qmakelib/qmakelib.pro | 11 +++++ tests/auto/tools/qmakelib/tst_qmakelib.cpp | 72 ++++++++++++++++++++++++++++++ tests/auto/tools/tools.pro | 1 + 4 files changed, 85 insertions(+) create mode 100644 tests/auto/tools/qmakelib/.gitignore create mode 100644 tests/auto/tools/qmakelib/qmakelib.pro create mode 100644 tests/auto/tools/qmakelib/tst_qmakelib.cpp (limited to 'tests/auto') diff --git a/tests/auto/tools/qmakelib/.gitignore b/tests/auto/tools/qmakelib/.gitignore new file mode 100644 index 0000000000..5a0a2058a2 --- /dev/null +++ b/tests/auto/tools/qmakelib/.gitignore @@ -0,0 +1 @@ +tst_qmakelib diff --git a/tests/auto/tools/qmakelib/qmakelib.pro b/tests/auto/tools/qmakelib/qmakelib.pro new file mode 100644 index 0000000000..df13670438 --- /dev/null +++ b/tests/auto/tools/qmakelib/qmakelib.pro @@ -0,0 +1,11 @@ +CONFIG += testcase +CONFIG += parallel_test +TARGET = tst_qmakelib +QT = core testlib + +INCLUDEPATH += ../../../../qmake/library +VPATH += ../../../../qmake/library + +SOURCES += \ + tst_qmakelib.cpp \ + proitems.cpp diff --git a/tests/auto/tools/qmakelib/tst_qmakelib.cpp b/tests/auto/tools/qmakelib/tst_qmakelib.cpp new file mode 100644 index 0000000000..e7bfa8e814 --- /dev/null +++ b/tests/auto/tools/qmakelib/tst_qmakelib.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include + +#include + +class tst_qmakelib : public QObject +{ + Q_OBJECT + +public: + tst_qmakelib() {} + virtual ~tst_qmakelib() {} + +private slots: + void proStringList(); +}; + +void tst_qmakelib::proStringList() +{ + ProStringList sl1; + sl1 << ProString("qt") << ProString(QLatin1String("is")) + << ProString(QStringLiteral("uncool")).mid(2); + + QCOMPARE(sl1.toQStringList(), QStringList() << "qt" << "is" << "cool"); + QCOMPARE(sl1.join(QStringLiteral("~~")), QStringLiteral("qt~~is~~cool")); + + ProStringList sl2; + sl2 << ProString("mostly") << ProString("...") << ProString("is") << ProString("..."); + sl1.insertUnique(sl2); + QCOMPARE(sl1.toQStringList(), QStringList() << "qt" << "is" << "cool" << "mostly" << "..."); + + QVERIFY(sl1.contains("cool")); + QVERIFY(!sl1.contains("COOL")); + QVERIFY(sl1.contains("COOL", Qt::CaseInsensitive)); +} + +QTEST_MAIN(tst_qmakelib) +#include "tst_qmakelib.moc" diff --git a/tests/auto/tools/tools.pro b/tests/auto/tools/tools.pro index 5367e8b7ef..7e4dc67b09 100644 --- a/tests/auto/tools/tools.pro +++ b/tests/auto/tools/tools.pro @@ -1,5 +1,6 @@ TEMPLATE=subdirs SUBDIRS=\ + qmakelib \ qmake \ uic \ moc \ -- cgit v1.2.3