summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtranslator
diff options
context:
space:
mode:
authorHolger Ihrig <holger.ihrig@nokia.com>2011-08-25 12:16:22 +0200
committerHolger Ihrig <holger.ihrig@nokia.com>2011-09-01 12:42:14 +0200
commit3a7e6157d1a9865a31a5641605bbe9b0fc25e1d4 (patch)
tree0fbbaff4f42115383f08aef07baa58e841ba551a /tests/auto/qtranslator
parenta90f50942e5304e6bf1c8a3e32f1f65c7a38f60b (diff)
Moving relevant tests to corelib/kernel
Added Test for qmetaproperty Marked QSocketNotifier Autotest as insignificant. See QTBUG-21204 Marked qtranslator Autotest as insignificant. See QTBUG-21125 Marked corelib/io/qfile/largefile as insignificant. See QTBUG-21175 Task-number: QTBUG-21066 Change-Id: I2a7f6587845c355091bb07c8dd3d1557d16db0be Reviewed-on: http://codereview.qt.nokia.com/3598 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Diffstat (limited to 'tests/auto/qtranslator')
-rw-r--r--tests/auto/qtranslator/.gitignore1
-rw-r--r--tests/auto/qtranslator/hellotr_la.qmbin230 -> 0 bytes
-rw-r--r--tests/auto/qtranslator/hellotr_la.ts16
-rw-r--r--tests/auto/qtranslator/msgfmt_from_po.qmbin176988 -> 0 bytes
-rw-r--r--tests/auto/qtranslator/qtranslator.pro12
-rw-r--r--tests/auto/qtranslator/qtranslator.qrc5
-rw-r--r--tests/auto/qtranslator/tst_qtranslator.cpp260
7 files changed, 0 insertions, 294 deletions
diff --git a/tests/auto/qtranslator/.gitignore b/tests/auto/qtranslator/.gitignore
deleted file mode 100644
index ce24e1016b..0000000000
--- a/tests/auto/qtranslator/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tst_qtranslator
diff --git a/tests/auto/qtranslator/hellotr_la.qm b/tests/auto/qtranslator/hellotr_la.qm
deleted file mode 100644
index cc42afe05c..0000000000
--- a/tests/auto/qtranslator/hellotr_la.qm
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qtranslator/hellotr_la.ts b/tests/auto/qtranslator/hellotr_la.ts
deleted file mode 100644
index 2a4a41b9ea..0000000000
--- a/tests/auto/qtranslator/hellotr_la.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE TS><TS version="1.1" language="de">
-<context>
- <name>QPushButton</name>
- <message>
- <source>Hello world!</source>
- <translation>Hallo Welt!</translation>
- </message>
- <message numerus="yes">
- <source>Hello %n world(s)!</source>
- <translation>
- <numerusform>Hallo %n Welt!</numerusform>
- <numerusform>Hallo %n Welten!</numerusform>
- </translation>
- </message>
-</context>
-</TS>
diff --git a/tests/auto/qtranslator/msgfmt_from_po.qm b/tests/auto/qtranslator/msgfmt_from_po.qm
deleted file mode 100644
index 7b62819459..0000000000
--- a/tests/auto/qtranslator/msgfmt_from_po.qm
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qtranslator/qtranslator.pro b/tests/auto/qtranslator/qtranslator.pro
deleted file mode 100644
index c87af7b733..0000000000
--- a/tests/auto/qtranslator/qtranslator.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-load(qttest_p4)
-QT += widgets
-SOURCES += tst_qtranslator.cpp
-RESOURCES += qtranslator.qrc
-
-wince*|symbian: {
- addFiles.files = hellotr_la.qm msgfmt_from_po.qm
- addFiles.path = .
- DEPLOYMENT += addFiles
-}
-
-
diff --git a/tests/auto/qtranslator/qtranslator.qrc b/tests/auto/qtranslator/qtranslator.qrc
deleted file mode 100644
index 333dcfaa21..0000000000
--- a/tests/auto/qtranslator/qtranslator.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/tst_qtranslator">
- <file>hellotr_la.qm</file>
- </qresource>
-</RCC>
diff --git a/tests/auto/qtranslator/tst_qtranslator.cpp b/tests/auto/qtranslator/tst_qtranslator.cpp
deleted file mode 100644
index 8e2ed157a4..0000000000
--- a/tests/auto/qtranslator/tst_qtranslator.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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, Nokia gives you certain additional
-** rights. These rights are described in the Nokia 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-#include <QWidget>
-#include <qtranslator.h>
-#include <qfile.h>
-
-//TESTED_CLASS=
-//TESTED_FILES=
-
-class tst_QTranslator : public QWidget
-{
- Q_OBJECT
-
-public:
- tst_QTranslator();
- virtual ~tst_QTranslator();
-
-public slots:
- void init();
- void cleanup();
-
-protected:
- bool event(QEvent *event);
-
-private slots:
- void load();
- void load2();
- void threadLoad();
- void testLanguageChange();
- void plural();
- void translate_qm_file_generated_with_msgfmt();
- void loadFromResource();
- void loadDirectory();
-
-private:
- int languageChangeEventCounter;
-};
-
-
-tst_QTranslator::tst_QTranslator()
- : languageChangeEventCounter(0)
-{
- show();
- hide();
-}
-
-tst_QTranslator::~tst_QTranslator()
-{
-}
-
-void tst_QTranslator::init()
-{
-}
-
-void tst_QTranslator::cleanup()
-{
-}
-
-bool tst_QTranslator::event(QEvent *event)
-{
- if (event->type() == QEvent::LanguageChange)
- ++languageChangeEventCounter;
- return QWidget::event(event);
-}
-
-void tst_QTranslator::load()
-{
-
- QTranslator tor( 0 );
- tor.load("hellotr_la");
- QVERIFY(!tor.isEmpty());
- QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!"));
-}
-
-void tst_QTranslator::load2()
-{
- QTranslator tor( 0 );
- QFile file("hellotr_la.qm");
- file.open(QFile::ReadOnly);
- QByteArray data = file.readAll();
- tor.load((const uchar *)data.constData(), data.length());
- QVERIFY(!tor.isEmpty());
- QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!"));
-}
-
-class TranslatorThread : public QThread
-{
- void run() {
- QTranslator tor( 0 );
- tor.load("hellotr_la");
-
- if (tor.isEmpty())
- qFatal("Could not load translation");
- if (tor.translate("QPushButton", "Hello world!") != QString::fromLatin1("Hallo Welt!"))
- qFatal("Test string was not translated correctlys");
- }
-};
-
-
-void tst_QTranslator::threadLoad()
-{
- TranslatorThread thread;
- thread.start();
- QVERIFY(thread.wait(10 * 1000));
-}
-
-void tst_QTranslator::testLanguageChange()
-{
- languageChangeEventCounter = 0;
-
- QTranslator *tor = new QTranslator;
- tor->load("hellotr_la.qm");
- qApp->sendPostedEvents();
- qApp->sendPostedEvents();
- QCOMPARE(languageChangeEventCounter, 0);
-
- tor->load("doesn't exist, same as clearing");
- qApp->sendPostedEvents();
- qApp->sendPostedEvents();
- QCOMPARE(languageChangeEventCounter, 0);
-
- tor->load("hellotr_la.qm");
- qApp->sendPostedEvents();
- qApp->sendPostedEvents();
- QCOMPARE(languageChangeEventCounter, 0);
-
- qApp->installTranslator(tor);
- qApp->sendPostedEvents();
- qApp->sendPostedEvents();
- QCOMPARE(languageChangeEventCounter, 1);
-
- tor->load("doesn't exist, same as clearing");
- qApp->sendPostedEvents();
- qApp->sendPostedEvents();
- QCOMPARE(languageChangeEventCounter, 2);
-
- tor->load("hellotr_la.qm");
- qApp->sendPostedEvents();
- qApp->sendPostedEvents();
- QCOMPARE(languageChangeEventCounter, 3);
-
- qApp->removeTranslator(tor);
- qApp->sendPostedEvents();
- qApp->sendPostedEvents();
- QCOMPARE(languageChangeEventCounter, 4);
-
- tor->load("doesn't exist, same as clearing");
- qApp->sendPostedEvents();
- qApp->sendPostedEvents();
- QCOMPARE(languageChangeEventCounter, 4);
-
- qApp->installTranslator(tor);
- qApp->sendPostedEvents();
- qApp->sendPostedEvents();
- QCOMPARE(languageChangeEventCounter, 4);
-
- tor->load("hellotr_la.qm");
- qApp->sendPostedEvents();
- qApp->sendPostedEvents();
- QCOMPARE(languageChangeEventCounter, 5);
-
- delete tor;
- tor = 0;
- qApp->sendPostedEvents();
- qApp->sendPostedEvents();
- QCOMPARE(languageChangeEventCounter, 6);
-}
-
-
-void tst_QTranslator::plural()
-{
-
- QTranslator tor( 0 );
- tor.load("hellotr_la");
- QVERIFY(!tor.isEmpty());
- QCoreApplication::installTranslator(&tor);
- QCoreApplication::Encoding e = QCoreApplication::UnicodeUTF8;
- QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, e, 0), QString::fromLatin1("Hallo 0 Welten!"));
- QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, e, 1), QString::fromLatin1("Hallo 1 Welt!"));
- QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, e, 2), QString::fromLatin1("Hallo 2 Welten!"));
-}
-
-void tst_QTranslator::translate_qm_file_generated_with_msgfmt()
-{
- QTranslator translator;
- translator.load("msgfmt_from_po");
- qApp->installTranslator(&translator);
-
- QCOMPARE(QCoreApplication::translate("", "Intro"), QLatin1String("Einleitung"));
- // The file is converted from a po file, thus it does not have any context info.
- // The following should then not be translated
- QCOMPARE(QCoreApplication::translate("contekst", "Intro"), QLatin1String("Intro"));
- QCOMPARE(QCoreApplication::translate("contekst", "Intro\0\0"), QLatin1String("Intro"));
- QCOMPARE(QCoreApplication::translate("contekst", "Intro\0x"), QLatin1String("Intro"));
- QCOMPARE(QCoreApplication::translate("", "Intro\0\0"), QLatin1String("Einleitung"));
- QCOMPARE(QCoreApplication::translate("", "Intro\0x"), QLatin1String("Einleitung"));
-
- qApp->removeTranslator(&translator);
-}
-
-void tst_QTranslator::loadFromResource()
-{
- QTranslator tor;
- tor.load(":/tst_qtranslator/hellotr_la.qm");
- QVERIFY(!tor.isEmpty());
- QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!"));
-}
-
-void tst_QTranslator::loadDirectory()
-{
- QVERIFY(QFileInfo("../qtranslator").isDir());
-
- QTranslator tor;
- tor.load("qtranslator", "..");
- QVERIFY(tor.isEmpty());
-}
-
-QTEST_MAIN(tst_QTranslator)
-#include "tst_qtranslator.moc"