summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-15 02:02:32 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-15 02:02:32 (GMT)
commit6ce4e6247fa6e438a34a498cd803a5542ff338b7 (patch)
tree6357c943951d56e35a6ee714d22cea88073c582d /tests/auto
parentaad7bc4085980edf9fd6736efe909dc5a74a9d27 (diff)
parent3e4d8596edd8061a81f641df4f09d018b73c81f0 (diff)
downloadQt-6ce4e6247fa6e438a34a498cd803a5542ff338b7.zip
Qt-6ce4e6247fa6e438a34a498cd803a5542ff338b7.tar.gz
Qt-6ce4e6247fa6e438a34a498cd803a5542ff338b7.tar.bz2
Merge branch 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into 4.7-integration
* 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: Provide overview for Symbian capabilities. Fix QNX screen initialization tst_qftp: Attempting to reproduce a crash QNAM HTTP: Do not pipeline with WebLogic servers Autotest: update path location on the test server Autotest: update location of fluke.gif on test server Make qsTr work in global scope Not possible to show selected text in virtual keyboard Fix typos, there is no QT_NO_SSL Export .flm files always if they are different Make qmake possible to build with mingw using qmake.pro QS60Style: Single Click UI support for SD 9.2 time-box
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qftp/tst_qftp.cpp26
-rw-r--r--tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp2
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp2
-rw-r--r--tests/auto/qscriptengine/qscriptengine.pro1
-rw-r--r--tests/auto/qscriptengine/qscriptengine.qrc5
-rw-r--r--tests/auto/qscriptengine/translatable.js7
-rw-r--r--tests/auto/qscriptengine/translations/translatable_la.qmbin0 -> 241 bytes
-rw-r--r--tests/auto/qscriptengine/translations/translatable_la.ts34
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp40
-rw-r--r--tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp2
-rw-r--r--tests/auto/qtcpsocket/tst_qtcpsocket.cpp2
11 files changed, 117 insertions, 4 deletions
diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp
index 638c810..2a42d6d 100644
--- a/tests/auto/qftp/tst_qftp.cpp
+++ b/tests/auto/qftp/tst_qftp.cpp
@@ -123,6 +123,8 @@ private slots:
void doneSignal();
void queueMoreCommandsInDoneSlot();
+ void qtbug7359Crash();
+
protected slots:
void stateChanged( int );
void listInfo( const QUrlInfo & );
@@ -2052,6 +2054,30 @@ void tst_QFtp::cdUpSlot(bool error)
}
}
+void tst_QFtp::qtbug7359Crash()
+{
+ QFtp ftp;
+ ftp.connectToHost("127.0.0.1");
+
+ QTime t;
+ int elapsed;
+
+ t.start();
+ while ((elapsed = t.elapsed()) < 200)
+ QCoreApplication::processEvents(QEventLoop::AllEvents, 200 - elapsed);
+
+ ftp.close();
+ t.restart();
+ while ((elapsed = t.elapsed()) < 1000)
+ QCoreApplication::processEvents(QEventLoop::AllEvents, 1000 - elapsed);
+
+ ftp.connectToHost("127.0.0.1");
+
+ t.restart();
+ while ((elapsed = t.elapsed()) < 2000)
+ QCoreApplication::processEvents(QEventLoop::AllEvents, 2000 - elapsed);
+}
+
QTEST_MAIN(tst_QFtp)
#include "tst_qftp.moc"
diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
index 3a3ea79..f86ba63 100644
--- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
+++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
@@ -641,7 +641,7 @@ void tst_QHttpSocketEngine::downloadBigFile()
QByteArray hostName = QtNetworkSettings::serverName().toLatin1();
QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState);
- QVERIFY(tmpSocket->write("GET /mediumfile HTTP/1.0\r\n") > 0);
+ QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0);
QVERIFY(tmpSocket->write("Host: ") > 0);
QVERIFY(tmpSocket->write(hostName.data()) > 0);
QVERIFY(tmpSocket->write("\r\n") > 0);
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index dd497b0..ff79c09 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -4113,7 +4113,7 @@ public slots:
}
}
void startOne() {
- QUrl url = "http://" + QtNetworkSettings::serverName() + "/gif/fluke.gif";
+ QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/fluke.gif";
QNetworkRequest request(url);
QNetworkReply *reply = manager.get(request);
reply->setParent(this);
diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro
index dd058a4..7d0f5d0 100644
--- a/tests/auto/qscriptengine/qscriptengine.pro
+++ b/tests/auto/qscriptengine/qscriptengine.pro
@@ -1,6 +1,7 @@
load(qttest_p4)
QT = core gui script
SOURCES += tst_qscriptengine.cpp
+RESOURCES += qscriptengine.qrc
wince* {
DEFINES += SRCDIR=\\\"./\\\"
diff --git a/tests/auto/qscriptengine/qscriptengine.qrc b/tests/auto/qscriptengine/qscriptengine.qrc
new file mode 100644
index 0000000..b87f985
--- /dev/null
+++ b/tests/auto/qscriptengine/qscriptengine.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>translations/translatable_la.qm</file>
+</qresource>
+</RCC>
diff --git a/tests/auto/qscriptengine/translatable.js b/tests/auto/qscriptengine/translatable.js
new file mode 100644
index 0000000..0c948e7
--- /dev/null
+++ b/tests/auto/qscriptengine/translatable.js
@@ -0,0 +1,7 @@
+qsTr("One");
+qsTranslate("FooContext", "Two");
+
+var greeting_strings = [
+ QT_TR_NOOP("Hello"),
+ QT_TRANSLATE_NOOP("FooContext", "Goodbye")
+];
diff --git a/tests/auto/qscriptengine/translations/translatable_la.qm b/tests/auto/qscriptengine/translations/translatable_la.qm
new file mode 100644
index 0000000..03fcc52
--- /dev/null
+++ b/tests/auto/qscriptengine/translations/translatable_la.qm
Binary files differ
diff --git a/tests/auto/qscriptengine/translations/translatable_la.ts b/tests/auto/qscriptengine/translations/translatable_la.ts
new file mode 100644
index 0000000..3f631de
--- /dev/null
+++ b/tests/auto/qscriptengine/translations/translatable_la.ts
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="nb_NO">
+<context>
+ <name>FooContext</name>
+ <message>
+ <location filename="translatable.js" line="2"/>
+ <source>Two</source>
+ <translation>To</translation>
+ </message>
+ <message>
+ <location filename="translatable.js" line="6"/>
+ <source>Goodbye</source>
+ <translation>Farvel</translation>
+ </message>
+</context>
+<context>
+ <name>translatable</name>
+ <message>
+ <location filename="translatable.js" line="1"/>
+ <source>One</source>
+ <translation>En</translation>
+ </message>
+ <message>
+ <location filename="translatable.js" line="5"/>
+ <source>Hello</source>
+ <translation>Hallo</translation>
+ </message>
+ <message>
+ <source>Goodbye</source>
+ <translation type="obsolete">Farvel</translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 25d8e3df..96043f9 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -155,6 +155,7 @@ private slots:
void incDecNonObjectProperty();
void installTranslatorFunctions_data();
void installTranslatorFunctions();
+ void translateScript();
void functionScopes();
void nativeFunctionScopes();
void evaluateProgram();
@@ -4335,6 +4336,45 @@ void tst_QScriptEngine::installTranslatorFunctions()
}
}
+void tst_QScriptEngine::translateScript()
+{
+ QScriptEngine engine;
+
+ QTranslator translator;
+ translator.load(":/translations/translatable_la");
+ QCoreApplication::instance()->installTranslator(&translator);
+ engine.installTranslatorFunctions();
+
+ QString fileName = QString::fromLatin1("translatable.js");
+ // Top-level
+ QCOMPARE(engine.evaluate("qsTr('One')", fileName).toString(), QString::fromLatin1("En"));
+ QCOMPARE(engine.evaluate("qsTr('Hello')", fileName).toString(), QString::fromLatin1("Hallo"));
+ // From function
+ QCOMPARE(engine.evaluate("(function() { return qsTr('One'); })()", fileName).toString(), QString::fromLatin1("En"));
+ QCOMPARE(engine.evaluate("(function() { return qsTr('Hello'); })()", fileName).toString(), QString::fromLatin1("Hallo"));
+ // From eval
+ QCOMPARE(engine.evaluate("eval('qsTr(\\'One\\')')", fileName).toString(), QString::fromLatin1("En"));
+ QCOMPARE(engine.evaluate("eval('qsTr(\\'Hello\\')')", fileName).toString(), QString::fromLatin1("Hallo"));
+
+ QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Two')", fileName).toString(), QString::fromLatin1("To"));
+ QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Goodbye')", fileName).toString(), QString::fromLatin1("Farvel"));
+ // From eval
+ QCOMPARE(engine.evaluate("eval('qsTranslate(\\'FooContext\\', \\'Two\\')')", fileName).toString(), QString::fromLatin1("To"));
+ QCOMPARE(engine.evaluate("eval('qsTranslate(\\'FooContext\\', \\'Goodbye\\')')", fileName).toString(), QString::fromLatin1("Farvel"));
+
+ // Don't exist in translation
+ QCOMPARE(engine.evaluate("qsTr('Three')", fileName).toString(), QString::fromLatin1("Three"));
+ QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'So long')", fileName).toString(), QString::fromLatin1("So long"));
+ QCOMPARE(engine.evaluate("qsTranslate('BarContext', 'Goodbye')", fileName).toString(), QString::fromLatin1("Goodbye"));
+
+ // From C++
+ // There is no context, but it shouldn't crash
+ QCOMPARE(engine.globalObject().property("qsTr").call(
+ QScriptValue(), QScriptValueList() << "One").toString(), QString::fromLatin1("One"));
+
+ QCoreApplication::instance()->removeTranslator(&translator);
+}
+
void tst_QScriptEngine::functionScopes()
{
QScriptEngine eng;
diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp
index a679765..8f0cbc3 100644
--- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp
+++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp
@@ -780,7 +780,7 @@ void tst_QSocks5SocketEngine::downloadBigFile()
QByteArray hostName = QtNetworkSettings::serverName().toLatin1();
QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState);
- QVERIFY(tmpSocket->write("GET /mediumfile HTTP/1.0\r\n") > 0);
+ QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0);
QVERIFY(tmpSocket->write("HOST: ") > 0);
QVERIFY(tmpSocket->write(hostName.data()) > 0);
QVERIFY(tmpSocket->write("\r\n") > 0);
diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
index 5a209c2..cd512a1 100644
--- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
@@ -1117,7 +1117,7 @@ void tst_QTcpSocket::downloadBigFile()
QByteArray hostName = QtNetworkSettings::serverName().toLatin1();
QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState);
- QVERIFY(tmpSocket->write("GET /mediumfile HTTP/1.0\r\n") > 0);
+ QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0);
QVERIFY(tmpSocket->write("HOST: ") > 0);
QVERIFY(tmpSocket->write(hostName.data()) > 0);
QVERIFY(tmpSocket->write("\r\n") > 0);