summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp41
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result16
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp18
-rw-r--r--tests/auto/qmainwindow/tst_qmainwindow.cpp3
-rw-r--r--tests/auto/qsettings/tst_qsettings.cpp63
-rw-r--r--tests/auto/qurl/tst_qurl.cpp10
6 files changed, 140 insertions, 11 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
index f58f932..706e8d0 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
@@ -302,3 +302,44 @@ static inline QString message2()
}
}
+
+
+
+// QTBUG-11426: operator overloads
+class LotsaFun : public QObject
+{
+ Q_OBJECT
+public:
+ int operator<<(int left, int right);
+};
+
+int LotsaFun::operator<<(int left, int right)
+{
+ tr("this is inside operator<<");
+ return left << right;
+}
+
+
+
+// QTBUG-12683: define in re-opened namespace
+namespace NameSchpace {
+
+class YetMoreFun : public QObject
+{
+ Q_OBJECT
+public:
+ void funStuff();
+};
+
+}
+
+namespace NameSchpace {
+
+#define somevar 1
+
+void YetMoreFun::funStuff()
+{
+ tr("funStuff!");
+}
+
+}
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
index 7ac318e..f73fc64 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
@@ -141,6 +141,22 @@ backslashed \ stuff.</source>
</message>
</context>
<context>
+ <name>LotsaFun</name>
+ <message>
+ <location filename="main.cpp" line="318"/>
+ <source>this is inside operator&lt;&lt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>NameSchpace::YetMoreFun</name>
+ <message>
+ <location filename="main.cpp" line="342"/>
+ <source>funStuff!</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>Plurals, QCoreApplication</name>
<message numerus="yes">
<location filename="main.cpp" line="81"/>
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index bfa9406..93bd447 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -3747,15 +3747,15 @@ void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup()
void tst_QLineEdit::QTBUG13520_textNotVisible()
{
LineEdit le;
- le.setAlignment( Qt::AlignRight | Qt::AlignVCenter);
- le.show();
- QTest::qWaitForWindowShown(&le);
- le.setText("01-ST16-01SIL-MPL001wfgsdfgsdgsdfgsdfgsdfgsdfgsdfg");
- le.setCursorPosition(0);
- QTest::qWait(100); //just make sure we get he lineedit correcly painted
-
- QVERIFY(le.cursorRect().center().x() < le.width() / 2);
-
+ le.setAlignment( Qt::AlignRight | Qt::AlignVCenter);
+ le.show();
+ QTest::qWaitForWindowShown(&le);
+ le.setText("01-ST16-01SIL-MPL001wfgsdfgsdgsdfgsdfgsdfgsdfgsdfg");
+ le.setCursorPosition(0);
+ QTest::qWait(100); //just make sure we get he lineedit correcly painted
+
+ QVERIFY(le.cursorRect().center().x() < le.width() / 2);
+
}
diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp
index 1273e85..6f95672 100644
--- a/tests/auto/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp
@@ -1449,8 +1449,7 @@ Q_DECLARE_METATYPE(MoveList)
void MoveSeparator::apply(QMainWindow *mw) const
{
-
- QMainWindowLayout *l = qobject_cast<QMainWindowLayout*>(mw->layout());
+ QMainWindowLayout *l = qFindChild<QMainWindowLayout *>(mw->layout());
QVERIFY(l);
QList<int> path;
diff --git a/tests/auto/qsettings/tst_qsettings.cpp b/tests/auto/qsettings/tst_qsettings.cpp
index 058a750..0395eff 100644
--- a/tests/auto/qsettings/tst_qsettings.cpp
+++ b/tests/auto/qsettings/tst_qsettings.cpp
@@ -60,6 +60,10 @@
#include <io.h>
#endif
+#if defined(Q_OS_WIN)
+#include <QtCore/qt_windows.h>
+#endif
+
#ifndef QSETTINGS_P_H_VERSION
#define QSETTINGS_P_H_VERSION 1
#endif
@@ -127,6 +131,9 @@ private slots:
#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN)
void dontReorderIniKeysNeedlessly();
#endif
+#if defined(Q_OS_WIN)
+ void qtbug_13249();
+#endif
/*
These tests were developed for the Qt 3 QSettings class.
@@ -3801,6 +3808,62 @@ void tst_QSettings::setPathBug()
}
#endif
+#if defined(Q_OS_WIN)
+
+static DWORD readKeyType(HKEY handle, const QString &rSubKey)
+{
+ DWORD dataType;
+ DWORD dataSize;
+ LONG res = RegQueryValueEx(handle, reinterpret_cast<const wchar_t *>(rSubKey.utf16()), 0, &dataType, 0, &dataSize);
+
+ if (res == ERROR_SUCCESS)
+ return dataType;
+
+ return 0;
+}
+
+void tst_QSettings::qtbug_13249()
+{
+ QSettings settings1(QSettings::UserScope, "software.org", "KillerAPP");
+
+ qint32 x = 1024;
+ settings1.setValue("qtbug_13249_a", (qint32)x);
+ QCOMPARE(settings1.value("qtbug_13249_a").toInt(), (qint32)1024);
+ settings1.setValue("qtbug_13249_b", (quint32)x);
+ QCOMPARE(settings1.value("qtbug_13249_b").toUInt(), (quint32)1024);
+ settings1.setValue("qtbug_13249_c", (qint64)x);
+ QCOMPARE(settings1.value("qtbug_13249_c").toLongLong(), (qint64)1024);
+ settings1.setValue("qtbug_13249_d", (quint64)x);
+ QCOMPARE(settings1.value("qtbug_13249_d").toULongLong(), (quint64)1024);
+ settings1.sync();
+
+ HKEY handle;
+ LONG res;
+ QString keyName = "Software\\software.org\\KillerAPP";
+ res = RegOpenKeyEx(HKEY_CURRENT_USER, reinterpret_cast<const wchar_t *>(keyName.utf16()), 0, KEY_READ, &handle);
+ if (res == ERROR_SUCCESS)
+ {
+ DWORD dataType;
+ dataType = readKeyType(handle, QString("qtbug_13249_a"));
+ if (dataType != 0) {
+ QCOMPARE((int)REG_DWORD, (int)dataType);
+ }
+ dataType = readKeyType(handle, QString("qtbug_13249_b"));
+ if (dataType != 0) {
+ QCOMPARE((int)REG_DWORD, (int)dataType);
+ }
+ dataType = readKeyType(handle, QString("qtbug_13249_c"));
+ if (dataType != 0) {
+ QCOMPARE((int)REG_QWORD, (int)dataType);
+ }
+ dataType = readKeyType(handle, QString("qtbug_13249_d"));
+ if (dataType != 0) {
+ QCOMPARE((int)REG_QWORD, (int)dataType);
+ }
+ RegCloseKey(handle);
+ }
+}
+#endif
/*
// Not tested at the moment.
void tst_QSettings::oldSubkeyList()
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index b5236e5..63f9721 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -2478,16 +2478,26 @@ void tst_QUrl::isValid()
QUrl url = QUrl::fromEncoded("http://strange;hostname/here");
QVERIFY(!url.isValid());
QCOMPARE(url.path(), QString("/here"));
+ url.setAuthority("strange;hostname");
+ QVERIFY(!url.isValid());
url.setAuthority("foobar@bar");
QVERIFY(url.isValid());
+ url.setAuthority("strange;hostname");
+ QVERIFY(!url.isValid());
+ QVERIFY(url.errorString().contains("invalid hostname"));
}
{
QUrl url = QUrl::fromEncoded("foo://stuff;1/g");
QVERIFY(!url.isValid());
QCOMPARE(url.path(), QString("/g"));
+ url.setHost("stuff;1");
+ QVERIFY(!url.isValid());
url.setHost("stuff-1");
QVERIFY(url.isValid());
+ url.setHost("stuff;1");
+ QVERIFY(!url.isValid());
+ QVERIFY(url.errorString().contains("invalid hostname"));
}
}