summaryrefslogtreecommitdiffstats
path: root/generic/tclTestObj.c
Commit message (Expand)AuthorAgeFilesLines
* more internal use of size_t (in stead of int)jan.nijtmans2016-11-291-1/+1
* Fix libtommath's mp_radix_size() function such that it returns 2 for single-d...jan.nijtmans2016-11-171-2/+47
|\
| * Fix libtommath's mp_radix_size() function such that it returns 2 for single-d...jan.nijtmans2016-11-171-2/+47
| |\
| | * Fix libtommath's mp_radix_size() function such that it returns 2 for single-d...jan.nijtmans2016-11-171-2/+47
* | | Use the new private flag INDEX_TEMP_TABLE in testing command too.dgp2016-07-201-16/+2
|/ /
* | Use same internal representation for unicode strings in test-cases than in re...jan.nijtmans2016-07-011-8/+2
* | merge core-8-5-branchjan.nijtmans2013-01-311-4/+4
|\ \ | |/
| * Use twoPtrValue.ptr1 in stead of otherValuePtr everywhere. This is exactly th...jan.nijtmans2013-01-311-4/+4
* | test case for bug-3598580: Tcl_ListObjReplace may release deleted elements to...jan.nijtmans2013-01-031-0/+11
|\ \ | |/
| * test case for bug-3598580: Tcl_ListObjReplace may release deleted elements to...jan.nijtmans2013-01-031-0/+11
| |\
| | * test case for bug-3598580: Tcl_ListObjReplace may release deleted elements to...jan.nijtmans2013-01-031-0/+11
* | | [Bug 3386721] Allow multiple [load]ing of the Tcltest packageferrieux2011-08-101-62/+104
* | | TclFreeIntRep() related cleanup.dgp2011-04-251-2/+1
* | | Reduce the number of casts used to manage Tcl_Obj internal representations.dkf2011-03-261-6/+4
* | | Adjust ckalloc/ckfree macros to greatly reduce number of explicit casts indkf2011-03-121-2/+2
* | | Now that we're no longer using SCM based on RCS, the RCS Keyword linesdgp2011-03-021-2/+0
|\ \ \ | |/ /
| * | Now that we're no longer using SCM based on RCS, the RCS Keyword lines causedgp2011-03-021-2/+0
| |\ \ | | |/
| | * Now that we're no longer using SCM based on RCS, the RCS Keyword lines causedgp2011-03-011-2/+0
| | * * generic/tclStringObj.c: Added protections from invalid memorydgp2009-03-301-2/+65
| * | constification backport to silence warningdgp2010-03-191-3/+3
| * | * generic/tclListObj.c: Prevent in overflow trouble in [lreplace]dgp2010-03-181-1/+101
| * | * generic/tclStringObj.c: Added protections from invalid memorydgp2009-03-301-2/+66
* | | * generic/tclListObj.c: Prevent in overflow trouble in [lreplace]dgp2010-03-181-1/+101
* | | [ tcl-Feature Requests-2958832 ] Furthernijtmans2010-02-251-8/+8
* | | Test-case for fixed [Bug 2849797]nijtmans2009-11-191-2/+1
* | | Fix [Bug 2883850]: pkgIndex.tcl doesn'tnijtmans2009-11-181-2/+5
* | | * generic/tclTestObj.c: Replace the [teststringobj ualloc] testingdgp2009-02-161-5/+5
* | | * generic/tclStringObj.c: Added protections from invalid memorydgp2009-02-161-2/+66
* | | * generic/tclTestObj.c: Revise updates to [teststringobj] so we don'tdgp2009-02-141-7/+5
* | | * generic/tclStringObj.c: Simplified Tcl_GetCharLength bydgp2009-02-121-1/+7
* | | * generic/tclStringObj.c: Changed type of the 'allocated' fielddgp2009-02-111-2/+2
* | | - eliminate some unnessary type castsnijtmans2009-02-101-10/+10
* | | Style fixes (unfouling whitespace, sorting comments, removing useless casts, ...dkf2009-01-091-117/+117
* | | Eliminate warning: unused variablenijtmans2008-11-261-3/+1
* | | Eliminate 3 calls to Tcl_SetResult, asnijtmans2008-11-251-3/+2
* | | Add "const" to many internalnijtmans2008-10-161-4/+4
* | | * doc/Object.3 CONSTified 3 functions usingnijtmans2008-07-271-2/+2
* | | fix [2021443] inconsistant "wrong # args" messagesnijtmans2008-07-191-2/+2
* | | Get rid of pre-C89-isms (esp. CONST vs const).dkf2008-04-271-5/+5
|/ /
* | merge stable branch onto HEADdgp2007-12-131-1/+1
* | * generic/tclBasic.c: Removed dead code, including thedgp2007-06-281-66/+1
* | Replaced commas in varargs with string concatenation where possible [Patch 15...Kevin B Kenny2007-04-201-2/+2
* | Complete the purge of K&R function definitions from manually-written code.dkf2007-04-161-55/+55
* | various "const" additions in implementationnijtmans2007-03-071-22/+22
* | ANSIfy the test code (well, strip some of the worst offences!)dkf2005-11-021-130/+121
* | TIP#237 IMPLEMENTATIONdgp2005-10-081-1/+7
* | Add missing return TCL_ERRORdkf2005-06-071-111/+103
* | Merged kennykb-numerics-branch back to the head; TIPs 132 and 232Kevin B Kenny2005-05-101-1/+171
|/
* filesystem cleanup fix, virtual filesystem load fixvincentdarley2002-12-041-2/+9
* Further changes to the TIP 72 patch to make it compile under VC++Kevin B Kenny2002-02-151-2/+3
const QStringList &actual, const QString &expectedFn);
+
+ QString binDir;
};
void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedFn)
@@ -111,7 +118,7 @@ void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedF
void tst_lrelease::translate()
{
- QVERIFY(!QProcess::execute("lrelease testdata/translate.ts"));
+ QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/translate.ts"));
QTranslator translator;
QVERIFY(translator.load("testdata/translate.qm"));
@@ -161,8 +168,8 @@ void tst_lrelease::translate()
void tst_lrelease::mixedcodecs()
{
- QVERIFY(!QProcess::execute("lrelease testdata/mixedcodecs-ts11.ts"));
- QVERIFY(!QProcess::execute("lrelease testdata/mixedcodecs-ts20.ts"));
+ QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/mixedcodecs-ts11.ts"));
+ QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/mixedcodecs-ts20.ts"));
QVERIFY(!QProcess::execute("cmp testdata/mixedcodecs-ts11.qm testdata/mixedcodecs-ts20.qm"));
QTranslator translator;
QVERIFY(translator.load("testdata/mixedcodecs-ts11.qm"));
@@ -176,7 +183,7 @@ void tst_lrelease::mixedcodecs()
void tst_lrelease::compressed()
{
- QVERIFY(!QProcess::execute("lrelease -compress testdata/compressed.ts"));
+ QVERIFY(!QProcess::execute(binDir + "/lrelease -compress testdata/compressed.ts"));
QTranslator translator;
QVERIFY(translator.load("testdata/compressed.qm"));
@@ -191,10 +198,22 @@ void tst_lrelease::compressed()
}
+void tst_lrelease::idbased()
+{
+ QVERIFY(!QProcess::execute("lrelease -idbased testdata/idbased.ts"));
+
+ QTranslator translator;
+ QVERIFY(translator.load("testdata/idbased.qm"));
+ qApp->installTranslator(&translator);
+
+ QCOMPARE(qtTrId("test_id"), QString::fromAscii("This is a test string."));
+ QCOMPARE(qtTrId("untranslated_id"), QString::fromAscii("This has no translation."));
+}
+
void tst_lrelease::dupes()
{
QProcess proc;
- proc.start("lrelease testdata/dupes.ts");
+ proc.start(binDir + "/lrelease testdata/dupes.ts");
QVERIFY(proc.waitForFinished());
QVERIFY(proc.exitStatus() == QProcess::NormalExit);
doCompare(QString(proc.readAllStandardError()).trimmed().remove('\r').split('\n'), "testdata/dupes.errors");
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before
index e297784..076520a 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before
+++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before
@@ -5,7 +5,7 @@
<message>
<location filename="project.ui" line="27"/>
<source>Qt Assistant - Find text</source>
- <!--should be changed to unfinished, since we are changing the sourcetext in the ui file-->
+ <!--should be changed to unfinished, since we are changing the sourcetext in the UI file-->
<translation>Qt Assistant - Finn tekst</translation>
</message>
<message>
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result
index d65110a..6bc565c 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result
@@ -9,7 +9,7 @@
</message>
<message>
<location filename="project.ui" line="20"/>
- <source>This should not be considered to be more or less equal to the corresponding one in the ts file.</source>
+ <source>This should not be considered to be more or less equal to the corresponding one in the TS file.</source>
<translation type="unfinished"></translation>
</message>
<message>
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui
index 0d0defd..a5f8e9f 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui
+++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui
@@ -17,7 +17,7 @@
<widget class="QWidget" name="FindDialog" >
<property name="test1">
<!-- If the sourcetext is not similar to the vernacular sourcetext, mark the old one as obsolete and the new one as unfinished -->
- <string>This should not be considered to be more or less equal to the corresponding one in the ts file.</string>
+ <string>This should not be considered to be more or less equal to the corresponding one in the TS file.</string>
</property>
<property name="test2">
<string>Here, similarity should kick in!</string>
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
index 9fb43fe..735e4cd 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
@@ -175,3 +175,15 @@ class TestingTake17 : QObject {
tr("even more cool");
}
};
+
+
+
+
+//: again an extra comment, this time for id-based NOOP
+//% "This is supposed\tto be quoted \" newline\n"
+//% "backslashed \\ stuff."
+QT_TRID_NOOP("this_a_id")
+
+//~ some thing
+//% "This needs to be here. Really."
+QString test = qtTrId("this_another_id", n);
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 5bd7525..97d3bce 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
@@ -2,6 +2,24 @@
<!DOCTYPE TS>
<TS version="2.0">
<context>
+ <name></name>
+ <message id="this_a_id">
+ <location filename="main.cpp" line="185"/>
+ <source>This is supposed to be quoted &quot; newline
+backslashed \ stuff.</source>
+ <extracomment>again an extra comment, this time for id-based NOOP</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message id="this_another_id" numerus="yes">
+ <location filename="main.cpp" line="189"/>
+ <source>This needs to be here. Really.</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ <extra-some>thing</extra-some>
+ </message>
+</context>
+<context>
<name>Dialog2</name>
<message numerus="yes">
<location filename="main.cpp" line="29"/>
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp
new file mode 100644
index 0000000..ad87e70
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp
@@ -0,0 +1,9 @@
+// IMPORTANT!!!! If you want to add testdata to this file,
+// always add it to the end in order to not change the linenumbers of translations!!!
+
+
+void func1() {
+ QApplication::tr("Hello world", "top-level wildcard");
+}
+
+
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp
new file mode 100644
index 0000000..912963d
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp
@@ -0,0 +1,9 @@
+// IMPORTANT!!!! If you want to add testdata to this file,
+// always add it to the end in order to not change the linenumbers of translations!!!
+
+
+void func1() {
+ QApplication::tr("Hello world", "top-level direct");
+}
+
+
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro
new file mode 100644
index 0000000..820b4fa
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro
@@ -0,0 +1,10 @@
+SOURCES += file*.cpp filter.cpp non-existing.cpp
+
+include(sub/sub.pri)
+
+TRANSLATIONS = project.ts
+
+exists( $$TRANSLATIONS ) {
+ win32: system(del $$TRANSLATIONS)
+ unix: system(rm -f $$TRANSLATIONS)
+}
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result
new file mode 100644
index 0000000..470d6eb
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name>QApplication</name>
+ <message>
+ <location filename="file1.cpp" line="6"/>
+ <source>Hello world</source>
+ <comment>top-level wildcard</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="filter.cpp" line="6"/>
+ <source>Hello world</source>
+ <comment>top-level direct</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sub/subfile1.cpp" line="6"/>
+ <source>Hello world</source>
+ <comment>nested wildcard</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sub/subfilter.cpp" line="6"/>
+ <source>Hello world</source>
+ <comment>nested direct</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri
new file mode 100644
index 0000000..a6079f9
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri
@@ -0,0 +1,3 @@
+VPATH += $$PWD
+
+SOURCES += sub/subfile?.cpp subfilter.cpp
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp
new file mode 100644
index 0000000..807d296
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp
@@ -0,0 +1,9 @@
+// IMPORTANT!!!! If you want to add testdata to this file,
+// always add it to the end in order to not change the linenumbers of translations!!!
+
+
+void func1() {
+ QApplication::tr("Hello world", "nested wildcard");
+}
+
+
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp
new file mode 100644
index 0000000..6e5dd25
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp
@@ -0,0 +1,9 @@
+// IMPORTANT!!!! If you want to add testdata to this file,
+// always add it to the end in order to not change the linenumbers of translations!!!
+
+
+void func1() {
+ QApplication::tr("Hello world", "nested direct");
+}
+
+
diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result
index d65110a..6bc565c 100644
--- a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result
@@ -9,7 +9,7 @@
</message>
<message>
<location filename="project.ui" line="20"/>
- <source>This should not be considered to be more or less equal to the corresponding one in the ts file.</source>
+ <source>This should not be considered to be more or less equal to the corresponding one in the TS file.</source>
<translation type="unfinished"></translation>
</message>
<message>
diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui
index 0d0defd..a5f8e9f 100644
--- a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui
+++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui
@@ -17,7 +17,7 @@
<widget class="QWidget" name="FindDialog" >
<property name="test1">
<!-- If the sourcetext is not similar to the vernacular sourcetext, mark the old one as obsolete and the new one as unfinished -->
- <string>This should not be considered to be more or less equal to the corresponding one in the ts file.</string>
+ <string>This should not be considered to be more or less equal to the corresponding one in the TS file.</string>
</property>
<property name="test2">
<string>Here, similarity should kick in!</string>
diff --git a/tests/auto/linguist/lupdate/testlupdate.cpp b/tests/auto/linguist/lupdate/testlupdate.cpp
index 8abc2b0..04c03f1 100644
--- a/tests/auto/linguist/lupdate/testlupdate.cpp
+++ b/tests/auto/linguist/lupdate/testlupdate.cpp
@@ -56,8 +56,9 @@
TestLUpdate::TestLUpdate()
{
childProc = 0;
- m_cmdLupdate = QLatin1String("lupdate");
- m_cmdQMake = QLatin1String("qmake");
+ QString binPath = QLibraryInfo::location(QLibraryInfo::BinariesPath);
+ m_cmdLupdate = binPath + QLatin1String("/lupdate");
+ m_cmdQMake = binPath + QLatin1String("/qmake");
}
TestLUpdate::~TestLUpdate()
diff --git a/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
index 7facf4a..d799c1b 100644
--- a/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
+++ b/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
@@ -172,22 +172,22 @@ private slots:
private:
static void setMatrix(QMatrix2x2& m, const qreal *values);
- static void setMatrixFixed(QMatrix2x2& m, const qreal *values);
+ static void setMatrixDirect(QMatrix2x2& m, const qreal *values);
static bool isSame(const QMatrix2x2& m, const qreal *values);
static bool isIdentity(const QMatrix2x2& m);
static void setMatrix(QMatrix3x3& m, const qreal *values);
- static void setMatrixFixed(QMatrix3x3& m, const qreal *values);
+ static void setMatrixDirect(QMatrix3x3& m, const qreal *values);
static bool isSame(const QMatrix3x3& m, const qreal *values);
static bool isIdentity(const QMatrix3x3& m);
static void setMatrix(QMatrix4x4& m, const qreal *values);
- static void setMatrixFixed(QMatrix4x4& m, const qreal *values);
+ static void setMatrixDirect(QMatrix4x4& m, const qreal *values);
static bool isSame(const QMatrix4x4& m, const qreal *values);
static bool isIdentity(const QMatrix4x4& m);
static void setMatrix(QMatrix4x3& m, const qreal *values);
- static void setMatrixFixed(QMatrix4x3& m, const qreal *values);
+ static void setMatrixDirect(QMatrix4x3& m, const qreal *values);
static bool isSame(const QMatrix4x3& m, const qreal *values);
static bool isIdentity(const QMatrix4x3& m);
};
@@ -321,8 +321,9 @@ void tst_QMatrix::setMatrix(QMatrix4x3& m, const qreal *values)
}
// Set a matrix to a specified array of values, which are assumed
-// to be in row-major order. This sets the values using fixed-point.
-void tst_QMatrix::setMatrixFixed(QMatrix2x2& m, const qreal *values)
+// to be in row-major order. This sets the values directly into
+// the internal data() array.
+void tst_QMatrix::setMatrixDirect(QMatrix2x2& m, const qreal *values)
{
float *data = m.data();
for (int row = 0; row < 2; ++row) {
@@ -331,7 +332,7 @@ void tst_QMatrix::setMatrixFixed(QMatrix2x2& m, const qreal *values)
}
}
}
-void tst_QMatrix::setMatrixFixed(QMatrix3x3& m, const qreal *values)
+void tst_QMatrix::setMatrixDirect(QMatrix3x3& m, const qreal *values)
{
float *data = m.data();
for (int row = 0; row < 3; ++row) {
@@ -340,7 +341,7 @@ void tst_QMatrix::setMatrixFixed(QMatrix3x3& m, const qreal *values)
}
}
}
-void tst_QMatrix::setMatrixFixed(QMatrix4x4& m, const qreal *values)
+void tst_QMatrix::setMatrixDirect(QMatrix4x4& m, const qreal *values)
{
float *data = m.data();
for (int row = 0; row < 4; ++row) {
@@ -349,7 +350,7 @@ void tst_QMatrix::setMatrixFixed(QMatrix4x4& m, const qreal *values)
}
}
}
-void tst_QMatrix::setMatrixFixed(QMatrix4x3& m, const qreal *values)
+void tst_QMatrix::setMatrixDirect(QMatrix4x3& m, const qreal *values)
{
float *data = m.data();
for (int row = 0; row < 3; ++row) {
@@ -359,8 +360,8 @@ void tst_QMatrix::setMatrixFixed(QMatrix4x3& m, const qreal *values)
}
}
-// qFuzzyCompare isn't quite "fuzzy" enough to handle conversion
-// to fixed-point and back again. So create "fuzzier" compares.
+// qFuzzyCompare isn't always "fuzzy" enough to handle conversion
+// between float, double, and qreal. So create "fuzzier" compares.
static bool fuzzyCompare(float x, float y, qreal epsilon = 0.001)
{
float diff = x - y;
@@ -511,7 +512,7 @@ void tst_QMatrix::create2x2()
QVERIFY(!m2.isIdentity());
QMatrix2x2 m3;
- setMatrixFixed(m3, uniqueValues2);
+ setMatrixDirect(m3, uniqueValues2);
QVERIFY(isSame(m3, uniqueValues2));
QMatrix2x2 m4(m3);
@@ -546,7 +547,7 @@ void tst_QMatrix::create3x3()
QVERIFY(!m2.isIdentity());
QMatrix3x3 m3;
- setMatrixFixed(m3, uniqueValues3);
+ setMatrixDirect(m3, uniqueValues3);
QVERIFY(isSame(m3, uniqueValues3));
QMatrix3x3 m4(m3);
@@ -581,7 +582,7 @@ void tst_QMatrix::create4x4()
QVERIFY(!m2.isIdentity());
QMatrix4x4 m3;
- setMatrixFixed(m3, uniqueValues4);
+ setMatrixDirect(m3, uniqueValues4);
QVERIFY(isSame(m3, uniqueValues4));
QMatrix4x4 m4(m3);
@@ -623,7 +624,7 @@ void tst_QMatrix::create4x3()
QVERIFY(!m2.isIdentity());
QMatrix4x3 m3;
- setMatrixFixed(m3, uniqueValues4x3);
+ setMatrixDirect(m3, uniqueValues4x3);
QVERIFY(isSame(m3, uniqueValues4x3));
QMatrix4x3 m4(m3);
@@ -2961,10 +2962,6 @@ void tst_QMatrix::extractTranslation()
QVERIFY(fuzzyCompare(vec.y(), y, epsilon));
QVERIFY(fuzzyCompare(vec.z(), z, epsilon));
- // Have to be careful with numbers here, it is really easy to blow away
- // the precision of a fixed pointer number, especially when doing distance
- // formula for vector normalization
-
QMatrix4x4 lookAt;
QVector3D eye(1.5f, -2.5f, 2.5f);
lookAt.lookAt(eye,
diff --git a/tests/auto/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/math3d/qquaternion/tst_qquaternion.cpp
index 395032f..16b87a1 100644
--- a/tests/auto/math3d/qquaternion/tst_qquaternion.cpp
+++ b/tests/auto/math3d/qquaternion/tst_qquaternion.cpp
@@ -95,8 +95,8 @@ private slots:
void nlerp();
};
-// qFuzzyCompare isn't quite "fuzzy" enough to handle conversion
-// to fixed-point and back again. So create "fuzzier" compares.
+// qFuzzyCompare isn't always "fuzzy" enough to handle conversion
+// between float, double, and qreal. So create "fuzzier" compares.
static bool fuzzyCompare(float x, float y)
{
float diff = x - y;
diff --git a/tests/auto/math3d/qvectornd/tst_qvectornd.cpp b/tests/auto/math3d/qvectornd/tst_qvectornd.cpp
index 0eb5b07..9c1ea83 100644
--- a/tests/auto/math3d/qvectornd/tst_qvectornd.cpp
+++ b/tests/auto/math3d/qvectornd/tst_qvectornd.cpp
@@ -139,8 +139,8 @@ private slots:
void dotProduct4();
};
-// qFuzzyCompare isn't quite "fuzzy" enough to handle conversion
-// to fixed-point and back again. So create "fuzzier" compares.
+// qFuzzyCompare isn't always "fuzzy" enough to handle conversion
+// between float, double, and qreal. So create "fuzzier" compares.
static bool fuzzyCompare(float x, float y)
{
float diff = x - y;
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
index fa786f1..e4b1a55 100644
--- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
+++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
@@ -157,11 +157,9 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db )
}
if (tst_Databases::isMSAccess(db)) {
- QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision") + " (col1 number)"));
- } else if (db.driverName().startsWith("QIBASE")) {
- QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision") + " (col1 numeric(15, 14))"));
+ QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision") + " (col1 number)"));
} else {
- QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision") + " (col1 numeric(15, 14))"));
+ QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision") + " (col1 numeric(15, 14))"));
}
}
@@ -557,7 +555,7 @@ void tst_Q3SqlCursor::unicode()
void tst_Q3SqlCursor::precision()
{
- static const QString precStr = "1.23456789012345";
+ static const QString precStr = QLatin1String("1.23456789012345");
static const double precDbl = 2.23456789012345;
QFETCH( QString, dbName );
@@ -576,7 +574,7 @@ void tst_Q3SqlCursor::precision()
QVERIFY_SQL(cur, select());
QVERIFY( cur.next() );
- QCOMPARE( cur.value( 0 ).asString(), QString( precStr ) );
+ QCOMPARE( cur.value( 0 ).asString(), precStr );
QVERIFY( cur.next() );
QCOMPARE( cur.value( 0 ).asDouble(), precDbl );
}
@@ -760,9 +758,10 @@ void tst_Q3SqlCursor::insertFieldNameContainsWS() {
QSqlQuery q(db);
tst_Databases::safeDropTable(db, tableName);
- QString query = QString("CREATE TABLE %1 (id int, \"first Name\" varchar(20), "
- "lastName varchar(20))").arg(tableName);
- QVERIFY_SQL(q, exec(query));
+ QString query = "CREATE TABLE %1 (id int, "
+ + db.driver()->escapeIdentifier("first Name", QSqlDriver::FieldName)
+ + " varchar(20), lastName varchar(20))";
+ QVERIFY_SQL(q, exec(query.arg(tableName)));
Q3SqlCursor cur(tableName, true, db);
cur.select();
diff --git a/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp
index e976c1b..556e850 100644
--- a/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp
+++ b/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp
@@ -66,6 +66,7 @@ private slots:
void setScrollBars();
void setScrollBars2();
void objectNaming();
+ void patternBackground();
void viewportCrash();
void task214488_layoutDirection_data();
@@ -350,5 +351,39 @@ void tst_QAbstractScrollArea::task214488_layoutDirection()
QVERIFY(lessThan ? (hbar->value() < refValue) : (hbar->value() > refValue));
}
+void tst_QAbstractScrollArea::patternBackground()
+{
+ QScrollArea scrollArea;
+ scrollArea.resize(200, 200);
+ QWidget widget;
+ widget.resize(600, 600);
+ scrollArea.setWidget(&widget);
+ scrollArea.show();
+
+ QLinearGradient linearGrad(QPointF(250, 250), QPointF(300, 300));
+ linearGrad.setColorAt(0, Qt::yellow);
+ linearGrad.setColorAt(1, Qt::red);
+ QBrush bg(linearGrad);
+ scrollArea.viewport()->setPalette(QPalette(Qt::black, bg, bg, bg, bg, bg, bg, bg, bg));
+ widget.setPalette(Qt::transparent);
+
+ QTest::qWait(50);
+
+ QImage image(200, 200, QImage::Format_ARGB32);
+ scrollArea.render(&image);
+
+ QCOMPARE(image.pixel(QPoint(20,20)) , QColor(Qt::yellow).rgb());
+
+ QScrollBar *hbar = scrollArea.horizontalScrollBar();
+ hbar->setValue(hbar->maximum());
+ QScrollBar *vbar = scrollArea.verticalScrollBar();
+ vbar->setValue(vbar->maximum());
+
+ QTest::qWait(50);
+
+ scrollArea.render(&image);
+ QCOMPARE(image.pixel(QPoint(20,20)) , QColor(Qt::red).rgb());
+}
+
QTEST_MAIN(tst_QAbstractScrollArea)
#include "tst_qabstractscrollarea.moc"
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index 8a88b59..b8aec50 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -2623,6 +2623,13 @@ void tst_QAccessibility::spinBoxTest()
QVERIFY(childRect.isNull() == false);
}
+ spinBox->setFocus();
+ QTestAccessibility::clearEvents();
+ QTest::keyPress(spinBox, Qt::Key_Up);
+ QTest::qWait(200);
+ EventList events = QTestAccessibility::events();
+ QTestAccessibilityEvent expectedEvent(spinBox, 0, (int)QAccessible::ValueChanged);
+ QVERIFY(events.contains(expectedEvent));
delete spinBox;
QTestAccessibility::clearEvents();
#else
diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp
index 85494af..8532723 100644
--- a/tests/auto/qapplication/tst_qapplication.cpp
+++ b/tests/auto/qapplication/tst_qapplication.cpp
@@ -1820,27 +1820,38 @@ void tst_QApplication::touchEventPropagation()
{
int argc = 1;
QApplication app(argc, &argv0, QApplication::GuiServer);
- QTouchEvent::TouchPoint touchPoint(0);
- QTouchEvent touchEvent(QEvent::TouchBegin, Qt::NoModifier, QList<QTouchEvent::TouchPoint *>() << (&touchPoint));
+
+ QList<QTouchEvent::TouchPoint> pressedTouchPoints;
+ QTouchEvent::TouchPoint press(0);
+ press.setState(Qt::TouchPointPressed);
+ pressedTouchPoints << press;
+
+ QList<QTouchEvent::TouchPoint> releasedTouchPoints;
+ QTouchEvent::TouchPoint release(0);
+ release.setState(Qt::TouchPointReleased);
+ releasedTouchPoints << release;
{
// touch event behavior on a window
TouchEventPropagationTestWidget window;
window.setObjectName("1. window");
- QApplicationPrivate::sendTouchEvent(&window, &touchEvent);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints);
QVERIFY(!window.seenTouchEvent);
- QVERIFY(window.seenMouseEvent);
+ QVERIFY(!window.seenMouseEvent);
window.reset();
- window.setAttribute(Qt::WA_AcceptsTouchEvents);
- QApplicationPrivate::sendTouchEvent(&window, &touchEvent);
+ window.setAttribute(Qt::WA_AcceptTouchEvents);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints);
QVERIFY(window.seenTouchEvent);
- QVERIFY(window.seenMouseEvent);
+ QVERIFY(!window.seenMouseEvent);
window.reset();
window.acceptTouchEvent = true;
- QApplicationPrivate::sendTouchEvent(&window, &touchEvent);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints);
QVERIFY(window.seenTouchEvent);
QVERIFY(!window.seenMouseEvent);
}
@@ -1852,34 +1863,38 @@ void tst_QApplication::touchEventPropagation()
TouchEventPropagationTestWidget widget(&window);
widget.setObjectName("2. widget");
- QApplicationPrivate::sendTouchEvent(&widget, &touchEvent);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints);
QVERIFY(!widget.seenTouchEvent);
- QVERIFY(widget.seenMouseEvent);
+ QVERIFY(!widget.seenMouseEvent);
QVERIFY(!window.seenTouchEvent);
- QVERIFY(window.seenMouseEvent);
+ QVERIFY(!window.seenMouseEvent);
window.reset();
widget.reset();
- widget.setAttribute(Qt::WA_AcceptsTouchEvents);
- QApplicationPrivate::sendTouchEvent(&widget, &touchEvent);
+ widget.setAttribute(Qt::WA_AcceptTouchEvents);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints);
QVERIFY(widget.seenTouchEvent);
- QVERIFY(widget.seenMouseEvent);
+ QVERIFY(!widget.seenMouseEvent);
QVERIFY(!window.seenTouchEvent);
- QVERIFY(window.seenMouseEvent);
+ QVERIFY(!window.seenMouseEvent);
window.reset();
widget.reset();
widget.acceptMouseEvent = true;
- QApplicationPrivate::sendTouchEvent(&widget, &touchEvent);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints);
QVERIFY(widget.seenTouchEvent);
- QVERIFY(widget.seenMouseEvent);
+ QVERIFY(!widget.seenMouseEvent);
QVERIFY(!window.seenTouchEvent);
QVERIFY(!window.seenMouseEvent);
window.reset();
widget.reset();
widget.acceptTouchEvent = true;
- QApplicationPrivate::sendTouchEvent(&widget, &touchEvent);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints);
QVERIFY(widget.seenTouchEvent);
QVERIFY(!widget.seenMouseEvent);
QVERIFY(!window.seenTouchEvent);
@@ -1887,18 +1902,20 @@ void tst_QApplication::touchEventPropagation()
window.reset();
widget.reset();
- widget.setAttribute(Qt::WA_AcceptsTouchEvents, false);
- window.setAttribute(Qt::WA_AcceptsTouchEvents);
- QApplicationPrivate::sendTouchEvent(&widget, &touchEvent);
+ widget.setAttribute(Qt::WA_AcceptTouchEvents, false);
+ window.setAttribute(Qt::WA_AcceptTouchEvents);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints);
QVERIFY(!widget.seenTouchEvent);
- QVERIFY(widget.seenMouseEvent);
+ QVERIFY(!widget.seenMouseEvent);
QVERIFY(window.seenTouchEvent);
- QVERIFY(window.seenMouseEvent);
+ QVERIFY(!window.seenMouseEvent);
window.reset();
widget.reset();
window.acceptTouchEvent = true;
- QApplicationPrivate::sendTouchEvent(&widget, &touchEvent);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints);
QVERIFY(!widget.seenTouchEvent);
QVERIFY(!widget.seenMouseEvent);
QVERIFY(window.seenTouchEvent);
@@ -1908,7 +1925,8 @@ void tst_QApplication::touchEventPropagation()
widget.reset();
widget.acceptMouseEvent = true; // doesn't matter, touch events are propagated first
window.acceptTouchEvent = true;
- QApplicationPrivate::sendTouchEvent(&widget, &touchEvent);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints);
+ qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints);
QVERIFY(!widget.seenTouchEvent);
QVERIFY(!widget.seenMouseEvent);
QVERIFY(window.seenTouchEvent);
diff --git a/tests/auto/qchar/tst_qchar.cpp b/tests/auto/qchar/tst_qchar.cpp
index 01ba534..512c180 100644
--- a/tests/auto/qchar/tst_qchar.cpp
+++ b/tests/auto/qchar/tst_qchar.cpp
@@ -500,6 +500,9 @@ void tst_QChar::normalization()
}
QFile f("NormalizationTest.txt");
+ // Windows - current directory is the debug/release subdirectory where the executable is located
+ if (!f.exists())
+ f.setFileName("../NormalizationTest.txt");;
if (!f.exists()) {
QFAIL("Couldn't find NormalizationTest.txt");
return;
diff --git a/tests/auto/qcolumnview/tst_qcolumnview.cpp b/tests/auto/qcolumnview/tst_qcolumnview.cpp
index 0216e0f..0b3ba7a 100644
--- a/tests/auto/qcolumnview/tst_qcolumnview.cpp
+++ b/tests/auto/qcolumnview/tst_qcolumnview.cpp
@@ -42,6 +42,7 @@
#include <QtTest/QtTest>
#include <qstandarditemmodel.h>
+#include <qitemdelegate.h>
#include <qcolumnview.h>
#include "../../../src/gui/itemviews/qcolumnviewgrip_p.h"
#include "../../../src/gui/dialogs/qfilesystemmodel_p.h"
@@ -87,6 +88,8 @@ private slots:
void setSelectionModel();
void visualRegionForSelection();
+ void dynamicModelChanges();
+
// grip
void moveGrip_basic();
void moveGrip_data();
@@ -133,16 +136,10 @@ public:
inline QModelIndex thirdLevel() { return index(0, 0, secondLevel()); }
};
-class ColumnViewPrivate : public QColumnViewPrivate
-{
-public:
- ColumnViewPrivate() : QColumnViewPrivate() {}
-};
-
class ColumnView : public QColumnView {
public:
- ColumnView(QWidget *parent = 0) : QColumnView(*new ColumnViewPrivate, parent){}
+ ColumnView(QWidget *parent = 0) : QColumnView(parent){}
QList<QPointer<QAbstractItemView> > createdColumns;
void ScrollContentsBy(int x, int y) {scrollContentsBy(x,y); }
@@ -1002,6 +999,37 @@ void tst_QColumnView::pullRug()
// don't crash
}
+void tst_QColumnView::dynamicModelChanges()
+{
+ struct MyItemDelegate : public QItemDelegate
+ {
+ void paint(QPainter *painter,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
+ {
+ paintedIndexes += index;
+ QItemDelegate::paint(painter, option, index);
+ }
+
+ mutable QSet<QModelIndex> paintedIndexes;
+
+ } delegate;;
+ QStandardItemModel model;
+ ColumnView view;
+ view.setModel(&model);
+ view.setItemDelegate(&delegate);
+ view.show();
+
+ QStandardItem *item = new QStandardItem(QLatin1String("item"));
+ model.appendRow(item);
+
+ QTest::qWait(200); //let the time for painting to occur
+ QCOMPARE(delegate.paintedIndexes.count(), 1);
+ QCOMPARE(*delegate.paintedIndexes.begin(), model.index(0,0));
+
+
+}
+
QTEST_MAIN(tst_QColumnView)
#include "tst_qcolumnview.moc"
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index c94ace0..67c9ac9 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -1973,6 +1973,7 @@ void tst_QComboBox::task190351_layout()
listCombo.showPopup();
QTest::qWait(100);
+#ifdef QT_BUILD_INTERNAL
QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&listCombo);
QVERIFY(container);
QCOMPARE(static_cast<QAbstractItemView *>(list), qFindChild<QAbstractItemView *>(container));
@@ -1980,6 +1981,7 @@ void tst_QComboBox::task190351_layout()
QVERIFY(top);
QVERIFY(top->isVisible());
QCOMPARE(top->mapToGlobal(QPoint(0, top->height())).y(), list->mapToGlobal(QPoint()).y());
+#endif
QApplication::setStyle(oldStyle);
#else
@@ -2045,6 +2047,7 @@ void tst_QComboBox::task191329_size()
tableCombo.showPopup();
QTest::qWait(100);
+#ifdef QT_BUILD_INTERNAL
QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&tableCombo);
QVERIFY(container);
QCOMPARE(static_cast<QAbstractItemView *>(table), qFindChild<QAbstractItemView *>(container));
@@ -2052,6 +2055,7 @@ void tst_QComboBox::task191329_size()
//the popup should be large enough to contains everithing so the top and left button are hidden
QVERIFY(!button->isVisible());
}
+#endif
QApplication::setStyle(oldStyle);
#else
@@ -2107,9 +2111,11 @@ void tst_QComboBox::task248169_popupWithMinimalSize()
comboBox.showPopup();
QTest::qWait(100);
+#ifdef QT_BUILD_INTERNAL
QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&comboBox);
QVERIFY(container);
QVERIFY(desktop.screenGeometry(container).contains(container->geometry()));
+#endif
}
void tst_QComboBox::task247863_keyBoardSelection()
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp
index baea419..fb03e1a 100644
--- a/tests/auto/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/qcompleter/tst_qcompleter.cpp
@@ -58,9 +58,9 @@ class CsvCompleter : public QCompleter
Q_OBJECT
public:
CsvCompleter(QObject *parent = 0) : QCompleter(parent), csv(true) { }
-
- QString pathFromIndex(const QModelIndex& sourceIndex) const;
-
+
+ QString pathFromIndex(const QModelIndex& sourceIndex) const;
+
void setCsvCompletion(bool set) { csv = set; }
protected:
@@ -146,6 +146,8 @@ private slots:
void task253125_lineEditCompletion_data();
void task253125_lineEditCompletion();
+ void task247560_keyboardNavigation();
+
private:
void filter();
void testRowCount();
@@ -176,7 +178,7 @@ tst_QCompleter::~tst_QCompleter()
}
void tst_QCompleter::setSourceModel(ModelType type)
-{
+{
QString text;
QTreeWidgetItem *parent, *child;
treeWidget->clear();
@@ -282,7 +284,7 @@ void tst_QCompleter::csMatchingOnCsSortedModel_data()
for (int i = 0; i < 2; i++) {
if (i == 1)
QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << "";
-
+
// Plain text filter
QTest::newRow("()") << "" << "" << "P0" << "P0";
QTest::newRow("()F") << "" << "F" << "P0" << "P0";
@@ -299,7 +301,7 @@ void tst_QCompleter::csMatchingOnCsSortedModel_data()
QTest::newRow("(p)NNNN") << "p" << "NNNN" << "p4" << "p4";
QTest::newRow("(p1)") << "p1" << "" << "p1" << "p1";
QTest::newRow("(p11)") << "p11" << "" << "" << "";
-
+
// Tree filter
QTest::newRow("(P0,)") << "P0," << "" << "c0P0" << "P0,c0P0";
QTest::newRow("(P0,c)") << "P0,c" << "" << "c0P0" << "P0,c0P0";
@@ -333,7 +335,7 @@ void tst_QCompleter::ciMatchingOnCiSortedModel_data()
QTest::addColumn<QString>("completion");
QTest::addColumn<QString>("completionText");
- for (int i = 0; i < 2; i++) {
+ for (int i = 0; i < 2; i++) {
if (i == 1)
QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << "";
@@ -352,7 +354,7 @@ void tst_QCompleter::ciMatchingOnCiSortedModel_data()
QTest::newRow("(p1)") << "p1" << "" << "P1" << "P1";
QTest::newRow("(p1)N") << "p1" << "N" << "p1" << "p1";
QTest::newRow("(p11)") << "p11" << "" << "" << "";
-
+
//// Tree filter
QTest::newRow("(p0,)") << "p0," << "" << "c0P0" << "P0,c0P0";
QTest::newRow("(p0,c)") << "p0,c" << "" << "c0P0" << "P0,c0P0";
@@ -404,7 +406,7 @@ void tst_QCompleter::ciMatchingOnCsSortedModel_data()
QTest::newRow("(p1)") << "p1" << "" << "P1" << "P1";
QTest::newRow("(p1)N") << "p1" << "N" << "p1" << "p1";
QTest::newRow("(p11)") << "p11" << "" << "" << "";
-
+
// Tree filter
QTest::newRow("(p0,)") << "p0," << "" << "c0P0" << "P0,c0P0";
QTest::newRow("(p0,c)") << "p0,c" << "" << "c0P0" << "P0,c0P0";
@@ -456,7 +458,7 @@ void tst_QCompleter::csMatchingOnCiSortedModel_data()
QTest::newRow("(p)NNN") << "p" << "NNN" << "p3" << "p3";
QTest::newRow("(p1)") << "p1" << "" << "p1" << "p1";
QTest::newRow("(p11)") << "p11" << "" << "" << "";
-
+
//// Tree filter
QTest::newRow("(p0,)") << "p0," << "" << "c0p0" << "p0,c0p0";
QTest::newRow("(p0,c)") << "p0,c" << "" << "c0p0" << "p0,c0p0";
@@ -469,7 +471,7 @@ void tst_QCompleter::csMatchingOnCiSortedModel_data()
QTest::newRow("(p3,,c)") << "p3,,c" << "" << "" << "";
QTest::newRow("(p3,c0P3,)") << "p3,c0P3," << "" << "" << "";
QTest::newRow("(p,)") << "p," << "" << "" << "";
-
+
QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << "";
}
}
@@ -507,13 +509,13 @@ void tst_QCompleter::directoryModel_data()
QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files";
#elif defined (Q_OS_MAC)
QTest::newRow("()") << "" << "" << "/" << "/";
- QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications";
+ QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications";
QTest::newRow("(/d)") << "/d" << "" << "Developer" << "/Developer";
#else
QTest::newRow("()") << "" << "" << "/" << "/";
#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX)
QTest::newRow("(/h)") << "/h" << "" << "home" << "/home";
-#endif
+#endif
QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc";
QTest::newRow("(/etc/passw)") << "/etc/passw" << "" << "passwd" << "/etc/passwd";
#endif
@@ -659,7 +661,7 @@ void tst_QCompleter::currentRow()
completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
completer->setCaseSensitivity(Qt::CaseInsensitive);
setSourceModel(CASE_INSENSITIVELY_SORTED_MODEL);
-
+
// blank text
completer->setCompletionPrefix("");
QCOMPARE(completer->currentRow(), 0);
@@ -691,7 +693,7 @@ void tst_QCompleter::sortedEngineMapFromSource()
QModelIndex si1, si2, pi;
QAbstractItemModel *sourceModel = completer->model();
- const QAbstractProxyModel *completionModel =
+ const QAbstractProxyModel *completionModel =
qobject_cast<const QAbstractProxyModel *>(completer->completionModel());
// Fitering ON
@@ -762,7 +764,7 @@ void tst_QCompleter::unsortedEngineMapFromSource()
QModelIndex si, si2, si3, pi;
QAbstractItemModel *sourceModel = completer->model();
- const QAbstractProxyModel *completionModel =
+ const QAbstractProxyModel *completionModel =
qobject_cast<const QAbstractProxyModel *>(completer->completionModel());
si = sourceModel->index(6, completionColumn); // "P3"
@@ -844,7 +846,7 @@ void tst_QCompleter::historySearch()
completer->setCaseSensitivity(Qt::CaseSensitive);
setSourceModel(HISTORY_MODEL);
- const QAbstractProxyModel *completionModel =
+ const QAbstractProxyModel *completionModel =
qobject_cast<const QAbstractProxyModel *>(completer->completionModel());
// "p3,c3p3" and "p2,c4p2" are added in the tree root
@@ -952,7 +954,7 @@ void tst_QCompleter::multipleWidgets()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&window);
#endif
- QTest::qWait(5000);
+ QTest::qWait(50);
QTRY_VERIFY(qApp->focusWidget() == comboBox);
comboBox->lineEdit()->setText("it");
QCOMPARE(comboBox->currentText(), QString("it")); // should not complete with setText
@@ -965,7 +967,8 @@ void tst_QCompleter::multipleWidgets()
lineEdit->setCompleter(&completer);
lineEdit->show();
lineEdit->setFocus();
- QTest::qWait(5000);
+ QTest::qWait(50);
+ QTRY_VERIFY(qApp->focusWidget() == lineEdit);
lineEdit->setText("it");
QCOMPARE(lineEdit->text(), QString("it")); // should not completer with setText
QCOMPARE(comboBox->currentText(), QString("")); // combo box text must not change!
@@ -1027,7 +1030,7 @@ void tst_QCompleter::dynamicSortOrder()
QCOMPARE(completer.completionCount(), 12);
completer.setCompletionPrefix("13");
QCOMPARE(completer.completionCount(), 2);
-
+
root->sortChildren(0, Qt::DescendingOrder);
completer.setCompletionPrefix("13");
QCOMPARE(completer.completionCount(), 2);
@@ -1230,5 +1233,43 @@ void tst_QCompleter::task253125_lineEditCompletion()
QCOMPARE(edit.text(), QString("iota"));
}
+void tst_QCompleter::task247560_keyboardNavigation()
+{
+ QStandardItemModel model;
+
+ for (int i = 0; i < 5; i++) {
+ for (int j = 0; j < 5; j++) {
+ model.setItem(i, j, new QStandardItem(QString("row %1 column %2").arg(i).arg(j)));
+ }
+ }
+
+
+ QCompleter completer(&model);
+ completer.setCompletionColumn(1);
+
+ QLineEdit edit;
+ edit.setCompleter(&completer);
+ edit.show();
+ edit.setFocus();
+
+ QTest::qWait(100);
+
+ QTest::keyClick(&edit, 'r');
+ QTest::keyClick(edit.completer()->popup(), Qt::Key_Down);
+ QTest::keyClick(edit.completer()->popup(), Qt::Key_Down);
+ QTest::keyClick(edit.completer()->popup(), Qt::Key_Enter);
+
+ QCOMPARE(edit.text(), QString("row 1 column 1"));
+
+ edit.clear();
+
+ QTest::keyClick(&edit, 'r');
+ QTest::keyClick(edit.completer()->popup(), Qt::Key_Up);
+ QTest::keyClick(edit.completer()->popup(), Qt::Key_Up);
+ QTest::keyClick(edit.completer()->popup(), Qt::Key_Enter);
+
+ QCOMPARE(edit.text(), QString("row 3 column 1"));
+}
+
QTEST_MAIN(tst_QCompleter)
#include "tst_qcompleter.moc"
diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro
index 57d6804..723e4d3 100644
--- a/tests/auto/qcssparser/qcssparser.pro
+++ b/tests/auto/qcssparser/qcssparser.pro
@@ -3,6 +3,7 @@ SOURCES += tst_cssparser.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
QT += xml
+requires(contains(QT_CONFIG,private_tests))
wince*: {
addFiles.sources = testdata
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index e4fec1d..50cab0e 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -160,6 +160,7 @@ private slots:
void task251321_sideBarHiddenEntries();
void task251341_sideBarRemoveEntries();
void task254490_selectFileMultipleTimes();
+ void task257579_sideBarWithNonCleanUrls();
private:
QByteArray userSettings;
@@ -231,6 +232,7 @@ void tst_QFiledialog::currentChangedSignal()
// only emited from the views, sidebar, or lookin combo
void tst_QFiledialog::directoryEnteredSignal()
{
+#if defined QT_BUILD_INTERNAL
QNonNativeFileDialog fd(0, "", QDir::root().path());
fd.setOptions(QFileDialog::DontUseNativeDialog);
fd.show();
@@ -274,6 +276,7 @@ void tst_QFiledialog::directoryEnteredSignal()
QTest::mouseDClick(listView->viewport(), Qt::LeftButton, 0, listView->visualRect(folder).center());
QTRY_COMPARE(spyDirectoryEntered.count(), 1);
*/
+#endif
}
Q_DECLARE_METATYPE(QFileDialog::FileMode)
@@ -1314,16 +1317,14 @@ void tst_QFiledialog::hooks()
void tst_QFiledialog::listRoot()
{
+#if defined QT_BUILD_INTERNAL
QFileInfoGatherer::fetchedRoot = false;
QString dir(QDir::currentPath());
QNonNativeFileDialog fd(0, QString(), dir);
fd.show();
-#if defined Q_AUTOTEST_EXPORT
QCOMPARE(QFileInfoGatherer::fetchedRoot,false);
-#endif
fd.setDirectory("");
QTest::qWait(500);
-#if defined Q_AUTOTEST_EXPORT
QCOMPARE(QFileInfoGatherer::fetchedRoot,true);
#endif
}
@@ -1347,6 +1348,7 @@ struct FriendlyQFileDialog : public QFileDialog
void tst_QFiledialog::deleteDirAndFiles()
{
+#if defined QT_BUILD_INTERNAL
QString tempPath = QDir::tempPath() + '/' + "QFileDialogTestDir4FullDelete";
QDir dir;
QVERIFY(dir.mkpath(tempPath + "/foo"));
@@ -1373,6 +1375,7 @@ void tst_QFiledialog::deleteDirAndFiles()
QFileInfo info(tempPath);
QTest::qWait(2000);
QVERIFY(!info.exists());
+#endif
}
void tst_QFiledialog::filter()
@@ -1583,6 +1586,7 @@ QString &dir, const QString &filter)
void tst_QFiledialog::task227304_proxyOnFileDialog()
{
+#if defined QT_BUILD_INTERNAL
QNonNativeFileDialog fd(0, "", QDir::currentPath(), 0);
fd.setProxyModel(new FilterDirModel(QDir::currentPath()));
fd.show();
@@ -1616,6 +1620,7 @@ void tst_QFiledialog::task227304_proxyOnFileDialog()
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
QTest::qWait(250);
//We shouldn't crash
+#endif
}
void tst_QFiledialog::task227930_correctNavigationKeyboardBehavior()
@@ -1727,6 +1732,7 @@ void tst_QFiledialog::task235069_hideOnEscape()
void tst_QFiledialog::task236402_dontWatchDeletedDir()
{
+#if defined QT_BUILD_INTERNAL
//THIS TEST SHOULD NOT DISPLAY WARNINGS
QDir current = QDir::currentPath();
//make sure it is the first on the list
@@ -1746,6 +1752,7 @@ void tst_QFiledialog::task236402_dontWatchDeletedDir()
QTest::qWait(200);
fd.d_func()->removeDirectory(current.absolutePath() + "/aaaaaaaaaa/");
QTest::qWait(1000);
+#endif
}
void tst_QFiledialog::task203703_returnProperSeparator()
@@ -1870,6 +1877,7 @@ void tst_QFiledialog::task218353_relativePaths()
void tst_QFiledialog::task251321_sideBarHiddenEntries()
{
+#if defined QT_BUILD_INTERNAL
QNonNativeFileDialog fd;
QDir current = QDir::currentPath();
@@ -1899,8 +1907,10 @@ void tst_QFiledialog::task251321_sideBarHiddenEntries()
hiddenSubDir.rmdir("happy");
hiddenDir.rmdir("subdir");
current.rmdir(".hidden");
+#endif
}
+#if defined QT_BUILD_INTERNAL
class MyQSideBar : public QSidebar
{
public :
@@ -1918,9 +1928,11 @@ public :
model()->removeRow(indexes.at(i).row());
}
};
+#endif
void tst_QFiledialog::task251341_sideBarRemoveEntries()
{
+#if defined QT_BUILD_INTERNAL
QNonNativeFileDialog fd;
QDir current = QDir::currentPath();
@@ -1980,6 +1992,7 @@ void tst_QFiledialog::task251341_sideBarRemoveEntries()
QCOMPARE(mySideBar.urls(), expected);
current.rmdir("testDir");
+#endif
}
void tst_QFiledialog::task254490_selectFileMultipleTimes()
@@ -2014,5 +2027,25 @@ void tst_QFiledialog::task254490_selectFileMultipleTimes()
t->deleteLater();
}
+void tst_QFiledialog::task257579_sideBarWithNonCleanUrls()
+{
+ QDir tempDir = QDir::temp();
+ QLatin1String dirname("autotest_task257579");
+ tempDir.rmdir(dirname); //makes sure it doesn't exist any more
+ QVERIFY(tempDir.mkdir(dirname));
+ QString url = QString::fromLatin1("%1/%2/..").arg(tempDir.absolutePath()).arg(dirname);
+ QNonNativeFileDialog fd;
+ fd.setSidebarUrls(QList<QUrl>() << QUrl::fromLocalFile(url));
+ QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
+ QCOMPARE(sidebar->urls().count(), 1);
+ QVERIFY(sidebar->urls().first().toLocalFile() != url);
+ QCOMPARE(sidebar->urls().first().toLocalFile(), QDir::cleanPath(url));
+ QCOMPARE(sidebar->model()->index(0,0).data().toString(), tempDir.dirName());
+
+ //all tests are finished, we can remove the temporary dir
+ QVERIFY(tempDir.rmdir(dirname));
+}
+
+
QTEST_MAIN(tst_QFiledialog)
#include "tst_qfiledialog.moc"
diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
index e415b02..d49083f 100644
--- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -254,6 +254,7 @@ void tst_QFileSystemModel::naturalCompare_data()
void tst_QFileSystemModel::naturalCompare()
{
+#ifdef QT_BUILD_INTERNAL
QFETCH(QString, s1);
QFETCH(QString, s2);
QFETCH(int, caseSensitive);
@@ -271,6 +272,7 @@ void tst_QFileSystemModel::naturalCompare()
// created. The scheduler takes its time to recognize ended threads.
QTest::qWait(300);
#endif
+#endif
}
void tst_QFileSystemModel::readOnly()
diff --git a/tests/auto/qflags/tst_qflags.cpp b/tests/auto/qflags/tst_qflags.cpp
index a5f68dc..87d8258 100644
--- a/tests/auto/qflags/tst_qflags.cpp
+++ b/tests/auto/qflags/tst_qflags.cpp
@@ -45,6 +45,7 @@ class tst_QFlags: public QObject
Q_OBJECT
private slots:
void testFlag() const;
+ void testFlagZeroFlag() const;
void testFlagMultiBits() const;
};
@@ -59,8 +60,31 @@ void tst_QFlags::testFlag() const
QVERIFY(!btn.testFlag(Qt::LeftButton));
}
+void tst_QFlags::testFlagZeroFlag() const
+{
+ {
+ Qt::MouseButtons btn = Qt::LeftButton | Qt::RightButton;
+ /* Qt::NoButton has the value 0. */
+
+ QVERIFY(!btn.testFlag(Qt::NoButton));
+ }
+
+ {
+ /* A zero enum set should test true with zero. */
+ QVERIFY(Qt::MouseButtons().testFlag(Qt::NoButton));
+ }
+
+ {
+ Qt::MouseButtons btn = Qt::NoButton;
+ QVERIFY(btn.testFlag(Qt::NoButton));
+ }
+}
+
void tst_QFlags::testFlagMultiBits() const
{
+ /* Qt::Window is 0x00000001
+ * Qt::Dialog is 0x00000002 | Window
+ */
{
const Qt::WindowFlags onlyWindow(Qt::Window);
QVERIFY(!onlyWindow.testFlag(Qt::Dialog));
diff --git a/tests/auto/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/qfontcombobox/tst_qfontcombobox.cpp
index 62bfdf7..e2515ae 100644
--- a/tests/auto/qfontcombobox/tst_qfontcombobox.cpp
+++ b/tests/auto/qfontcombobox/tst_qfontcombobox.cpp
@@ -122,7 +122,10 @@ void tst_QFontComboBox::currentFont_data()
{
QTest::addColumn<QFont>("currentFont");
// Normalize the names
- QTest::newRow("default") << QFont(QFontInfo(QFont()).family());
+ QFont defaultFont;
+ QTest::newRow("default") << defaultFont;
+ defaultFont.setPointSize(defaultFont.pointSize() + 10);
+ QTest::newRow("default") << defaultFont;
QFontDatabase db;
QStringList list = db.families();
for (int i = 0; i < list.count(); ++i) {
@@ -141,6 +144,7 @@ void tst_QFontComboBox::currentFont()
QFont oldCurrentFont = box.currentFont();
box.setCurrentFont(currentFont);
+ QCOMPARE(box.currentFont(), currentFont);
QString boxFontFamily = QFontInfo(box.currentFont()).family();
QRegExp foundry(" \\[.*\\]");
if (!currentFont.family().contains(foundry))
diff --git a/tests/auto/qfontdialog/tst_qfontdialog.cpp b/tests/auto/qfontdialog/tst_qfontdialog.cpp
index 1444ee0..cbdd440 100644
--- a/tests/auto/qfontdialog/tst_qfontdialog.cpp
+++ b/tests/auto/qfontdialog/tst_qfontdialog.cpp
@@ -156,7 +156,7 @@ void tst_QFontDialog::setFont()
class FriendlyFontDialog : public QFontDialog
{
- friend tst_QFontDialog;
+ friend class tst_QFontDialog;
Q_DECLARE_PRIVATE(QFontDialog);
};
@@ -170,8 +170,12 @@ void tst_QFontDialog::task256466_wrongStyle()
for (int i = 0; i < familyList->model()->rowCount(); ++i) {
QModelIndex currentFamily = familyList->model()->index(i, 0);
familyList->setCurrentIndex(currentFamily);
- QCOMPARE(dialog.currentFont(), fdb.font(currentFamily.data().toString(),
- styleList->currentIndex().data().toString(), sizeList->currentIndex().data().toInt()));
+ const QFont current = dialog.currentFont(),
+ expected = fdb.font(currentFamily.data().toString(),
+ styleList->currentIndex().data().toString(), sizeList->currentIndex().data().toInt());
+ QCOMPARE(current.family(), expected.family());
+ QCOMPARE(current.style(), expected.style());
+ QCOMPARE(current.pointSizeF(), expected.pointSizeF());
}
}
diff --git a/tests/auto/qgl/qgl.pro b/tests/auto/qgl/qgl.pro
index 55e329d..420c4bb 100644
--- a/tests/auto/qgl/qgl.pro
+++ b/tests/auto/qgl/qgl.pro
@@ -3,7 +3,8 @@
############################################################
load(qttest_p4)
-contains(QT_CONFIG, opengl):QT += opengl
+requires(contains(QT_CONFIG,opengl))
+QT += opengl
SOURCES += tst_qgl.cpp
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index 078c559..96f5ddd 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -44,9 +44,7 @@
#include <qcoreapplication.h>
#include <qdebug.h>
-#ifndef QT_NO_OPENGL
#include <qgl.h>
-#endif
#include <QGraphicsView>
#include <QGraphicsProxyWidget>
@@ -78,7 +76,6 @@ tst_QGL::~tst_QGL()
{
}
-#ifndef QT_NO_OPENGL
class MyGLContext : public QGLContext
{
public:
@@ -96,13 +93,10 @@ public:
bool autoBufferSwap() const { return QGLWidget::autoBufferSwap(); }
void setAutoBufferSwap(bool on) { QGLWidget::setAutoBufferSwap(on); }
};
-#endif
+
// Testing get/set functions
void tst_QGL::getSetCheck()
{
-#ifdef QT_NO_OPENGL
- QSKIP("QGL not yet supported", SkipAll);
-#else
if (!QGLFormat::hasOpenGL())
QSKIP("QGL not supported on this platform", SkipAll);
@@ -246,10 +240,9 @@ void tst_QGL::getSetCheck()
QCOMPARE(false, obj3.autoBufferSwap());
obj3.setAutoBufferSwap(true);
QCOMPARE(true, obj3.autoBufferSwap());
-#endif
}
-#ifndef QT_NO_OPENGL
+#ifdef QT_BUILD_INTERNAL
QT_BEGIN_NAMESPACE
extern QGLFormat::OpenGLVersionFlags qOpenGLVersionFlagsFromString(const QString &versionString);
QT_END_NAMESPACE
@@ -257,9 +250,7 @@ QT_END_NAMESPACE
void tst_QGL::openGLVersionCheck()
{
-#ifdef QT_NO_OPENGL
- QSKIP("QGL not yet supported", SkipAll);
-#else
+#ifdef QT_BUILD_INTERNAL
if (!QGLFormat::hasOpenGL())
QSKIP("QGL not supported on this platform", SkipAll);
@@ -366,9 +357,6 @@ public:
void tst_QGL::graphicsViewClipping()
{
-#ifdef QT_NO_OPENGL
- QSKIP("QGL not supported", SkipAll);
-#else
const int size = 64;
UnclippedWidget *widget = new UnclippedWidget;
widget->setFixedSize(size, size);
@@ -403,7 +391,6 @@ void tst_QGL::graphicsViewClipping()
p.end();
QCOMPARE(image, expected);
-#endif
}
void tst_QGL::partialGLWidgetUpdates_data()
@@ -420,9 +407,6 @@ void tst_QGL::partialGLWidgetUpdates_data()
void tst_QGL::partialGLWidgetUpdates()
{
-#ifdef QT_NO_OPENGL
- QSKIP("QGL not yet supported", SkipAll);
-#else
if (!QGLFormat::hasOpenGL())
QSKIP("QGL not supported on this platform", SkipAll);
@@ -466,7 +450,6 @@ void tst_QGL::partialGLWidgetUpdates()
QCOMPARE(widget.paintEventRegion, QRegion(50, 50, 50, 50));
else
QCOMPARE(widget.paintEventRegion, QRegion(widget.rect()));
-#endif
}
QTEST_MAIN(tst_QGL)
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 7552f18..3f41a90 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -182,6 +182,8 @@ private slots:
void handlesChildEvents();
void handlesChildEvents2();
void handlesChildEvents3();
+ void filtersChildEvents();
+ void filtersChildEvents2();
void ensureVisible();
void cursor();
//void textControlGetterSetter();
@@ -231,6 +233,7 @@ private slots:
void sorting_data();
void sorting();
void itemHasNoContents();
+ void hitTestUntransformableItem();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -3405,6 +3408,127 @@ void tst_QGraphicsItem::handlesChildEvents3()
QCOMPARE(group2->counter, 3);
}
+
+class ChildEventFilterTester : public ChildEventTester
+{
+public:
+ ChildEventFilterTester(const QRectF &rect, QGraphicsItem *parent = 0)
+ : ChildEventTester(rect, parent), filter(QEvent::None)
+ { }
+
+ QEvent::Type filter;
+
+protected:
+ bool sceneEventFilter(QGraphicsItem *item, QEvent *event)
+ {
+ Q_UNUSED(item);
+ if (event->type() == filter) {
+ ++counter;
+ return true;
+ }
+ return false;
+ }
+};
+
+void tst_QGraphicsItem::filtersChildEvents()
+{
+ QGraphicsScene scene;
+ ChildEventFilterTester *root = new ChildEventFilterTester(QRectF(0, 0, 10, 10));
+ ChildEventFilterTester *filter = new ChildEventFilterTester(QRectF(10, 10, 10, 10), root);
+ ChildEventTester *child = new ChildEventTester(QRectF(20, 20, 10, 10), filter);
+
+ // setup filter
+ filter->setFiltersChildEvents(true);
+ filter->filter = QEvent::GraphicsSceneMousePress;
+
+ scene.addItem(root);
+
+ QGraphicsView view(&scene);
+ view.show();
+
+ QTest::qWait(1000);
+
+ QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress);
+ QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease);
+
+ // send event to child
+ pressEvent.setButton(Qt::LeftButton);
+ pressEvent.setScenePos(QPointF(25, 25));//child->mapToScene(5, 5));
+ pressEvent.setScreenPos(view.mapFromScene(pressEvent.scenePos()));
+ releaseEvent.setButton(Qt::LeftButton);
+ releaseEvent.setScenePos(QPointF(25, 25));//child->mapToScene(5, 5));
+ releaseEvent.setScreenPos(view.mapFromScene(pressEvent.scenePos()));
+ QApplication::sendEvent(&scene, &pressEvent);
+ QApplication::sendEvent(&scene, &releaseEvent);
+
+ QCOMPARE(child->counter, 1); // mouse release is not filtered
+ QCOMPARE(filter->counter, 1); // mouse press is filtered
+ QCOMPARE(root->counter, 0);
+
+ // add another filter
+ root->setFiltersChildEvents(true);
+ root->filter = QEvent::GraphicsSceneMouseRelease;
+
+ // send event to child
+ QApplication::sendEvent(&scene, &pressEvent);
+ QApplication::sendEvent(&scene, &releaseEvent);
+
+ QCOMPARE(child->counter, 1);
+ QCOMPARE(filter->counter, 2); // mouse press is filtered
+ QCOMPARE(root->counter, 1); // mouse release is filtered
+
+ // reparent to another sub-graph
+ ChildEventTester *parent = new ChildEventTester(QRectF(10, 10, 10, 10), root);
+ child->setParentItem(parent);
+
+ // send event to child
+ QApplication::sendEvent(&scene, &pressEvent);
+ QApplication::sendEvent(&scene, &releaseEvent);
+
+ QCOMPARE(child->counter, 2); // mouse press is _not_ filtered
+ QCOMPARE(parent->counter, 0);
+ QCOMPARE(filter->counter, 2);
+ QCOMPARE(root->counter, 2); // mouse release is filtered
+}
+
+void tst_QGraphicsItem::filtersChildEvents2()
+{
+ ChildEventFilterTester *root = new ChildEventFilterTester(QRectF(0, 0, 10, 10));
+ root->setFiltersChildEvents(true);
+ root->filter = QEvent::GraphicsSceneMousePress;
+ QVERIFY(root->filtersChildEvents());
+
+ ChildEventTester *child = new ChildEventTester(QRectF(0, 0, 10, 10), root);
+ QVERIFY(!child->filtersChildEvents());
+
+ ChildEventTester *child2 = new ChildEventTester(QRectF(0, 0, 10, 10));
+ ChildEventTester *child3 = new ChildEventTester(QRectF(0, 0, 10, 10), child2);
+ ChildEventTester *child4 = new ChildEventTester(QRectF(0, 0, 10, 10), child3);
+
+ child2->setParentItem(root);
+ QVERIFY(!child2->filtersChildEvents());
+ QVERIFY(!child3->filtersChildEvents());
+ QVERIFY(!child4->filtersChildEvents());
+
+ QGraphicsScene scene;
+ scene.addItem(root);
+
+ QGraphicsView view(&scene);
+ view.show();
+
+ QTestEventLoop::instance().enterLoop(1);
+
+ QMouseEvent event(QEvent::MouseButtonPress, view.mapFromScene(5, 5),
+ view.viewport()->mapToGlobal(view.mapFromScene(5, 5)), Qt::LeftButton, 0, 0);
+ QApplication::sendEvent(view.viewport(), &event);
+
+ QCOMPARE(child->counter, 0);
+ QCOMPARE(child2->counter, 0);
+ QCOMPARE(child3->counter, 0);
+ QCOMPARE(child4->counter, 0);
+ QCOMPARE(root->counter, 1);
+}
+
class CustomItem : public QGraphicsItem
{
public:
@@ -6580,6 +6704,7 @@ public:
void tst_QGraphicsItem::update()
{
QGraphicsScene scene;
+ scene.setSceneRect(-100, -100, 200, 200);
MyGraphicsView view(&scene);
view.show();
@@ -6612,9 +6737,9 @@ void tst_QGraphicsItem::update()
qApp->processEvents();
QCOMPARE(item->repaints, 1);
QCOMPARE(view.repaints, 1);
- const QRect itemDeviceBoundingRect = item->deviceTransform(view.viewportTransform())
- .mapRect(item->boundingRect()).toRect();
- const QRegion expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2);
+ QRect itemDeviceBoundingRect = item->deviceTransform(view.viewportTransform())
+ .mapRect(item->boundingRect()).toRect();
+ QRegion expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2);
// The entire item's bounding rect (adjusted for antialiasing) should have been painted.
QCOMPARE(view.paintedRegion, expectedRegion);
@@ -6625,6 +6750,90 @@ void tst_QGraphicsItem::update()
qApp->processEvents();
QCOMPARE(item->repaints, 0);
QCOMPARE(view.repaints, 0);
+
+ // Make sure the area occupied by an item is repainted when hiding it.
+ view.reset();
+ item->repaints = 0;
+ item->update(); // Full update; all sub-sequent update requests are discarded.
+ item->hide(); // visible set to 0. ignoreVisible must be set to 1; the item won't be processed otherwise.
+ qApp->processEvents();
+ QCOMPARE(item->repaints, 0);
+ QCOMPARE(view.repaints, 1);
+ // The entire item's bounding rect (adjusted for antialiasing) should have been painted.
+ QCOMPARE(view.paintedRegion, expectedRegion);
+
+ // Make sure item is repainted when shown (after being hidden).
+ view.reset();
+ item->repaints = 0;
+ item->show();
+ qApp->processEvents();
+ QCOMPARE(item->repaints, 1);
+ QCOMPARE(view.repaints, 1);
+ // The entire item's bounding rect (adjusted for antialiasing) should have been painted.
+ QCOMPARE(view.paintedRegion, expectedRegion);
+
+ item->repaints = 0;
+ item->hide();
+ qApp->processEvents();
+ view.reset();
+ const QPointF originalPos = item->pos();
+ item->setPos(5000, 5000);
+ qApp->processEvents();
+ QCOMPARE(item->repaints, 0);
+ QCOMPARE(view.repaints, 0);
+ qApp->processEvents();
+
+ item->setPos(originalPos);
+ qApp->processEvents();
+ QCOMPARE(item->repaints, 0);
+ QCOMPARE(view.repaints, 0);
+ item->show();
+ qApp->processEvents();
+ QCOMPARE(item->repaints, 1);
+ QCOMPARE(view.repaints, 1);
+ // The entire item's bounding rect (adjusted for antialiasing) should have been painted.
+ QCOMPARE(view.paintedRegion, expectedRegion);
+
+ QGraphicsViewPrivate *viewPrivate = static_cast<QGraphicsViewPrivate *>(qt_widget_private(&view));
+ item->setPos(originalPos + QPoint(50, 50));
+ viewPrivate->updateAll();
+ QVERIFY(viewPrivate->fullUpdatePending);
+ QTest::qWait(50);
+ item->repaints = 0;
+ view.reset();
+ item->setPos(originalPos);
+ QTest::qWait(50);
+ qApp->processEvents();
+ QCOMPARE(item->repaints, 1);
+ QCOMPARE(view.repaints, 1);
+ QCOMPARE(view.paintedRegion, expectedRegion + expectedRegion.translated(50, 50));
+
+ // Make sure moving a parent item triggers an update on the children
+ // (even though the parent itself is outside the viewport).
+ QGraphicsRectItem *parent = new QGraphicsRectItem(0, 0, 10, 10);
+ parent->setPos(-400, 0);
+ item->setParentItem(parent);
+ item->setPos(400, 0);
+ scene.addItem(parent);
+ QTest::qWait(50);
+ itemDeviceBoundingRect = item->deviceTransform(view.viewportTransform())
+ .mapRect(item->boundingRect()).toRect();
+ expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2);
+ view.reset();
+ item->repaints = 0;
+ parent->translate(-400, 0);
+ qApp->processEvents();
+ QCOMPARE(item->repaints, 0);
+ QCOMPARE(view.repaints, 1);
+ QCOMPARE(view.paintedRegion, expectedRegion);
+ view.reset();
+ item->repaints = 0;
+ parent->translate(400, 0);
+ qApp->processEvents();
+ QCOMPARE(item->repaints, 1);
+ QCOMPARE(view.repaints, 1);
+ QCOMPARE(view.paintedRegion, expectedRegion);
+ QCOMPARE(view.paintedRegion, expectedRegion);
}
void tst_QGraphicsItem::setTransformProperties_data()
@@ -6837,9 +7046,11 @@ public:
//Doesn't use the extended style option so the exposed rect is the boundingRect
if (!(flags() & QGraphicsItem::ItemUsesExtendedStyleOption)) {
QCOMPARE(option->exposedRect, boundingRect());
+ QCOMPARE(option->matrix, QMatrix());
} else {
QVERIFY(option->exposedRect != QRect());
QVERIFY(option->exposedRect != boundingRect());
+ QCOMPARE(option->matrix, sceneTransform().toAffine());
}
}
QGraphicsRectItem::paint(painter, option, widget);
@@ -6861,6 +7072,8 @@ void tst_QGraphicsItem::itemUsesExtendedStyleOption()
scene.addItem(rect);
rect->setPos(200, 200);
QGraphicsView view(&scene);
+ rect->startTrack = false;
+ view.show();
QTest::qWait(500);
rect->startTrack = true;
rect->update(10, 10, 10, 10);
@@ -7023,7 +7236,7 @@ void tst_QGraphicsItem::sorting()
QGraphicsView view(&scene);
view.setResizeAnchor(QGraphicsView::NoAnchor);
view.setTransformationAnchor(QGraphicsView::NoAnchor);
- view.resize(100, 100);
+ view.resize(120, 100);
view.setFrameStyle(0);
view.show();
#ifdef Q_WS_X11
@@ -7040,6 +7253,7 @@ void tst_QGraphicsItem::sorting()
<< grid[1][0] << grid[1][1] << grid[1][2] << grid[1][3]
<< grid[2][0] << grid[2][1] << grid[2][2] << grid[2][3]
<< grid[3][0] << grid[3][1] << grid[3][2] << grid[3][3]
+ << grid[4][0] << grid[4][1] << grid[4][2] << grid[4][3]
<< item1 << item2);
}
@@ -7069,5 +7283,55 @@ void tst_QGraphicsItem::itemHasNoContents()
QCOMPARE(_paintedItems, QList<QGraphicsItem *>() << item2);
}
+void tst_QGraphicsItem::hitTestUntransformableItem()
+{
+ QGraphicsScene scene;
+ scene.setSceneRect(-100, -100, 200, 200);
+
+ QGraphicsView view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(100);
+
+ // Confuse the BSP with dummy items.
+ QGraphicsRectItem *dummy = new QGraphicsRectItem(0, 0, 20, 20);
+ dummy->setPos(-100, -100);
+ scene.addItem(dummy);
+ for (int i = 0; i < 100; ++i) {
+ QGraphicsItem *parent = dummy;
+ dummy = new QGraphicsRectItem(0, 0, 20, 20);
+ dummy->setPos(-100 + i, -100 + i);
+ dummy->setParentItem(parent);
+ }
+
+ QGraphicsRectItem *item1 = new QGraphicsRectItem(0, 0, 20, 20);
+ item1->setPos(-200, -200);
+
+ QGraphicsRectItem *item2 = new QGraphicsRectItem(0, 0, 20, 20);
+ item2->setFlag(QGraphicsItem::ItemIgnoresTransformations);
+ item2->setParentItem(item1);
+ item2->setPos(200, 200);
+
+ QGraphicsRectItem *item3 = new QGraphicsRectItem(0, 0, 20, 20);
+ item3->setParentItem(item2);
+ item3->setPos(80, 80);
+
+ scene.addItem(item1);
+ QTest::qWait(100);
+
+ QList<QGraphicsItem *> items = scene.items(QPointF(80, 80));
+ QCOMPARE(items.size(), 1);
+ QCOMPARE(items.at(0), static_cast<QGraphicsItem*>(item3));
+
+ scene.setItemIndexMethod(QGraphicsScene::NoIndex);
+ QTest::qWait(100);
+
+ items = scene.items(QPointF(80, 80));
+ QCOMPARE(items.size(), 1);
+ QCOMPARE(items.at(0), static_cast<QGraphicsItem*>(item3));
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp
index 536c750..bca673f 100644
--- a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp
+++ b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp
@@ -687,7 +687,6 @@ void tst_QGraphicsLayout::ownership()
delete top;
//don't crash after that.
}
-
}
QTEST_MAIN(tst_QGraphicsLayout)
diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index dbc4339..1d0663a 100644
--- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -178,6 +178,7 @@ private slots:
void windowFlags_data();
void windowFlags();
void comboboxWindowFlags();
+ void updateAndDelete();
void inputMethod();
};
@@ -3218,6 +3219,44 @@ void tst_QGraphicsProxyWidget::comboboxWindowFlags()
QVERIFY((static_cast<QGraphicsWidget *>(popupProxy)->windowFlags() & Qt::Popup) == Qt::Popup);
}
+void tst_QGraphicsProxyWidget::updateAndDelete()
+{
+ QGraphicsScene scene;
+ QGraphicsProxyWidget *proxy = scene.addWidget(new QPushButton("Hello World"));
+ View view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(200);
+
+ const QRect itemDeviceBoundingRect = proxy->deviceTransform(view.viewportTransform())
+ .mapRect(proxy->boundingRect()).toRect();
+ const QRegion expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2);
+
+ view.npaints = 0;
+ view.paintEventRegion = QRegion();
+
+ // Update and hide.
+ proxy->update();
+ proxy->hide();
+ QTest::qWait(50);
+ QCOMPARE(view.npaints, 1);
+ QCOMPARE(view.paintEventRegion, expectedRegion);
+
+ proxy->show();
+ QTest::qWait(50);
+ view.npaints = 0;
+ view.paintEventRegion = QRegion();
+
+ // Update and delete.
+ proxy->update();
+ delete proxy;
+ QTest::qWait(50);
+ QCOMPARE(view.npaints, 1);
+ QCOMPARE(view.paintEventRegion, expectedRegion);
+}
+
class InputMethod_LineEdit : public QLineEdit
{
bool event(QEvent *e)
@@ -3252,7 +3291,7 @@ void tst_QGraphicsProxyWidget::inputMethod()
if (i)
lineEdit->setFocus();
-
+
lineEdit->inputMethodEvents = 0;
QInputMethodEvent event;
qApp->sendEvent(proxy, &event);
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index d325f0f..f7ea4ce 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -236,6 +236,7 @@ private slots:
void contextMenuEvent();
void contextMenuEvent_ItemIgnoresTransformations();
void update();
+ void update2();
void views();
void event();
void eventsToDisabledItems();
@@ -289,28 +290,46 @@ void tst_QGraphicsScene::construction()
void tst_QGraphicsScene::sceneRect()
{
QGraphicsScene scene;
+ QSignalSpy sceneRectChanged(&scene, SIGNAL(sceneRectChanged(QRectF)));
QCOMPARE(scene.sceneRect(), QRectF());
+ QCOMPARE(sceneRectChanged.count(), 0);
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10));
- qApp->processEvents();
item->setPos(-5, -5);
- qApp->processEvents();
+ QCOMPARE(sceneRectChanged.count(), 0);
QCOMPARE(scene.itemAt(0, 0), item);
QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
+ QCOMPARE(sceneRectChanged.count(), 0);
+ QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 10, 10));
+ QCOMPARE(sceneRectChanged.count(), 1);
+ QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect());
+
+ item->setPos(0, 0);
QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 15, 15));
+ QCOMPARE(sceneRectChanged.count(), 2);
+ QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect());
scene.setSceneRect(-100, -100, 10, 10);
+ QCOMPARE(sceneRectChanged.count(), 3);
+ QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect());
QCOMPARE(scene.itemAt(0, 0), item);
QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10));
+ item->setPos(10, 10);
+ QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10));
+ QCOMPARE(sceneRectChanged.count(), 3);
+ QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect());
scene.setSceneRect(QRectF());
- QCOMPARE(scene.itemAt(0, 0), item);
- QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
- QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 15, 15));
+ QCOMPARE(scene.itemAt(10, 10), item);
+ QCOMPARE(scene.itemAt(20, 20), (QGraphicsItem *)0);
+ QCOMPARE(sceneRectChanged.count(), 4);
+ QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 25, 25));
+ QCOMPARE(sceneRectChanged.count(), 5);
+ QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect());
}
void tst_QGraphicsScene::itemIndexMethod()
@@ -399,8 +418,7 @@ void tst_QGraphicsScene::items()
for (int x = minX; x < maxX; x += 100)
items << scene.addRect(QRectF(0, 0, 10, 10));
}
-
- QCOMPARE(scene.items(), items);
+ QCOMPARE(scene.items().size(), items.size());
scene.itemAt(0, 0); // trigger indexing
scene.removeItem(items.at(5));
@@ -415,6 +433,9 @@ void tst_QGraphicsScene::items()
QGraphicsLineItem *l2 = scene.addLine(0, -5, 0, 5);
QVERIFY(!l1->sceneBoundingRect().intersects(l2->sceneBoundingRect()));
QVERIFY(!l2->sceneBoundingRect().intersects(l1->sceneBoundingRect()));
+ QList<QGraphicsItem *> items;
+ items<<l1<<l2;
+ QCOMPARE(scene.items().size(), items.size());
QVERIFY(scene.items(-1, -1, 2, 2).contains(l1));
QVERIFY(scene.items(-1, -1, 2, 2).contains(l2));
}
@@ -2742,8 +2763,8 @@ void tst_QGraphicsScene::update()
qRegisterMetaType<QList<QRectF> >("QList<QRectF>");
QSignalSpy spy(&scene, SIGNAL(changed(QList<QRectF>)));
- // When deleted, the item will lazy-remove itself
- delete rect;
+ // We update the scene.
+ scene.update();
// This function forces a purge, which will post an update signal
scene.itemAt(0, 0);
@@ -2759,6 +2780,32 @@ void tst_QGraphicsScene::update()
QCOMPARE(region, QRectF(-100, -100, 200, 200));
}
+void tst_QGraphicsScene::update2()
+{
+ QGraphicsScene scene;
+ scene.setSceneRect(-200, -200, 200, 200);
+ CustomView view;
+ view.setScene(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(250);
+ view.repaints = 0;
+
+ // Make sure QGraphicsScene::update only requires one event-loop iteration
+ // before the view is updated.
+ scene.update();
+ qApp->processEvents();
+ QCOMPARE(view.repaints, 1);
+ view.repaints = 0;
+
+ // The same for partial scene updates.
+ scene.update(QRectF(-100, -100, 100, 100));
+ qApp->processEvents();
+ QCOMPARE(view.repaints, 1);
+}
+
void tst_QGraphicsScene::views()
{
QGraphicsScene scene;
diff --git a/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro b/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro
new file mode 100644
index 0000000..740a23e
--- /dev/null
+++ b/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+SOURCES += tst_qgraphicssceneindex.cpp
+
diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
new file mode 100644
index 0000000..3ce5b16
--- /dev/null
+++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
@@ -0,0 +1,271 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+#include <QtGui/qgraphicsscene.h>
+#include <private/qgraphicsscenebsptreeindex_p.h>
+#include <private/qgraphicssceneindex_p.h>
+#include <private/qgraphicsscenelinearindex_p.h>
+
+//TESTED_CLASS=
+//TESTED_FILES=
+
+class tst_QGraphicsSceneIndex : public QObject
+{
+ Q_OBJECT
+public slots:
+ void initTestCase();
+
+private slots:
+ void customIndex_data();
+ void customIndex();
+ void scatteredItems_data();
+ void scatteredItems();
+ void overlappedItems_data();
+ void overlappedItems();
+ void movingItems_data();
+ void movingItems();
+ void connectedToSceneRectChanged();
+ void items();
+
+private:
+ void common_data();
+ QGraphicsSceneIndex *createIndex(const QString &name);
+};
+
+void tst_QGraphicsSceneIndex::initTestCase()
+{
+}
+
+void tst_QGraphicsSceneIndex::common_data()
+{
+ QTest::addColumn<QString>("indexMethod");
+
+ QTest::newRow("BSP") << QString("bsp");
+ QTest::newRow("Linear") << QString("linear");
+}
+
+QGraphicsSceneIndex *tst_QGraphicsSceneIndex::createIndex(const QString &indexMethod)
+{
+ QGraphicsSceneIndex *index = 0;
+ QGraphicsScene *scene = new QGraphicsScene();
+ if (indexMethod == "bsp")
+ index = new QGraphicsSceneBspTreeIndex(scene);
+
+ if (indexMethod == "linear")
+ index = new QGraphicsSceneLinearIndex(scene);
+
+ return index;
+}
+
+void tst_QGraphicsSceneIndex::customIndex_data()
+{
+ common_data();
+}
+
+void tst_QGraphicsSceneIndex::customIndex()
+{
+#if 0
+ QFETCH(QString, indexMethod);
+ QGraphicsSceneIndex *index = createIndex(indexMethod);
+
+ QGraphicsScene scene;
+ scene.setSceneIndex(index);
+
+ scene.addRect(0, 0, 30, 40);
+ QCOMPARE(scene.items(QRectF(0, 0, 10, 10)).count(), 1);
+#endif
+}
+
+void tst_QGraphicsSceneIndex::scatteredItems_data()
+{
+ common_data();
+}
+
+void tst_QGraphicsSceneIndex::scatteredItems()
+{
+ QFETCH(QString, indexMethod);
+
+ QGraphicsScene scene;
+#if 1
+ scene.setItemIndexMethod(indexMethod == "linear" ? QGraphicsScene::NoIndex : QGraphicsScene::BspTreeIndex);
+#else
+ QGraphicsSceneIndex *index = createIndex(indexMethod);
+ scene.setSceneIndex(index);
+#endif
+
+ for (int i = 0; i < 10; ++i)
+ scene.addRect(i*50, i*50, 40, 35);
+
+ QCOMPARE(scene.items(QPointF(5, 5)).count(), 1);
+ QCOMPARE(scene.items(QPointF(55, 55)).count(), 1);
+ QCOMPARE(scene.items(QPointF(-100, -100)).count(), 0);
+
+ QCOMPARE(scene.items(QRectF(0, 0, 10, 10)).count(), 1);
+ QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 10);
+ QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).count(), 0);
+}
+
+void tst_QGraphicsSceneIndex::overlappedItems_data()
+{
+ common_data();
+}
+
+void tst_QGraphicsSceneIndex::overlappedItems()
+{
+ QFETCH(QString, indexMethod);
+
+ QGraphicsScene scene;
+#if 1
+ scene.setItemIndexMethod(indexMethod == "linear" ? QGraphicsScene::NoIndex : QGraphicsScene::BspTreeIndex);
+#else
+ QGraphicsSceneIndex *index = createIndex(indexMethod);
+ scene.setSceneIndex(index);
+#endif
+
+ for (int i = 0; i < 10; ++i)
+ for (int j = 0; j < 10; ++j)
+ scene.addRect(i*50, j*50, 200, 200);
+
+ QCOMPARE(scene.items(QPointF(5, 5)).count(), 1);
+ QCOMPARE(scene.items(QPointF(55, 55)).count(), 4);
+ QCOMPARE(scene.items(QPointF(105, 105)).count(), 9);
+ QCOMPARE(scene.items(QPointF(-100, -100)).count(), 0);
+
+ QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 100);
+ QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).count(), 0);
+ QCOMPARE(scene.items(QRectF(0, 0, 200, 200)).count(), 16);
+ QCOMPARE(scene.items(QRectF(0, 0, 100, 100)).count(), 4);
+ QCOMPARE(scene.items(QRectF(0, 0, 1, 100)).count(), 2);
+ QCOMPARE(scene.items(QRectF(0, 0, 1, 1000)).count(), 10);
+}
+
+void tst_QGraphicsSceneIndex::movingItems_data()
+{
+ common_data();
+}
+
+void tst_QGraphicsSceneIndex::movingItems()
+{
+ QFETCH(QString, indexMethod);
+
+ QGraphicsScene scene;
+#if 1
+ scene.setItemIndexMethod(indexMethod == "linear" ? QGraphicsScene::NoIndex : QGraphicsScene::BspTreeIndex);
+#else
+ QGraphicsSceneIndex *index = createIndex(indexMethod);
+ scene.setSceneIndex(index);
+#endif
+
+ for (int i = 0; i < 10; ++i)
+ scene.addRect(i*50, i*50, 40, 35);
+
+ QGraphicsRectItem *box = scene.addRect(0, 0, 10, 10);
+ QCOMPARE(scene.items(QPointF(5, 5)).count(), 2);
+ QCOMPARE(scene.items(QPointF(-1, -1)).count(), 0);
+ QCOMPARE(scene.items(QRectF(0, 0, 5, 5)).count(), 2);
+
+ box->setPos(10, 10);
+ QCOMPARE(scene.items(QPointF(9, 9)).count(), 1);
+ QCOMPARE(scene.items(QPointF(15, 15)).count(), 2);
+ QCOMPARE(scene.items(QRectF(0, 0, 1, 1)).count(), 1);
+
+ box->setPos(-5, -5);
+ QCOMPARE(scene.items(QPointF(-1, -1)).count(), 1);
+ QCOMPARE(scene.items(QRectF(0, 0, 1, 1)).count(), 2);
+
+ QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 11);
+}
+
+void tst_QGraphicsSceneIndex::connectedToSceneRectChanged()
+{
+
+ class MyScene : public QGraphicsScene
+ { public: using QGraphicsScene::receivers; };
+
+ MyScene scene; // Uses QGraphicsSceneBspTreeIndex by default.
+ QCOMPARE(scene.receivers(SIGNAL(sceneRectChanged(const QRectF&))), 1);
+
+ scene.setItemIndexMethod(QGraphicsScene::NoIndex); // QGraphicsSceneLinearIndex
+ QCOMPARE(scene.receivers(SIGNAL(sceneRectChanged(const QRectF&))), 1);
+}
+
+void tst_QGraphicsSceneIndex::items()
+{
+ QGraphicsScene scene;
+ QGraphicsItem *item1 = scene.addRect(0, 0, 10, 10);
+ QGraphicsItem *item2 = scene.addRect(10, 10, 10, 10);
+ QCOMPARE(scene.items().size(), 2);
+
+ // Move from unindexed items into bsp tree.
+ QTest::qWait(50);
+ QCOMPARE(scene.items().size(), 2);
+
+ // Add untransformable item.
+ QGraphicsItem *item3 = new QGraphicsRectItem(QRectF(20, 20, 10, 10));
+ item3->setFlag(QGraphicsItem::ItemIgnoresTransformations);
+ scene.addItem(item3);
+ QCOMPARE(scene.items().size(), 3);
+
+ // Move from unindexed items into untransformable items.
+ QTest::qWait(50);
+ QCOMPARE(scene.items().size(), 3);
+
+ // Move from untransformable items into unindexed items.
+ item3->setFlag(QGraphicsItem::ItemIgnoresTransformations, false);
+ QCOMPARE(scene.items().size(), 3);
+ QTest::qWait(50);
+ QCOMPARE(scene.items().size(), 3);
+
+ // Make all items untransformable.
+ item1->setFlag(QGraphicsItem::ItemIgnoresTransformations);
+ item2->setParentItem(item1);
+ item3->setParentItem(item2);
+ QCOMPARE(scene.items().size(), 3);
+
+ // Move from unindexed items into untransformable items.
+ QTest::qWait(50);
+ QCOMPARE(scene.items().size(), 3);
+}
+
+QTEST_MAIN(tst_QGraphicsSceneIndex)
+#include "tst_qgraphicssceneindex.moc"
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 8b4ca4c..9a5089b 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -64,6 +64,7 @@
#include <QtGui/QStyle>
#include <QtGui/QPushButton>
#include <QtGui/QInputContext>
+#include <private/qgraphicsview_p.h>
//TESTED_CLASS=
//TESTED_FILES=
@@ -176,6 +177,7 @@ private slots:
void transformationAnchor();
void resizeAnchor();
void viewportUpdateMode();
+ void viewportUpdateMode2();
void acceptDrops();
void optimizationFlags();
void optimizationFlags_dontSavePainterState();
@@ -196,6 +198,8 @@ private slots:
void mouseTracking2();
void render();
void exposeRegion();
+ void update_data();
+ void update();
void inputMethodSensitivity();
void inputContextReset();
@@ -374,6 +378,7 @@ void tst_QGraphicsView::interactive()
QCOMPARE(item->events.size(), 0);
QPoint itemPoint = view.mapFromScene(item->scenePos());
+
QVERIFY(view.itemAt(itemPoint));
for (int i = 0; i < 100; ++i) {
@@ -2109,12 +2114,12 @@ void tst_QGraphicsView::resizeAnchor()
view.setResizeAnchor(QGraphicsView::AnchorViewCenter);
}
view.centerOn(0, 0);
- QTest::qWait(100);
+ QTest::qWait(250);
QPointF f = view.mapToScene(50, 50);
QPointF center = view.mapToScene(view.viewport()->rect().center());
- QTest::qWait(100);
+ QTest::qWait(250);
for (int size = 200; size <= 400; size += 25) {
view.resize(size, size);
@@ -2129,7 +2134,7 @@ void tst_QGraphicsView::resizeAnchor()
QVERIFY(qAbs(newCenter.x() - center.x()) < slack);
QVERIFY(qAbs(newCenter.y() - center.y()) < slack);
}
- QTest::qWait(100);
+ QTest::qWait(250);
}
}
}
@@ -2231,6 +2236,52 @@ void tst_QGraphicsView::viewportUpdateMode()
QCOMPARE(view.lastUpdateRegions.size(), 0);
}
+void tst_QGraphicsView::viewportUpdateMode2()
+{
+ // Create a view with viewport rect equal to QRect(0, 0, 200, 200).
+ QGraphicsScene dummyScene;
+ CustomView view;
+ view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
+ view.setScene(&dummyScene);
+ int left, top, right, bottom;
+ view.getContentsMargins(&left, &top, &right, &bottom);
+ view.resize(200 + left + right, 200 + top + bottom);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(300);
+ const QRect viewportRect = view.viewport()->rect();
+ QCOMPARE(viewportRect, QRect(0, 0, 200, 200));
+ QGraphicsViewPrivate *viewPrivate = static_cast<QGraphicsViewPrivate *>(qt_widget_private(&view));
+
+ QRect boundingRect;
+ const QRect rect1(0, 0, 10, 10);
+ QVERIFY(viewPrivate->updateRect(rect1));
+ QVERIFY(!viewPrivate->fullUpdatePending);
+ boundingRect |= rect1;
+ QCOMPARE(viewPrivate->dirtyBoundingRect, boundingRect);
+
+ const QRect rect2(50, 50, 10, 10);
+ QVERIFY(viewPrivate->updateRect(rect2));
+ QVERIFY(!viewPrivate->fullUpdatePending);
+ boundingRect |= rect2;
+ QCOMPARE(viewPrivate->dirtyBoundingRect, boundingRect);
+
+ const QRect rect3(190, 190, 10, 10);
+ QVERIFY(viewPrivate->updateRect(rect3));
+ QVERIFY(viewPrivate->fullUpdatePending);
+ boundingRect |= rect3;
+ QCOMPARE(viewPrivate->dirtyBoundingRect, boundingRect);
+
+ view.lastUpdateRegions.clear();
+ viewPrivate->processPendingUpdates();
+ QTest::qWait(50);
+ QCOMPARE(view.lastUpdateRegions.size(), 1);
+ // Note that we adjust by 2 for antialiasing.
+ QCOMPARE(view.lastUpdateRegions.at(0), QRegion(boundingRect.adjusted(-2, -2, 2, 2) & viewportRect));
+}
+
void tst_QGraphicsView::acceptDrops()
{
QGraphicsView view;
@@ -2991,14 +3042,7 @@ void tst_QGraphicsView::embeddedViews()
v2->QWidget::render(&actual);
QTransform b = item->transform;
-#ifdef Q_WS_MAC
- // We don't use shared painter on the Mac, so the
- // transform should be exactly the same.
QVERIFY(a == b);
-#else
- QVERIFY(a != b);
-#endif
-
delete v1;
}
@@ -3095,7 +3139,7 @@ void tst_QGraphicsView::moveItemWhileScrolling()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
- QTest::qWait(100);
+ QTest::qWait(200);
view.lastPaintedRegion = QRegion();
view.horizontalScrollBar()->setValue(view.horizontalScrollBar()->value() + 10);
@@ -3267,7 +3311,9 @@ void tst_QGraphicsView::mouseTracking2()
EventSpy spy(&scene, QEvent::GraphicsSceneMouseMove);
QCOMPARE(spy.count(), 0);
- sendMouseMove(view.viewport(), view.viewport()->rect().center());
+ QMouseEvent event(QEvent::MouseMove,view.viewport()->rect().center(), Qt::NoButton,
+ Qt::MouseButtons(Qt::NoButton), 0);
+ QApplication::sendEvent(view.viewport(), &event);
QCOMPARE(spy.count(), 1);
}
@@ -3360,6 +3406,72 @@ void tst_QGraphicsView::exposeRegion()
QCOMPARE(item->paints, 0);
}
+void tst_QGraphicsView::update_data()
+{
+ // In view.viewport() coordinates. (viewport rect: QRect(0, 0, 200, 200))
+ QTest::addColumn<QRect>("updateRect");
+ QTest::newRow("empty") << QRect();
+ QTest::newRow("outside left") << QRect(-200, 0, 100, 100);
+ QTest::newRow("outside right") << QRect(400, 0 ,100, 100);
+ QTest::newRow("outside top") << QRect(0, -200, 100, 100);
+ QTest::newRow("outside bottom") << QRect(0, 400, 100, 100);
+ QTest::newRow("partially inside left") << QRect(-50, 0, 100, 100);
+ QTest::newRow("partially inside right") << QRect(-150, 0, 100, 100);
+ QTest::newRow("partially inside top") << QRect(0, -150, 100, 100);
+ QTest::newRow("partially inside bottom") << QRect(0, 150, 100, 100);
+ QTest::newRow("on topLeft edge") << QRect(-100, -100, 100, 100);
+ QTest::newRow("on topRight edge") << QRect(200, -100, 100, 100);
+ QTest::newRow("on bottomRight edge") << QRect(200, 200, 100, 100);
+ QTest::newRow("on bottomLeft edge") << QRect(-200, 200, 100, 100);
+ QTest::newRow("inside topLeft") << QRect(-99, -99, 100, 100);
+ QTest::newRow("inside topRight") << QRect(199, -99, 100, 100);
+ QTest::newRow("inside bottomRight") << QRect(199, 199, 100, 100);
+ QTest::newRow("inside bottomLeft") << QRect(-199, 199, 100, 100);
+ QTest::newRow("large1") << QRect(50, -100, 100, 400);
+ QTest::newRow("large2") << QRect(-100, 50, 400, 100);
+ QTest::newRow("large3") << QRect(-100, -100, 400, 400);
+ QTest::newRow("viewport rect") << QRect(0, 0, 200, 200);
+}
+
+void tst_QGraphicsView::update()
+{
+ QFETCH(QRect, updateRect);
+
+ // Create a view with viewport rect equal to QRect(0, 0, 200, 200).
+ QGraphicsScene dummyScene;
+ CustomView view;
+ view.setScene(&dummyScene);
+ int left, top, right, bottom;
+ view.getContentsMargins(&left, &top, &right, &bottom);
+ view.resize(200 + left + right, 200 + top + bottom);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(300);
+ const QRect viewportRect = view.viewport()->rect();
+ QCOMPARE(viewportRect, QRect(0, 0, 200, 200));
+
+ const bool intersects = updateRect.intersects(viewportRect);
+ QGraphicsViewPrivate *viewPrivate = static_cast<QGraphicsViewPrivate *>(qt_widget_private(&view));
+ QCOMPARE(viewPrivate->updateRect(updateRect), intersects);
+ QCOMPARE(viewPrivate->updateRegion(updateRect), intersects);
+
+ view.lastUpdateRegions.clear();
+ viewPrivate->processPendingUpdates();
+ QVERIFY(viewPrivate->dirtyRegion.isEmpty());
+ QVERIFY(viewPrivate->dirtyBoundingRect.isEmpty());
+ QTest::qWait(50);
+ if (!intersects) {
+ QVERIFY(view.lastUpdateRegions.isEmpty());
+ } else {
+ QCOMPARE(view.lastUpdateRegions.size(), 1);
+ // Note that we adjust by 2 for antialiasing.
+ QCOMPARE(view.lastUpdateRegions.at(0), QRegion(updateRect.adjusted(-2, -2, 2, 2) & viewportRect));
+ }
+ QVERIFY(!viewPrivate->fullUpdatePending);
+}
+
void tst_QGraphicsView::inputMethodSensitivity()
{
QGraphicsScene scene;
diff --git a/tests/auto/qhelpgenerator/data/test.qhp b/tests/auto/qhelpgenerator/data/test.qhp
index e9ac7f2..a97c00d 100644
--- a/tests/auto/qhelpgenerator/data/test.qhp
+++ b/tests/auto/qhelpgenerator/data/test.qhp
@@ -38,9 +38,8 @@
</keywords>
<files>
<file>classic.css</file>
- <file>test.html</file>
- <file>people.html</file>
- <file>./sub/about.html</file>
+ <file>[pt]*.html</file>
+ <file>./sub/abou?.html</file>
</files>
</filterSection>
<filterSection>
@@ -69,4 +68,4 @@
<file>cars.html</file>
</files>
</filterSection>
-</QtHelpProject> \ No newline at end of file
+</QtHelpProject>
diff --git a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro
index 3283873..e19d962 100644
--- a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro
+++ b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro
@@ -2,4 +2,6 @@ load(qttest_p4)
SOURCES += tst_qhttpnetworkconnection.cpp
INCLUDEPATH += $$(QTDIR)/src/3rdparty/zlib
+requires(contains(QT_CONFIG,private_tests))
+
QT = core network
diff --git a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro b/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro
index 2e41fcd..f86250a 100644
--- a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro
+++ b/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro
@@ -2,4 +2,6 @@ load(qttest_p4)
SOURCES += tst_qhttpnetworkreply.cpp
INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/zlib
+requires(contains(QT_CONFIG,private_tests))
+
QT = core network
diff --git a/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp b/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp
index d9a7d56..e235ff5 100644
--- a/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp
+++ b/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp
@@ -59,13 +59,13 @@ void tst_QItemEditorFactory::createEditor()
QCOMPARE(w->metaObject()->className(), "QExpandingLineEdit");
}
-void tst_QItemEditorFactory::createCustomEditor()
+//we make it inherit from QObject so that we can use QPointer
+class MyEditor : public QObject, public QStandardItemEditorCreator<QDoubleSpinBox>
{
- //we make it inherit from QObject so that we can use QPointer
- class MyEditor : public QObject, public QStandardItemEditorCreator<QDoubleSpinBox>
- {
- };
+};
+void tst_QItemEditorFactory::createCustomEditor()
+{
QPointer<MyEditor> creator = new MyEditor;
QPointer<MyEditor> creator2 = new MyEditor;
diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/qkeysequence/tst_qkeysequence.cpp
index aeb57ef..2e4b850 100644
--- a/tests/auto/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/qkeysequence/tst_qkeysequence.cpp
@@ -270,7 +270,7 @@ void tst_QKeySequence::checkMultipleNames()
void tst_QKeySequence::ensureSorted()
{
//### accessing static members from private classes does not work on msvc at the moment
-#ifndef Q_WS_WIN
+#if defined(QT_BUILD_INTERNAL) && !defined(Q_WS_WIN)
uint N = QKeySequencePrivate::numberOfKeyBindings;
uint val = QKeySequencePrivate::keyBindings[0].shortcut;
for ( uint i = 1 ; i < N ; ++i) {
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 3519afa..7fc8316 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -3025,11 +3025,11 @@ void tst_QLineEdit::charWithAltOrCtrlModifier()
QTest::keyPress(testWidget, Qt::Key_Plus);
QCOMPARE(testWidget->text(), QString("+"));
QTest::keyPress(testWidget, Qt::Key_Plus, Qt::ControlModifier);
- QCOMPARE(testWidget->text(), QString("++"));
+ QCOMPARE(testWidget->text(), QString("+"));
QTest::keyPress(testWidget, Qt::Key_Plus, Qt::AltModifier);
- QCOMPARE(testWidget->text(), QString("+++"));
+ QCOMPARE(testWidget->text(), QString("+"));
QTest::keyPress(testWidget, Qt::Key_Plus, Qt::AltModifier | Qt::ControlModifier);
- QCOMPARE(testWidget->text(), QString("++++"));
+ QCOMPARE(testWidget->text(), QString("+"));
}
void tst_QLineEdit::leftKeyOnSelectedText()
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
index 4f1eb1d..a41eecd 100644
--- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
@@ -80,6 +80,8 @@ private slots:
void sendData_data();
void sendData();
+ void readBufferOverflow();
+
void fullPath();
void hitMaximumConnections_data();
@@ -102,6 +104,7 @@ private slots:
void recycleServer();
void multiConnect();
+ void writeOnlySocket();
void debug();
@@ -531,6 +534,37 @@ void tst_QLocalSocket::sendData()
QCOMPARE(spy.count(), (canListen ? 1 : 0));
}
+void tst_QLocalSocket::readBufferOverflow()
+{
+ const int readBufferSize = 128;
+ const int dataBufferSize = readBufferSize * 2;
+ const QString serverName = QLatin1String("myPreciousTestServer");
+ LocalServer server;
+ server.listen(serverName);
+ QVERIFY(server.isListening());
+
+ LocalSocket client;
+ client.setReadBufferSize(readBufferSize);
+ client.connectToServer(serverName);
+
+ bool timedOut = true;
+ QVERIFY(server.waitForNewConnection(3000, &timedOut));
+ QVERIFY(!timedOut);
+
+ QCOMPARE(client.state(), QLocalSocket::ConnectedState);
+ QVERIFY(server.hasPendingConnections());
+
+ QLocalSocket* serverSocket = server.nextPendingConnection();
+ char* buffer = (char*)qMalloc(dataBufferSize);
+ memset(buffer, 0, dataBufferSize);
+ serverSocket->write(buffer, dataBufferSize);
+ serverSocket->flush();
+ qFree(buffer);
+
+ QVERIFY(client.waitForReadyRead());
+ QCOMPARE(client.readAll().size(), dataBufferSize);
+}
+
// QLocalSocket/Server can take a name or path, check that it works as expected
void tst_QLocalSocket::fullPath()
{
@@ -873,6 +907,22 @@ void tst_QLocalSocket::multiConnect()
QVERIFY(server.nextPendingConnection() != 0);
}
+void tst_QLocalSocket::writeOnlySocket()
+{
+ QLocalServer server;
+ QVERIFY(server.listen("writeOnlySocket"));
+
+ QLocalSocket client;
+ client.connectToServer("writeOnlySocket", QIODevice::WriteOnly);
+ QVERIFY(client.waitForConnected());
+
+ QVERIFY(server.waitForNewConnection());
+ QLocalSocket* serverSocket = server.nextPendingConnection();
+
+ QCOMPARE(client.bytesAvailable(), qint64(0));
+ QCOMPARE(client.state(), QLocalSocket::ConnectedState);
+}
+
void tst_QLocalSocket::debug()
{
// Make sure this compiles
diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp
index e46c2e1..6ae7a3e 100644
--- a/tests/auto/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp
@@ -1400,6 +1400,7 @@ void AddDockWidget::apply(QMainWindow *mw) const
}
}
+#ifdef QT_BUILD_INTERNAL
struct MoveSeparator
{
MoveSeparator() {}
@@ -1436,6 +1437,7 @@ void MoveSeparator::apply(QMainWindow *mw) const
l->layoutState.dockAreaLayout.separatorMove(path, QPoint(0, 0), QPoint(delta, delta));
}
+#endif
QMap<QString, QRect> dockWidgetGeometries(QMainWindow *mw)
{
@@ -1463,6 +1465,7 @@ QMap<QString, QRect> dockWidgetGeometries(QMainWindow *mw)
void tst_QMainWindow::saveRestore_data()
{
+#ifdef QT_BUILD_INTERNAL
QTest::addColumn<AddList >("addList");
QTest::addColumn<MoveList >("moveList");
@@ -1497,10 +1500,12 @@ void tst_QMainWindow::saveRestore_data()
<< MoveSeparator(-30, "right1")
<< MoveSeparator(30, "right2a")
);
+#endif
}
void tst_QMainWindow::saveRestore()
{
+#ifdef QT_BUILD_INTERNAL
QFETCH(AddList, addList);
QFETCH(MoveList, moveList);
@@ -1570,6 +1575,7 @@ void tst_QMainWindow::saveRestore()
mainWindow.show();
COMPARE_DOCK_WIDGET_GEOS(dockWidgetGeos, dockWidgetGeometries(&mainWindow));
}
+#endif
}
void tst_QMainWindow::iconSizeChanged()
diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp
index 500465c..1245de1 100644
--- a/tests/auto/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/qmenubar/tst_qmenubar.cpp
@@ -1576,8 +1576,9 @@ void tst_QMenuBar::menubarSizeHint()
return 11;
case PM_MenuBarPanelWidth:
return 1;
+ default:
+ return QWindowsStyle::pixelMetric(metric, option, widget);
}
- return QWindowsStyle::pixelMetric(metric, option, widget);
}
} style;
diff --git a/tests/auto/qnativesocketengine/qnativesocketengine.pro b/tests/auto/qnativesocketengine/qnativesocketengine.pro
index 320f24c..ad40d53 100644
--- a/tests/auto/qnativesocketengine/qnativesocketengine.pro
+++ b/tests/auto/qnativesocketengine/qnativesocketengine.pro
@@ -3,6 +3,8 @@ SOURCES += tst_qnativesocketengine.cpp
include(../qnativesocketengine/qsocketengine.pri)
+requires(contains(QT_CONFIG,private_tests))
+
MOC_DIR=tmp
QT = core network
diff --git a/tests/auto/qnetworkreply/qnetworkreply.pro b/tests/auto/qnetworkreply/qnetworkreply.pro
index 0bcf067..fd8454c 100644
--- a/tests/auto/qnetworkreply/qnetworkreply.pro
+++ b/tests/auto/qnetworkreply/qnetworkreply.pro
@@ -1,4 +1,6 @@
TEMPLATE = subdirs
SUBDIRS = test
+requires(contains(QT_CONFIG,private_tests))
+
!wince*:SUBDIRS += echo
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 89e850c..f2bfb1f 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -245,6 +245,8 @@ private Q_SLOTS:
void authorizationError();
void httpConnectionCount();
+ void httpDownloadPerformance_data();
+ void httpDownloadPerformance();
};
QT_BEGIN_NAMESPACE
@@ -1001,6 +1003,7 @@ void tst_QNetworkReply::stateChecking()
QCOMPARE(reply->request(), req);
QCOMPARE(int(reply->operation()), int(QNetworkAccessManager::GetOperation));
QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QCOMPARE(reply->isFinished(), false);
QCOMPARE(reply->url(), url);
reply->abort();
@@ -1322,6 +1325,9 @@ void tst_QNetworkReply::getErrors()
QTEST(reply->readAll().isEmpty(), "dataIsEmpty");
+ QVERIFY(reply->isFinished());
+ QVERIFY(!reply->isRunning());
+
QFETCH(int, httpStatusCode);
if (httpStatusCode != 0) {
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), httpStatusCode);
@@ -3183,7 +3189,7 @@ void tst_QNetworkReply::httpUploadPerformance()
QVERIFY(!QTestEventLoop::instance().timeout());
qint64 elapsed = time.elapsed();
- qWarning() << "tst_QNetworkReply::httpUploadPerformance" << elapsed << "msec, "
+ qDebug() << "tst_QNetworkReply::httpUploadPerformance" << elapsed << "msec, "
<< ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec";
reader.exit();
@@ -3235,6 +3241,8 @@ void tst_QNetworkReply::downloadProgress()
connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
&QTestEventLoop::instance(), SLOT(exitLoop()));
QVERIFY(spy.isValid());
+ QVERIFY(!reply->isFinished());
+ QVERIFY(reply->isRunning());
QCoreApplication::instance()->processEvents();
if (!server.hasPendingConnections())
@@ -3255,6 +3263,8 @@ void tst_QNetworkReply::downloadProgress()
QTestEventLoop::instance().enterLoop(2);
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(spy.count() > 0);
+ QVERIFY(!reply->isFinished());
+ QVERIFY(reply->isRunning());
QList<QVariant> args = spy.last();
QCOMPARE(args.at(0).toInt(), i*data.size());
@@ -3268,6 +3278,8 @@ void tst_QNetworkReply::downloadProgress()
QTestEventLoop::instance().enterLoop(2);
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(spy.count() > 0);
+ QVERIFY(!reply->isRunning());
+ QVERIFY(reply->isFinished());
QList<QVariant> args = spy.last();
QCOMPARE(args.at(0).toInt(), loopCount * data.size());
@@ -3696,5 +3708,128 @@ void tst_QNetworkReply::httpConnectionCount()
QCOMPARE(pendingConnectionCount, 6);
}
+class HttpDownloadPerformanceClient : QObject {
+ Q_OBJECT;
+ QIODevice *device;
+ public:
+ HttpDownloadPerformanceClient (QIODevice *dev) : device(dev){
+ connect(dev, SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
+ }
+
+ public slots:
+ void readyReadSlot() {
+ device->readAll();
+ }
+
+};
+
+class HttpDownloadPerformanceServer : QObject {
+ Q_OBJECT;
+ qint64 dataSize;
+ qint64 dataSent;
+ QTcpServer server;
+ QTcpSocket *client;
+ bool serverSendsContentLength;
+ bool chunkedEncoding;
+
+public:
+ HttpDownloadPerformanceServer (qint64 ds, bool sscl, bool ce) : dataSize(ds), dataSent(0),
+ client(0), serverSendsContentLength(sscl), chunkedEncoding(ce) {
+ server.listen();
+ connect(&server, SIGNAL(newConnection()), this, SLOT(newConnectionSlot()));
+ }
+
+ int serverPort() {
+ return server.serverPort();
+ }
+
+public slots:
+
+ void newConnectionSlot() {
+ client = server.nextPendingConnection();
+ client->setParent(this);
+ connect(client, SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
+ connect(client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot(qint64)));
+ }
+
+ void readyReadSlot() {
+ client->readAll();
+ client->write("HTTP/1.0 200 OK\n");
+ if (serverSendsContentLength)
+ client->write(QString("Content-Length: " + QString::number(dataSize) + "\n").toAscii());
+ if (chunkedEncoding)
+ client->write(QString("Transfer-Encoding: chunked\n").toAscii());
+ client->write("Connection: close\n\n");
+ }
+
+ void bytesWrittenSlot(qint64 amount) {
+ if (dataSent == dataSize && client) {
+ // close eventually
+
+ // chunked encoding: we have to send a last "empty" chunk
+ if (chunkedEncoding)
+ client->write(QString("0\r\n\r\n").toAscii());
+
+ client->disconnectFromHost();
+ server.close();
+ client = 0;
+ return;
+ }
+
+ // send data
+ if (client && client->bytesToWrite() < 100*1024 && dataSent < dataSize) {
+ qint64 amount = qMin(qint64(16*1024), dataSize - dataSent);
+ QByteArray data(amount, '@');
+
+ if (chunkedEncoding) {
+ client->write(QString(QString("%1").arg(amount,0,16).toUpper() + "\r\n").toAscii());
+ client->write(data.constData(), amount);
+ client->write(QString("\r\n").toAscii());
+ } else {
+ client->write(data.constData(), amount);
+ }
+
+ dataSent += amount;
+ }
+ }
+};
+
+void tst_QNetworkReply::httpDownloadPerformance_data()
+{
+ QTest::addColumn<bool>("serverSendsContentLength");
+ QTest::addColumn<bool>("chunkedEncoding");
+
+ QTest::newRow("Server sends no Content-Length") << false << false;
+ QTest::newRow("Server sends Content-Length") << true << false;
+ QTest::newRow("Server uses chunked encoding") << false << true;
+
+}
+
+void tst_QNetworkReply::httpDownloadPerformance()
+{
+ QFETCH(bool, serverSendsContentLength);
+ QFETCH(bool, chunkedEncoding);
+
+ enum {UploadSize = 1000*1024*1024}; // 1000 MB
+ HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding);
+
+ QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1"));
+ QNetworkReply* reply = manager.get(request);
+
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
+ HttpDownloadPerformanceClient client(reply);
+
+ QTime time;
+ time.start();
+ QTestEventLoop::instance().enterLoop(40);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ qint64 elapsed = time.elapsed();
+ qDebug() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, "
+ << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec";
+
+ delete reply;
+}
+
QTEST_MAIN(tst_QNetworkReply)
#include "tst_qnetworkreply.moc"
diff --git a/tests/auto/qpathclipper/qpathclipper.pro b/tests/auto/qpathclipper/qpathclipper.pro
index 675e463..dc9d60f 100644
--- a/tests/auto/qpathclipper/qpathclipper.pro
+++ b/tests/auto/qpathclipper/qpathclipper.pro
@@ -3,6 +3,8 @@ INCLUDEPATH += .
HEADERS += paths.h
SOURCES += tst_qpathclipper.cpp paths.cpp
+requires(contains(QT_CONFIG,private_tests))
+
unix:!mac:LIBS+=-lm
diff --git a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
index fceefd2..40ad539 100644
--- a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
+++ b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
@@ -1106,6 +1106,7 @@ void tst_QPlainTextEdit::mimeDataReimplementations()
QCOMPARE(ed.canInsertCallCount, 0);
QCOMPARE(ed.insertCallCount, 0);
+#ifdef QT_BUILD_INTERNAL
QTextControl *control = qFindChild<QTextControl *>(&ed);
QVERIFY(control);
@@ -1120,6 +1121,7 @@ void tst_QPlainTextEdit::mimeDataReimplementations()
QCOMPARE(ed.createMimeDataCallCount, 1);
QCOMPARE(ed.canInsertCallCount, 1);
QCOMPARE(ed.insertCallCount, 1);
+#endif
}
void tst_QPlainTextEdit::shiftEnterShouldInsertLineSeparator()
diff --git a/tests/auto/qregion/tst_qregion.cpp b/tests/auto/qregion/tst_qregion.cpp
index 3ffa87e..2ad202d 100644
--- a/tests/auto/qregion/tst_qregion.cpp
+++ b/tests/auto/qregion/tst_qregion.cpp
@@ -96,7 +96,7 @@ private slots:
#ifdef Q_OS_WIN
void handle();
#endif
-#ifdef Q_WS_X11
+#if defined(Q_WS_X11) && defined(QT_BUILD_INTERNAL)
void clipRectangles();
#endif
@@ -865,7 +865,7 @@ void tst_QRegion::handle()
}
#endif
-#ifdef Q_WS_X11
+#if defined(Q_WS_X11) && defined(QT_BUILD_INTERNAL)
void tst_QRegion::clipRectangles()
{
QRegion region(30, 30, 30, 30);
@@ -967,6 +967,7 @@ void tst_QRegion::regionToPath_data()
void tst_QRegion::regionToPath()
{
+#ifdef QT_BUILD_INTERNAL
extern QPainterPath qt_regionToPath(const QRegion &region);
QFETCH(QPainterPath, path);
@@ -1002,6 +1003,7 @@ void tst_QRegion::regionToPath()
QCOMPARE(ia, ib);
QCOMPARE(a.boundingRect(), b.boundingRect());
}
+#endif
}
QTEST_MAIN(tst_QRegion)
diff --git a/tests/auto/qscriptengine/script/com/__init__.js b/tests/auto/qscriptengine/script/com/__init__.js
index 381816a..7db3ee4 100644
--- a/tests/auto/qscriptengine/script/com/__init__.js
+++ b/tests/auto/qscriptengine/script/com/__init__.js
@@ -3,3 +3,7 @@ __setupPackage__("com");
com.wasDefinedAlready = wasDefinedAlready;
com.name = __extension__;
com.level = 1;
+
+com.postInitCallCount = 0;
+com.originalPostInit = __postInit__;
+__postInit__ = function() { ++com.postInitCallCount; };
diff --git a/tests/auto/qscriptengine/script/com/trolltech/__init__.js b/tests/auto/qscriptengine/script/com/trolltech/__init__.js
index f12b17d..a55b132 100644
--- a/tests/auto/qscriptengine/script/com/trolltech/__init__.js
+++ b/tests/auto/qscriptengine/script/com/trolltech/__init__.js
@@ -3,3 +3,7 @@ __setupPackage__("com.trolltech");
com.trolltech.wasDefinedAlready = wasDefinedAlready;
com.trolltech.name = __extension__;
com.trolltech.level = com.level + 1;
+
+com.trolltech.postInitCallCount = 0;
+com.trolltech.originalPostInit = __postInit__;
+__postInit__ = function() { ++com.trolltech.postInitCallCount; };
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index c17454d..57c5167 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -1583,6 +1583,7 @@ void tst_QScriptEngine::importExtension()
QScriptValue ret = eng.importExtension("this.extension.does.not.exist");
QCOMPARE(eng.hasUncaughtException(), true);
QCOMPARE(ret.isError(), true);
+ QCOMPARE(ret.toString(), QString::fromLatin1("Error: Unable to import this.extension.does.not.exist: no such extension"));
}
{
@@ -1601,6 +1602,8 @@ void tst_QScriptEngine::importExtension()
.strictlyEquals(QScriptValue(&eng, "com")), true);
QCOMPARE(com.property("level")
.strictlyEquals(QScriptValue(&eng, 1)), true);
+ QVERIFY(com.property("originalPostInit").isUndefined());
+ QVERIFY(com.property("postInitCallCount").strictlyEquals(1));
QScriptValue trolltech = com.property("trolltech");
QCOMPARE(trolltech.isObject(), true);
@@ -1610,6 +1613,8 @@ void tst_QScriptEngine::importExtension()
.strictlyEquals(QScriptValue(&eng, "com.trolltech")), true);
QCOMPARE(trolltech.property("level")
.strictlyEquals(QScriptValue(&eng, 2)), true);
+ QVERIFY(trolltech.property("originalPostInit").isUndefined());
+ QVERIFY(trolltech.property("postInitCallCount").strictlyEquals(1));
}
QStringList imp = eng.importedExtensions();
QCOMPARE(imp.size(), 2);
@@ -1625,6 +1630,8 @@ void tst_QScriptEngine::importExtension()
eng.globalObject().setProperty("__import__", eng.newFunction(__import__));
QScriptValue ret = eng.importExtension("com.trolltech.recursive");
QCOMPARE(eng.hasUncaughtException(), true);
+ QVERIFY(ret.isError());
+ QCOMPARE(ret.toString(), QString::fromLatin1("Error: recursive import of com.trolltech.recursive"));
QStringList imp = eng.importedExtensions();
QCOMPARE(imp.size(), 2);
QCOMPARE(imp.at(0), QString::fromLatin1("com"));
diff --git a/tests/auto/qsettings/tst_qsettings.cpp b/tests/auto/qsettings/tst_qsettings.cpp
index f0f446d..77fef1f 100644
--- a/tests/auto/qsettings/tst_qsettings.cpp
+++ b/tests/auto/qsettings/tst_qsettings.cpp
@@ -713,6 +713,7 @@ void tst_QSettings::testErrorHandling_data()
void tst_QSettings::testErrorHandling()
{
+#ifdef QT_BUILD_INTERNAL
#ifdef Q_OS_WIN
QSKIP("Windows doesn't support most file modes, including read-only directories, so this test is moot.", SkipAll);
#else
@@ -776,6 +777,7 @@ void tst_QSettings::testErrorHandling()
QCOMPARE((int)settings.status(), statusAfterSetAndSync);
}
#endif // !Q_OS_WIN
+#endif
}
Q_DECLARE_METATYPE(QVariant)
@@ -821,6 +823,7 @@ void tst_QSettings::testIniParsing_data()
void tst_QSettings::testIniParsing()
{
+#ifdef QT_BUILD_INTERNAL
qRegisterMetaType<QVariant>("QVariant");
qRegisterMetaType<QSettings::Status>("QSettings::Status");
@@ -854,6 +857,7 @@ void tst_QSettings::testIniParsing()
}
QCOMPARE(settings.status(), status);
+#endif
}
/*
@@ -1058,6 +1062,7 @@ void tst_QSettings::testVariantTypes_data()
void tst_QSettings::testVariantTypes()
{
+#ifdef QT_BUILD_INTERNAL
#define testVal(key, val, tp, rtype) \
{ \
QSettings settings1(format, QSettings::UserScope, "software.org", "KillerAPP"); \
@@ -1141,6 +1146,7 @@ void tst_QSettings::testVariantTypes()
}
#undef testVal
+#endif
}
void tst_QSettings::remove()
@@ -1801,9 +1807,7 @@ void tst_QSettings::testNormalizedKey_data()
void tst_QSettings::testNormalizedKey()
{
-#ifdef QTEST_REDUCED_EXPORTS
- QSKIP("We can't test QSettingsPrivate on Windows", SkipAll);
-#else
+#ifdef QT_BUILD_INTERNAL
QFETCH(QString, inKey);
QFETCH(QString, outKey);
@@ -1981,6 +1985,7 @@ void tst_QSettings::fromFile()
void tst_QSettings::setIniCodec()
{
+#ifdef QT_BUILD_INTERNAL
QByteArray expeContents4, expeContents5;
QByteArray actualContents4, actualContents5;
@@ -2040,6 +2045,7 @@ void tst_QSettings::setIniCodec()
QCOMPARE(settings4.allKeys().first(), settings5.allKeys().first());
QCOMPARE(settings4.value(settings4.allKeys().first()).toString(),
settings5.value(settings5.allKeys().first()).toString());
+#endif
}
static bool containsSubList(QStringList mom, QStringList son)
@@ -2316,6 +2322,7 @@ void tst_QSettings::testArrays()
settings1.endArray();
}
+#ifdef QT_BUILD_INTERNAL
static QByteArray iniEscapedKey(const QString &str)
{
QByteArray result;
@@ -2360,6 +2367,7 @@ static QStringList iniUnescapedStringList(const QByteArray &ba)
#endif
return result;
}
+#endif
QString escapeWeirdChars(const QString &s)
{
@@ -2383,6 +2391,7 @@ QString escapeWeirdChars(const QString &s)
void tst_QSettings::testEscapes()
{
+#ifdef QT_BUILD_INTERNAL
QSettings settings(QSettings::UserScope, "software.org", "KillerAPP");
#define testEscapedKey(plainKey, escKey) \
@@ -2505,6 +2514,7 @@ void tst_QSettings::testEscapes()
testBadEscape("@Rect)", "@Rect)");
testBadEscape("@Rect(1 2 3)", "@Rect(1 2 3)");
testBadEscape("@@Rect(1 2 3)", "@Rect(1 2 3)");
+#endif
}
void tst_QSettings::testCompatFunctions()
@@ -3355,6 +3365,7 @@ void tst_QSettings::childGroups_data()
void tst_QSettings::childGroups()
{
+#ifdef QT_BUILD_INTERNAL
QFETCH(QSettings::Format, format);
{
@@ -3408,6 +3419,7 @@ void tst_QSettings::childGroups()
QCOMPARE(settings.childGroups(), QStringList() << "alpha" << "gamma" << "omicron" << "zeta");
}
+#endif
}
void tst_QSettings::childKeys_data()
@@ -3417,6 +3429,7 @@ void tst_QSettings::childKeys_data()
void tst_QSettings::childKeys()
{
+#ifdef QT_BUILD_INTERNAL
QFETCH(QSettings::Format, format);
{
@@ -3470,6 +3483,7 @@ void tst_QSettings::childKeys()
QCOMPARE(settings.childKeys(), QStringList() << "alpha" << "beta" << "gamma");
}
+#endif
}
void tst_QSettings::allKeys_data()
@@ -3479,6 +3493,7 @@ void tst_QSettings::allKeys_data()
void tst_QSettings::allKeys()
{
+#ifdef QT_BUILD_INTERNAL
QFETCH(QSettings::Format, format);
QStringList allKeys;
@@ -3527,6 +3542,7 @@ void tst_QSettings::allKeys()
QCOMPARE(settings.allKeys(), allKeys);
}
+#endif
}
void tst_QSettings::registerFormat()
diff --git a/tests/auto/qsharedpointer/qsharedpointer.pro b/tests/auto/qsharedpointer/qsharedpointer.pro