From: Oswald Buddenhagen Date: Mon, 19 Aug 2013 10:17:09 +0000 (+0200) Subject: prune unused obsolete tests X-Git-Tag: accepted/tizen/20131212.181521~83^2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e6fa41c075814a20c935544c786b1920c2e12ee;p=platform%2Fupstream%2Fqttools.git prune unused obsolete tests the code has been absorbed into the proper autotest a long time ago. Task-number: QTBUG-26510 Change-Id: I199b26331645cea51e91cf9f8be15c3d4628aa7b Reviewed-by: hjk Reviewed-by: Oswald Buddenhagen --- diff --git a/src/linguist/tests/data/main.cpp b/src/linguist/tests/data/main.cpp deleted file mode 100644 index 331a0c6..0000000 --- a/src/linguist/tests/data/main.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the test suite 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - QStringList args = app.arguments(); - - if (argc <= 1) { - qDebug() << "Usage: " << qPrintable(args[0]) << " "; - return 1; - } - - QTranslator trans; - trans.load(args[1], "."); - app.installTranslator(&trans); - - QWidget w; - QVBoxLayout *layout = new QVBoxLayout(&w); - - QLabel label1(QObject::tr("XXXXXXXXX \33 XXXXXXXXXXX • and → "), 0); - QLabel label2(QObject::tr("\32"), 0); - QLabel label3(QObject::tr("\176"), 0); - QLabel label4(QObject::tr("\301"), 0); - - layout->addWidget(&label1); - layout->addWidget(&label2); - layout->addWidget(&label3); - layout->addWidget(&label4); - - w.show(); - - return app.exec(); -} diff --git a/src/linguist/tests/data/test.pro b/src/linguist/tests/data/test.pro deleted file mode 100644 index 412390f..0000000 --- a/src/linguist/tests/data/test.pro +++ /dev/null @@ -1,4 +0,0 @@ -SOURCES += main.cpp - -TRANSLATIONS += t1_en.ts -TRANSLATIONS += t1_de.ts diff --git a/src/linguist/tests/tests.pro b/src/linguist/tests/tests.pro deleted file mode 100644 index dc878bb..0000000 --- a/src/linguist/tests/tests.pro +++ /dev/null @@ -1,17 +0,0 @@ -TARGET = tst_tests -CONFIG += testcase - -QT += xml testlib - -HEADERS += \ - tst_linguist.h \ - ../shared/translator.h - -SOURCES += \ - tst_linguist.cpp \ - tst_lupdate.cpp \ - tst_simtexth.cpp \ - ../shared/simtexth.cpp \ - ../shared/translator.cpp \ - ../shared/translatormessage.cpp \ - ../shared/xliff.cpp diff --git a/src/linguist/tests/tst_linguist.cpp b/src/linguist/tests/tst_linguist.cpp deleted file mode 100644 index 0c9f210..0000000 --- a/src/linguist/tests/tst_linguist.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the test suite 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tst_linguist.h" -#include "moc_tst_linguist.cpp" - -QTEST_MAIN(tst_linguist) diff --git a/src/linguist/tests/tst_linguist.h b/src/linguist/tests/tst_linguist.h deleted file mode 100644 index 060cd88..0000000 --- a/src/linguist/tests/tst_linguist.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the test suite 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TST_LINGUIST -#define TST_LINGUIST - -#include -#include - -class tst_linguist : public QObject -{ - Q_OBJECT -private slots: - void fetchtr(); - void fetchtr_data(); - - void simtexth(); - void simtexth_data(); -}; - -#endif diff --git a/src/linguist/tests/tst_lupdate.cpp b/src/linguist/tests/tst_lupdate.cpp deleted file mode 100644 index de7cf70..0000000 --- a/src/linguist/tests/tst_lupdate.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the test suite 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include "tst_linguist.h" - -void tst_linguist::fetchtr() -{ - // FIXME: This probably should use some yet-to-be-invented - // binary interface to 'lupdate' instead of playing around - // with the filesystem, - - QRegExp reg("\\s*"); - QString lupdate("lupdate"); - - QFETCH(QString, input); - - QFETCH(QString, name); - QFETCH(QString, file); - QFETCH(QString, line); - QFETCH(QString, src); - - QString result; - - QTemporaryFile profile("tst_lu_XXXXXX.pro"); - QTemporaryFile cppfile("tst_lu_XXXXXX.cpp"); - QTemporaryFile tsfile("tst_lu_XXXXXX.ts"); - - profile.open(); - cppfile.open(); - tsfile.open(); - -#if 0 - profile.setAutoRemove(false); - cppfile.setAutoRemove(false); - tsfile.setAutoRemove(false); - - qDebug() << ".pro: " << profile.fileName(); - qDebug() << ".cpp: " << cppfile.fileName(); - qDebug() << ".ts: " << tsfile.fileName(); -#endif - - QTextStream prots(&profile); - prots << "SOURCES += " << cppfile.fileName() << "\n"; - prots << "TRANSLATIONS += " << tsfile.fileName() << "\n"; - prots.flush(); - - QTextStream cppts(&cppfile); - cppts.setCodec("ISO 8859-1"); - cppts << input << '\n'; - cppts.flush(); - - QProcess proc; - proc.start(lupdate, QStringList() << profile.fileName()); - proc.waitForFinished(); - - result = tsfile.readAll(); - - static QRegExp re( - "(.+)\\s*" - "\\s*" // there might be a numerus="yes" attribiute - "\\s*" - "(.+)\\s*" - ".*\\s*" - ); - - re.indexIn(result); - QString resname = re.cap(1); - //QString resfile = re.cap(2); - QString resline = re.cap(3); - QString ressrc = re.cap(4); - - //qDebug() << "pattern:" << re.pattern(); - //qDebug() << "result:" << result; - //qDebug() << "resname:" << resname; - ////qDebug() << "resfile:" << resfile; - //qDebug() << "resline:" << resline; - //qDebug() << "ressource:" << ressrc; - - QCOMPARE(src + ": " + resname, src + ": " + name); - QCOMPARE(src + ": " + resline, src + ": " + line); - QCOMPARE(src + ": " + ressrc, src + ": " + src); -} - -void tst_linguist::fetchtr_data() -{ - using namespace QTest; - - addColumn("input"); - addColumn("name"); - addColumn("file"); - addColumn("line"); - addColumn("src"); - - // plain stuff - newRow("00") << "int main() { tr(\"foo\"); }" - << "@default" << "XXXXXX" << "1" << "foo"; - - // space at beginning of text - newRow("01") << "int main() { tr(\" foo\"); }" - << "@default" << "XXXXXX" << "1" << " foo"; - // space at end of text - newRow("02") << "int main() { tr(\"foo \"); }" - << "@default" << "XXXXXX" << "1" << "foo "; - // space in the middle of the text - newRow("03") << "int main() { tr(\"foo bar\"); }" - << "@default" << "XXXXXX" << "1" << "foo bar"; - - // tab at beginning of text - newRow("04") << "int main() { tr(\"\tfoo\"); }" - << "@default" << "XXXXXX" << "1" << "foo"; - // tab at end of text - newRow("05") << "int main() { tr(\"foo\t\"); }" - << "@default" << "XXXXXX" << "1" << "foo"; - // tab in the middle of the text - newRow("06") << "int main() { tr(\"foo\tbar\"); }" - << "@default" << "XXXXXX" << "1" << "foobar"; - - // check for unicode - newRow("07") << "int main() { tr(\"\32\"); }" // 26 dec - << "@default" << "XXXXXX" << "1" << ""; - // check for unicode - newRow("08") << "int main() { tr(\"\33\"); }" // 27 dec - << "@default" << "XXXXXX" << "1" << ""; - // check for unicode - newRow("09") << "int main() { tr(\"\176\"); }" // 124 dec - << "@default" << "XXXXXX" << "1" << "~"; - // check for unicode - newRow("10") << "int main() { tr(\"\301\"); }" // 193 dec - << "@default" << "XXXXXX" << "1" << "Á"; - - // Bug 162562: lupdate does not find QCoreApplication::translate() strings - newRow("11") << "int main() { QString s = QCoreApplication::translate" - "(\"mycontext\", \"msg\", \"\", QCoreApplication::CodecForTr, 2);" - << "mycontext" << "XXXXXX" << "1" << "msg"; - - // Bug 161504: lupdate produces wrong ts file with context "N::QObject" - newRow("12") << "namespace N { QString foo() " - "{ return QObject::tr(\"msg\"); }" - << "QObject" << "XXXXXX" << "1" << "msg"; - - // Correct example from 161504: - newRow("13") << "namespace N { QString foo(); }" - "QString N::anyfunc() { return QObject::tr(\"msg\"); }" - << "QObject" << "XXXXXX" << "1" << "msg"; - - // Bug 161106: When specifying ::QObject::tr() then lupdate will - // take the previous word as being the namespace - newRow("14") << " std::cout << ::QObject::tr(\"msg\");" - << "QObject" << "XXXXXX" << "1" << "msg"; - -} diff --git a/src/linguist/tests/tst_simtexth.cpp b/src/linguist/tests/tst_simtexth.cpp deleted file mode 100644 index 3ab3199..0000000 --- a/src/linguist/tests/tst_simtexth.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the test suite 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -//int getSimilarityScore(const QString &str1, const char* str2); -#include "../shared/simtexth.h" -#include "tst_linguist.h" - -void tst_linguist::simtexth() -{ - QFETCH(QString, one); - QFETCH(QString, two); - QFETCH(int, expected); - - int measured = getSimilarityScore(one, two.toLatin1()); - QCOMPARE(measured, expected); -} - - -void tst_linguist::simtexth_data() -{ - using namespace QTest; - - addColumn("one"); - addColumn("two"); - addColumn("expected"); - - newRow("00") << "" << "" << 1024; - newRow("01") << "a" << "a" << 1024; - newRow("02") << "ab" << "ab" << 1024; - newRow("03") << "abc" << "abc" << 1024; - newRow("04") << "abcd" << "abcd" << 1024; -}