summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@trolltech.com>2009-07-15 12:30:21 +0200
committerPeter Hartmann <peter.hartmann@trolltech.com>2009-07-15 12:30:21 +0200
commit97f82b2344334fa158f20e4ed059984fd3c43162 (patch)
tree05a38900c0409a904f45ad35b7447baef13623ed /tests
parent2567ec486d5d95dc4ca06874cf75bf03bd7502b9 (diff)
parent28d0930593c6c04a7ef538353f8bee55df00a0e8 (diff)
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro1
-rwxr-xr-xtests/auto/linguist/lconvert/data/makeplurals.pl42
-rwxr-xr-xtests/auto/linguist/lconvert/data/makeplurals.sh43
-rw-r--r--tests/auto/linguist/lconvert/tst_lconvert.cpp11
-rw-r--r--tests/auto/linguist/lrelease/tst_lrelease.cpp29
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp12
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result18
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp9
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp9
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro10
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result31
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp9
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp9
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui2
-rw-r--r--tests/auto/linguist/lupdate/testlupdate.cpp5
-rw-r--r--tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp35
-rw-r--r--tests/auto/math3d/qquaternion/tst_qquaternion.cpp4
-rw-r--r--tests/auto/math3d/qvectornd/tst_qvectornd.cpp4
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp17
-rw-r--r--tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp35
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp7
-rw-r--r--tests/auto/qapplication/tst_qapplication.cpp68
-rw-r--r--tests/auto/qchar/tst_qchar.cpp3
-rw-r--r--tests/auto/qcolumnview/tst_qcolumnview.cpp42
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp6
-rw-r--r--tests/auto/qcompleter/tst_qcompleter.cpp81
-rw-r--r--tests/auto/qcssparser/qcssparser.pro1
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp39
-rw-r--r--tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp2
-rw-r--r--tests/auto/qflags/tst_qflags.cpp24
-rw-r--r--tests/auto/qfontcombobox/tst_qfontcombobox.cpp6
-rw-r--r--tests/auto/qfontdialog/tst_qfontdialog.cpp10
-rw-r--r--tests/auto/qgl/qgl.pro3
-rw-r--r--tests/auto/qgl/tst_qgl.cpp23
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp272
-rw-r--r--tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp1
-rw-r--r--tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp41
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp65
-rw-r--r--tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro3
-rw-r--r--tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp271
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp136
-rw-r--r--tests/auto/qhelpgenerator/data/test.qhp7
-rw-r--r--tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro2
-rw-r--r--tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro2
-rw-r--r--tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp10
-rw-r--r--tests/auto/qkeysequence/tst_qkeysequence.cpp2
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp6
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp50
-rw-r--r--tests/auto/qmainwindow/tst_qmainwindow.cpp6
-rw-r--r--tests/auto/qmenubar/tst_qmenubar.cpp3
-rw-r--r--tests/auto/qnativesocketengine/qnativesocketengine.pro2
-rw-r--r--tests/auto/qnetworkreply/qnetworkreply.pro2
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp137
-rw-r--r--tests/auto/qpathclipper/qpathclipper.pro2
-rw-r--r--tests/auto/qplaintextedit/tst_qplaintextedit.cpp2
-rw-r--r--tests/auto/qregion/tst_qregion.cpp6
-rw-r--r--tests/auto/qscriptengine/script/com/__init__.js4
-rw-r--r--tests/auto/qscriptengine/script/com/trolltech/__init__.js4
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp7
-rw-r--r--tests/auto/qsettings/tst_qsettings.cpp22
-rw-r--r--tests/auto/qsharedpointer/qsharedpointer.pro1
-rw-r--r--tests/auto/qsocketnotifier/qsocketnotifier.pro2
-rw-r--r--tests/auto/qsocks5socketengine/qsocks5socketengine.pro1
-rw-r--r--tests/auto/qsqldatabase/tst_databases.h25
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp40
-rw-r--r--tests/auto/qsqldriver/tst_qsqldriver.cpp4
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp42
-rw-r--r--tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp26
-rw-r--r--tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp62
-rw-r--r--tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp4
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp2
-rw-r--r--tests/auto/qstringbuilder/tst_qstringbuilder.cpp17
-rw-r--r--tests/auto/qstylesheetstyle/qstylesheetstyle.pro1
-rw-r--r--tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp156
-rw-r--r--tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp29
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp56
-rw-r--r--tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp10
-rw-r--r--tests/auto/qtextedit/tst_qtextedit.cpp4
-rw-r--r--tests/auto/qtextlist/tst_qtextlist.cpp76
-rw-r--r--tests/auto/qtextpiecetable/qtextpiecetable.pro5
-rw-r--r--tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp32
-rw-r--r--tests/auto/qurl/tst_qurl.cpp4
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp50
-rw-r--r--tests/auto/selftests/exceptionthrow/exceptionthrow.pro (renamed from tests/auto/selftests/exception/exception.pro)4
-rw-r--r--tests/auto/selftests/exceptionthrow/tst_exceptionthrow.cpp (renamed from tests/auto/selftests/exception/tst_exception.cpp)2
-rw-r--r--tests/auto/selftests/expected_exceptionthrow.txt (renamed from tests/auto/selftests/expected_exception.txt)0
-rw-r--r--tests/auto/selftests/expected_maxwarnings.txt4
-rw-r--r--tests/auto/selftests/selftests.pro2
-rw-r--r--tests/auto/selftests/selftests.qrc2
-rw-r--r--tests/auto/selftests/tst_selftests.cpp8
-rw-r--r--tests/auto/uiloader/baseline/css_scrollarea_base.ui197
-rw-r--r--tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro1
-rw-r--r--tests/auto/xmlpatternsview/xmlpatternsview.pro1
-rw-r--r--tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro3
-rw-r--r--tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro1
100 files changed, 2288 insertions, 312 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 79c98551ae..fa1956dacc 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -150,6 +150,7 @@ SUBDIRS += _networkselftest \
qgraphicspolygonitem \
qgraphicsproxywidget \
qgraphicsscene \
+ qgraphicssceneindex \
qgraphicsview \
qgraphicswidget \
qgridlayout \
diff --git a/tests/auto/linguist/lconvert/data/makeplurals.pl b/tests/auto/linguist/lconvert/data/makeplurals.pl
new file mode 100755
index 0000000000..19bffe020d
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/makeplurals.pl
@@ -0,0 +1,42 @@
+#! /usr/bin/env perl
+
+sub makeit2($$$)
+{
+ for (my $i = 0; $i < (1 << $_[0]); $i++) {
+ print OUTFILE "\n";
+ print OUTFILE "$_[2]\n" unless $3 eq "";
+ print OUTFILE "msgid \"singular $_[1] $i\"\n";
+ print OUTFILE "msgid_plural \"plural $_[1] $i\"\n";
+ for (my $j = 0; $j < $_[0]; $j++) {
+ my $tr;
+ if (($i & (1 << $j)) == 0) {
+ $tr = "translated $_[1] $i $j";
+ }
+ print OUTFILE "msgstr[$j] \"$tr\"\n";
+ }
+ }
+}
+
+sub makeit($$)
+{
+ open OUTFILE, ">${OUTDIR}plural-$_[0].po" || die "cannot write file in $OUTDIR";
+ print OUTFILE <<EOF;
+msgid ""
+msgstr ""
+"X-FooBar: yup\\n"
+"X-Language: $_[1]\\n"
+EOF
+ makeit2($_[0], "one", "");
+ makeit2($_[0], "two", "#, fuzzy
+#| msgid \"old untranslated one\"");
+ makeit2($_[0], "three", "#, fuzzy
+#| msgid \"old untranslated two\"
+#| msgid_plural \"old untranslated plural two\"");
+ makeit2($_[0], "four", "#, fuzzy
+#| msgid_plural \"old untranslated only plural three\"");
+}
+
+$OUTDIR = $ARGV[0];
+makeit(1, "zh_CN");
+makeit(2, "de_DE");
+makeit(3, "pl_PL");
diff --git a/tests/auto/linguist/lconvert/data/makeplurals.sh b/tests/auto/linguist/lconvert/data/makeplurals.sh
deleted file mode 100755
index 2e0f375486..0000000000
--- a/tests/auto/linguist/lconvert/data/makeplurals.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#! /bin/bash
-
-function makeit2()
-{
- for ((i = 0; i < (1 << $1); i++)); do
- echo
- test -n "$3" && echo "$3"
- echo "msgid \"singular $2 $i\""
- echo "msgid_plural \"plural $2 $i\""
- for ((j = 0; j < $1; j++)); do
- tr=
- if test $((i & (1 << j))) = 0; then
- tr="translated $2 $i $j"
- fi
- echo "msgstr[$j] \"$tr\""
- done
- done
-}
-
-function makeit()
-{
- {
- cat <<EOF
-msgid ""
-msgstr ""
-"X-FooBar: yup\n"
-"X-Language: $2\n"
-EOF
- makeit2 $1 one ""
- makeit2 $1 two "#, fuzzy
-#| msgid \"old untranslated one\""
- makeit2 $1 three "#, fuzzy
-#| msgid \"old untranslated two\"
-#| msgid_plural \"old untranslated plural two\""
- makeit2 $1 four "#, fuzzy
-#| msgid_plural \"old untranslated only plural three\""
- } > ${OUTDIR}plural-$1.po
-}
-
-OUTDIR=$1
-makeit 1 zh_CN
-makeit 2 de_DE
-makeit 3 pl_PL
diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp
index 40be55a214..1ed71ab2ee 100644
--- a/tests/auto/linguist/lconvert/tst_lconvert.cpp
+++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp
@@ -47,7 +47,7 @@ class tst_lconvert : public QObject
Q_OBJECT
public:
- tst_lconvert() : dataDir("data/") {}
+ tst_lconvert() : dataDir("data/"), binDir(QLibraryInfo::location(QLibraryInfo::BinariesPath)) {}
private slots:
void initTestCase();
@@ -73,12 +73,13 @@ private:
const QList<QStringList> &args);
QString dataDir;
+ QString binDir;
};
void tst_lconvert::initTestCase()
{
if (!QFile::exists(QLatin1String("data/plural-1.po")))
- QProcess::execute(QLatin1String("data/makeplurals.sh"), QStringList() << QLatin1String("data/"));
+ QProcess::execute(QLatin1String("perl"), QStringList() << QLatin1String("data/makeplurals.pl") << QLatin1String("data/"));
QVERIFY(QFile::exists(QLatin1String("data/plural-1.po")));
}
@@ -151,7 +152,7 @@ void tst_lconvert::doCompare(QIODevice *actualDev, const QString &expectedFn)
void tst_lconvert::verifyReadFail(const QString &fn)
{
QProcess cvt;
- cvt.start("lconvert", QStringList() << (dataDir + fn));
+ cvt.start(binDir + "/lconvert", QStringList() << (dataDir + fn));
QVERIFY(cvt.waitForFinished(1000));
QVERIFY(cvt.exitStatus() == QProcess::NormalExit);
QVERIFY2(cvt.exitCode() == 2, "Accepted invalid input");
@@ -178,7 +179,7 @@ void tst_lconvert::convertChain(const QString &_inFileName, const QString &_outF
if (!argList.isEmpty())
args += argList[i];
args << "-if" << stations[i] << "-i" << "-" << "-of" << stations[i + 1];
- cvts.at(i)->start("lconvert", args);
+ cvts.at(i)->start(binDir + "/lconvert", args);
}
int st = 0;
foreach (QProcess *cvt, cvts)
@@ -242,7 +243,7 @@ void tst_lconvert::converts()
QString outFileNameFq = dataDir + outFileName;
QProcess cvt;
- cvt.start("lconvert", QStringList() << "-i" << (dataDir + inFileName) << "-of" << format);
+ cvt.start(binDir + "/lconvert", QStringList() << "-i" << (dataDir + inFileName) << "-of" << format);
doWait(&cvt, 0);
if (QTest::currentTestFailed())
return;
diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp
index 512987d770..45e9d6b165 100644
--- a/tests/auto/linguist/lrelease/tst_lrelease.cpp
+++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp
@@ -49,16 +49,23 @@
class tst_lrelease : public QObject
{
Q_OBJECT
+
+public:
+ tst_lrelease() : binDir(QLibraryInfo::location(QLibraryInfo::BinariesPath)) {}
+
private:
private slots:
void translate();
void mixedcodecs();
void compressed();
+ void idbased();
void dupes();
private:
void doCompare(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 e297784818..076520ab31 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 d65110aef5..6bc565c1ee 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 0d0defd00f..a5f8e9f79e 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 9fb43fed74..735e4cda04 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 5bd75254cf..97d3bce668 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 0000000000..ad87e70b62
--- /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 0000000000..912963db70
--- /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 0000000000..820b4fab04
--- /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 0000000000..470d6eb7e0
--- /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 0000000000..a6079f93ef
--- /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 0000000000..807d2967db
--- /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 0000000000..6e5dd25c6f
--- /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 d65110aef5..6bc565c1ee 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 0d0defd00f..a5f8e9f79e 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 8abc2b01a0..04c03f1c90 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 7facf4ac82..d799c1b5c7 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 395032f389..16b87a101d 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 0eb5b07e35..9c1ea83f5f 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 fa786f1cc3..e4b1a55ecd 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 e976c1b52d..556e8500d1 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 8a88b599da..b8aec505d2 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 85494af333..853272341c 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 01ba53402f..512c180de8 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 0216e0f80f..0b3ba7a35d 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 c94ace0fcf..67c9ac9e17 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 baea419594..fb03e1a400 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 57d6804aab..723e4d3a13 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 e4fec1d4a8..50cab0e822 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 e415b022fd..d49083f3e5 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 a5f68dc8aa..87d825890d 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 62bfdf7a36..e2515aec73 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 1444ee02a8..cbdd4402aa 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 55e329d7ad..420c4bbe8d 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 078c5596ab..96f5ddd297 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 7552f18b46..3f41a9068f 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 536c75084e..bca673fbb2 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 dbc433914d..1d0663a587 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 d325f0f5d3..f7ea4cecc8 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 0000000000..740a23e96d
--- /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 0000000000..3ce5b169b9
--- /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 8b4ca4c65e..9a5089bd8f 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 e9ac7f2134..a97c00d653 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 3283873062..e19d9624a5 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 2e41fcd9cd..f86250a632 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 d9a7d56f4a..e235ff517e 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 aeb57ef589..2e4b85063e 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 3519afa2ba..7fc8316660 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 4f1eb1d2ec..a41eecdd72 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 e46c2e1357..6ae7a3e997 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 500465cbdb..1245de194c 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 320f24ccad..ad40d53ca8 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 0bcf067c4f..fd8454c235 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 89e850c326..f2bfb1f322 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 675e4637db..dc9d60f7c0 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 fceefd2cc6..40ad539ee2 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 3ffa87ec61..2ad202d407 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 381816a135..7db3ee4cac 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 f12b17d9f0..a55b1328ba 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 c17454d027..57c516798f 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 f0f446d626..77fef1f35f 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
index 30c81cbf6d..90fde066b2 100644
--- a/tests/auto/qsharedpointer/qsharedpointer.pro
+++ b/tests/auto/qsharedpointer/qsharedpointer.pro
@@ -4,5 +4,6 @@ SOURCES += tst_qsharedpointer.cpp \
forwarddeclared.cpp
QT = core
DEFINES += SRCDIR=\\\"$$PWD/\\\"
+requires(contains(QT_CONFIG,private_tests))
include(externaltests.pri)
HEADERS += forwarddeclared.h
diff --git a/tests/auto/qsocketnotifier/qsocketnotifier.pro b/tests/auto/qsocketnotifier/qsocketnotifier.pro
index 10ed3a529a..ec924c189b 100644
--- a/tests/auto/qsocketnotifier/qsocketnotifier.pro
+++ b/tests/auto/qsocketnotifier/qsocketnotifier.pro
@@ -2,6 +2,8 @@ load(qttest_p4)
SOURCES += tst_qsocketnotifier.cpp
QT = core network
+requires(contains(QT_CONFIG,private_tests))
+
include(../qnativesocketengine/qsocketengine.pri)
diff --git a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro
index 2949ee2826..d19b732fb9 100644
--- a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro
+++ b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro
@@ -11,3 +11,4 @@ QT = core network
+requires(contains(QT_CONFIG,private_tests))
diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h
index c6b65a4804..9c8c313d5c 100644
--- a/tests/auto/qsqldatabase/tst_databases.h
+++ b/tests/auto/qsqldatabase/tst_databases.h
@@ -105,7 +105,11 @@ inline static QString qTableName( const QString& prefix, QSqlDriver* driver = 0
inline static bool testWhiteSpaceNames( const QString &name )
{
- return name != QLatin1String("QTDS7");
+/* return name.startsWith( "QPSQL" )
+ || name.startsWith( "QODBC" )
+ || name.startsWith( "QSQLITE" )
+ || name.startsWith( "QMYSQL" );*/
+ return name != QLatin1String("QSQLITE2");
}
inline static QString toHex( const QString& binary )
@@ -245,10 +249,11 @@ public:
// addDb( "QODBC3", "DRIVER={SQL Native Client};SERVER=silence.nokia.troll.no\\SQLEXPRESS", "troll", "trond", "" );
// addDb( "QODBC", "DRIVER={MySQL ODBC 3.51 Driver};SERVER=mysql5-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" );
-// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=horsehead.nokia.troll.no;DATABASE=testdb;PORT=4101;UID=troll;PWD=trondk;TDS_Version=8.0", "troll", "trondk", "" );
-// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=silence.nokia.troll.no;DATABASE=testdb;PORT=2392;UID=troll;PWD=trond;TDS_Version=8.0", "troll", "trond", "" );
-// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433;UID=testuser;PWD=Ee4Gabf6_;TDS_Version=8.0", "testuser", "Ee4Gabf6_", "" );
-// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=bq-winserv2008-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433;UID=testuser;PWD=Ee4Gabf6_;TDS_Version=8.0", "testuser", "Ee4Gabf6_", "" );
+// addDb( "QODBC", "DRIVER={MySQL ODBC 5.1 Driver};SERVER=mysql4-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" );
+// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=horsehead.nokia.troll.no;DATABASE=testdb;PORT=4101;UID=troll;PWD=trondk", "troll", "trondk", "" );
+// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=silence.nokia.troll.no;DATABASE=testdb;PORT=2392;UID=troll;PWD=trond", "troll", "trond", "" );
+// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433;UID=testuser;PWD=Ee4Gabf6_;TDS_Version=8.0", "", "", "" );
+// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=bq-winserv2008-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433;UID=testuser;PWD=Ee4Gabf6_;TDS_Version=8.0", "", "", "" );
// addDb( "QTDS7", "testdb", "testuser", "Ee4Gabf6_", "bq-winserv2003" );
// addDb( "QTDS7", "testdb", "testuser", "Ee4Gabf6_", "bq-winserv2008" );
// addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" );
@@ -469,6 +474,16 @@ public:
return db.databaseName().contains( "Access Driver", Qt::CaseInsensitive );
}
+ static bool isPostgreSQL( QSqlDatabase db )
+ {
+ return db.driverName().startsWith("QPSQL") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("PostgreSQL") );
+ }
+
+ static bool isMySQL( QSqlDatabase db )
+ {
+ return db.driverName().startsWith("QMYSQL") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("MySQL") );
+ }
+
// -1 on fail, else Oracle version
static int getOraVersion( QSqlDatabase db )
{
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index a5095f1041..e1f1d3c1b6 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -188,7 +188,7 @@ private slots:
void oci_fieldLength_data() { generic_data("QOCI"); }
void oci_fieldLength();
- void sqlite_bindAndFetchUInt_data() { generic_data("QSQLITE3"); }
+ void sqlite_bindAndFetchUInt_data() { generic_data("QSQLITE"); }
void sqlite_bindAndFetchUInt();
void sqlStatementUseIsNull_189093_data() { generic_data(); }
@@ -256,6 +256,8 @@ static int createFieldTable(const FieldDef fieldDefs[], QSqlDatabase db)
QString autoName = tst_Databases::autoFieldName(db);
if (tst_Databases::isMSAccess(db))
qs.append(" (id int not null");
+ else if (tst_Databases::isPostgreSQL(db))
+ qs.append(" (id serial not null");
else
qs.append(QString("(id integer not null %1 primary key").arg(autoName));
@@ -351,8 +353,10 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db)
<< qTableName("bug_249059");
QSqlQuery q(0, db);
- if (db.driverName().startsWith("QPSQL"))
+ if (db.driverName().startsWith("QPSQL")) {
q.exec("drop schema " + qTableName("qtestschema") + " cascade");
+ q.exec("drop schema " + qTableName("qtestScHeMa") + " cascade");
+ }
if (testWhiteSpaceNames(db.driverName()))
tableNames << db.driver()->escapeIdentifier(qTableName("qtest") + " test", QSqlDriver::TableName);
@@ -556,19 +560,19 @@ void tst_QSqlDatabase::whitespaceInIdentifiers()
QString tableName = qTableName("qtest") + " test";
QVERIFY(db.tables().contains(tableName, Qt::CaseInsensitive));
- QSqlRecord rec = db.record(tableName);
+ QSqlRecord rec = db.record(db.driver()->escapeIdentifier(tableName, QSqlDriver::TableName));
QCOMPARE(rec.count(), 1);
QCOMPARE(rec.fieldName(0), QString("test test"));
if(db.driverName().startsWith("QOCI"))
- QCOMPARE(rec.field(0).type(), QVariant::String);
+ QCOMPARE(rec.field(0).type(), QVariant::Double);
else
QCOMPARE(rec.field(0).type(), QVariant::Int);
- QSqlIndex idx = db.primaryIndex(tableName);
+ QSqlIndex idx = db.primaryIndex(db.driver()->escapeIdentifier(tableName, QSqlDriver::TableName));
QCOMPARE(idx.count(), 1);
QCOMPARE(idx.fieldName(0), QString("test test"));
if(db.driverName().startsWith("QOCI"))
- QCOMPARE(idx.field(0).type(), QVariant::String);
+ QCOMPARE(idx.field(0).type(), QVariant::Double);
else
QCOMPARE(idx.field(0).type(), QVariant::Int);
} else {
@@ -916,7 +920,7 @@ void tst_QSqlDatabase::recordOCI()
FieldDef("varchar(20)", QVariant::String, QString("blah2")),
FieldDef("nchar(20)", QVariant::String, QString("blah3")),
FieldDef("nvarchar2(20)", QVariant::String, QString("blah4")),
- FieldDef("number(10,5)", QVariant::String, 1.1234567),
+ FieldDef("number(10,5)", QVariant::Double, 1.1234567),
FieldDef("date", QVariant::DateTime, dt),
#ifdef QT3_SUPPORT
//X? FieldDef("long raw", QVariant::ByteArray, QByteArray(Q3CString("blah5"))),
@@ -1345,6 +1349,8 @@ void tst_QSqlDatabase::transaction()
}
QVERIFY_SQL(q, exec("select * from " + qTableName("qtest") + " where id = 41"));
+ if(db.driverName().startsWith("QODBC") && dbName.contains("MySQL"))
+ QEXPECT_FAIL("", "Some odbc drivers don't actually roll back despite telling us they do, especially the mysql driver", Continue);
QVERIFY(!q.next());
populateTestTables(db);
@@ -1422,7 +1428,8 @@ void tst_QSqlDatabase::caseSensivity()
bool cs = false;
if (db.driverName().startsWith("QMYSQL")
|| db.driverName().startsWith("QSQLITE")
- || db.driverName().startsWith("QTDS"))
+ || db.driverName().startsWith("QTDS")
+ || db.driverName().startsWith("QODBC"))
cs = true;
QSqlRecord rec = db.record(qTableName("qtest"));
@@ -1517,10 +1524,11 @@ void tst_QSqlDatabase::psql_escapedIdentifiers()
QSqlQuery q(db);
QString schemaName = qTableName("qtestScHeMa");
- QString tableName = qTableName("qtestTaBlE");
+ QString tableName = qTableName("qtest");
QString field1Name = QString("fIeLdNaMe");
QString field2Name = QString("ZuLu");
+ q.exec(QString("DROP SCHEMA \"%1\" CASCADE").arg(schemaName));
QString createSchema = QString("CREATE SCHEMA \"%1\"").arg(schemaName);
QVERIFY_SQL(q, exec(createSchema));
QString createTable = QString("CREATE TABLE \"%1\".\"%2\" (\"%3\" int PRIMARY KEY, \"%4\" varchar(20))").arg(schemaName).arg(tableName).arg(field1Name).arg(field2Name);
@@ -1534,7 +1542,7 @@ void tst_QSqlDatabase::psql_escapedIdentifiers()
rec.append(fld1);
rec.append(fld2);
- QVERIFY_SQL(q, exec(drv->sqlStatement(QSqlDriver::SelectStatement, schemaName + '.' + tableName, rec, false)));
+ QVERIFY_SQL(q, exec(drv->sqlStatement(QSqlDriver::SelectStatement, db.driver()->escapeIdentifier(schemaName, QSqlDriver::TableName) + '.' + db.driver()->escapeIdentifier(tableName, QSqlDriver::TableName), rec, false)));
rec = q.record();
QCOMPARE(rec.count(), 2);
@@ -1652,6 +1660,8 @@ void tst_QSqlDatabase::precisionPolicy()
q.setNumericalPrecisionPolicy(QSql::LowPrecisionInt32);
QVERIFY_SQL(q, exec(query));
+ if(db.driverName().startsWith("QOCI"))
+ QEXPECT_FAIL("", "Oracle fails to move to next when data columns are oversize", Abort);
QVERIFY_SQL(q, next());
if(db.driverName().startsWith("QSQLITE"))
QEXPECT_FAIL("", "SQLite returns this value as determined by contents of the field, not the declaration", Continue);
@@ -2263,15 +2273,15 @@ void tst_QSqlDatabase::eventNotificationPSQL()
QSqlQuery query(db);
QString procedureName = qTableName("posteventProc");
- QSqlDriver *driver=db.driver();
- QVERIFY_SQL(*driver, subscribeToNotification(procedureName));
+ QSqlDriver &driver=*(db.driver());
+ QVERIFY_SQL(driver, subscribeToNotification(procedureName));
QSignalSpy spy(db.driver(), SIGNAL(notification(const QString&)));
query.exec(QString("NOTIFY \"%1\"").arg(procedureName));
QCoreApplication::processEvents();
QCOMPARE(spy.count(), 1);
QList<QVariant> arguments = spy.takeFirst();
QVERIFY(arguments.at(0).toString() == procedureName);
- QVERIFY_SQL(*driver, unsubscribeFromNotification(procedureName));
+ QVERIFY_SQL(driver, unsubscribeFromNotification(procedureName));
}
void tst_QSqlDatabase::sqlite_bindAndFetchUInt()
@@ -2279,6 +2289,10 @@ void tst_QSqlDatabase::sqlite_bindAndFetchUInt()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
+ if (db.driverName().startsWith("QSQLITE2")) {
+ QSKIP("SQLite3 specific test", SkipSingle);
+ return;
+ }
QSqlQuery q(db);
QString tableName = qTableName("uint_test");
diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/qsqldriver/tst_qsqldriver.cpp
index 6d428df2b4..b79c0933fd 100644
--- a/tests/auto/qsqldriver/tst_qsqldriver.cpp
+++ b/tests/auto/qsqldriver/tst_qsqldriver.cpp
@@ -158,7 +158,7 @@ void tst_QSqlDriver::record()
//check that we can't get records using incorrect tablename casing that's been quoted
rec = db.driver()->record(db.driver()->escapeIdentifier(tablename,QSqlDriver::TableName));
- if (db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS"))
+ if (tst_Databases::isMySQL(db) || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS"))
QCOMPARE(rec.count(), 4); //mysql, sqlite and tds will match
else
QCOMPARE(rec.count(), 0);
@@ -204,7 +204,7 @@ void tst_QSqlDriver::primaryIndex()
tablename = tablename.toUpper();
index = db.driver()->primaryIndex(db.driver()->escapeIdentifier(tablename, QSqlDriver::TableName));
- if (db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS"))
+ if (tst_Databases::isMySQL(db) || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS"))
QCOMPARE(index.count(), 1); //mysql will always find the table name regardless of casing
else
QCOMPARE(index.count(), 0);
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index ab7f0c9ddc..f3dd92091d 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -188,6 +188,9 @@ private slots:
void task_205701_data() { generic_data("QMYSQL"); }
void task_205701();
+ void task_233829_data() { generic_data("QPSQL"); }
+ void task_233829();
+
private:
// returns all database connections
@@ -293,6 +296,9 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
<< qTableName( "oraRowId" )
<< qTableName( "qtest_batch" );
+ if ( db.driverName().startsWith("QPSQL") )
+ tablenames << qTableName("task_233829");
+
if ( db.driverName().startsWith("QSQLITE") )
tablenames << qTableName( "record_sqlite" );
@@ -302,7 +308,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
tablenames << qTableName( "qtest_lockedtable" );
tablenames << qTableName( "Planet" );
-
+
tablenames << qTableName( "task_250026" );
tablenames << qTableName( "task_234422" );
@@ -318,7 +324,10 @@ void tst_QSqlQuery::createTestTables( QSqlDatabase db )
// in the MySQL server startup script
q.exec( "set table_type=innodb" );
- QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest" ) + " (id int "+tst_Databases::autoFieldName(db) +" NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id))" ) );
+ if(tst_Databases::isPostgreSQL(db))
+ QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest" ) + " (id serial NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id)) WITH OIDS" ) );
+ else
+ QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest" ) + " (id int "+tst_Databases::autoFieldName(db) +" NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id))" ) );
if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QTDS" ) )
QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_null" ) + " (id int null, t_varchar varchar(20) null)" ) );
@@ -486,7 +495,9 @@ void tst_QSqlQuery::mysqlOutValues()
QVERIFY_SQL( q, exec( "create procedure " + qTableName( "qtestproc" ) + " () "
"BEGIN select * from " + qTableName( "qtest" ) + " order by id; END" ) );
QVERIFY_SQL( q, exec( "call " + qTableName( "qtestproc" ) + "()" ) );
+ QEXPECT_FAIL("", "There's a mysql bug that means only selects think they return data when running in prepared mode", Continue);
QVERIFY_SQL( q, next() );
+ QEXPECT_FAIL("", "There's a mysql bug that means only selects think they return data when running in prepared mode", Continue);
QCOMPARE( q.value( 1 ).toString(), QString( "VarChar1" ) );
QVERIFY_SQL( q, exec( "drop procedure " + qTableName( "qtestproc" ) ) );
@@ -1870,7 +1881,7 @@ void tst_QSqlQuery::invalidQuery()
QVERIFY( !q.next() );
QVERIFY( !q.isActive() );
- if ( !db.driverName().startsWith( "QOCI" ) && !db.driverName().startsWith( "QDB2" ) ) {
+ if ( !db.driverName().startsWith( "QOCI" ) && !db.driverName().startsWith( "QDB2" ) && !db.driverName().startsWith( "QODBC" ) ) {
// oracle and db2 just prepares everything without complaining
if ( db.driver()->hasFeature( QSqlDriver::PreparedQueries ) )
QVERIFY( !q.prepare( "blahfasel" ) );
@@ -2007,7 +2018,7 @@ void tst_QSqlQuery::oraArrayBind()
q.bindValue( 0, list, QSql::In );
- QVERIFY_SQL( q, execBatch( QSqlQuery::ValuesAsRows ) );
+ QVERIFY_SQL( q, execBatch( QSqlQuery::ValuesAsColumns ) );
QVERIFY_SQL( q, prepare( "BEGIN "
"ora_array_test.get_table(?); "
@@ -2019,7 +2030,7 @@ void tst_QSqlQuery::oraArrayBind()
q.bindValue( 0, list, QSql::Out );
- QVERIFY_SQL( q, execBatch( QSqlQuery::ValuesAsRows ) );
+ QVERIFY_SQL( q, execBatch( QSqlQuery::ValuesAsColumns ) );
QVariantList out_list = q.boundValue( 0 ).toList();
@@ -2565,7 +2576,7 @@ void tst_QSqlQuery::blobsPreparedQuery()
QString typeName( "BLOB" );
if ( db.driverName().startsWith( "QPSQL" ) )
typeName = "BYTEA";
- else if ( db.driverName().startsWith( "QODBC" ) )
+ else if ( db.driverName().startsWith( "QODBC" ) && tst_Databases::isSqlServer( db ))
typeName = "IMAGE";
QVERIFY_SQL( q, exec( QString( "CREATE TABLE %1(id INTEGER, data %2)" ).arg( tableName ).arg( typeName ) ) );
@@ -2771,5 +2782,24 @@ void tst_QSqlQuery::task_234422()
#endif
+void tst_QSqlQuery::task_233829()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+
+ QSqlQuery q( db );
+ QString tableName = qTableName("task_233829");
+ QVERIFY_SQL(q,exec("CREATE TABLE " + tableName + "(dbl1 double precision,dbl2 double precision) without oids;"));
+
+ QString queryString("INSERT INTO " + tableName +"(dbl1, dbl2) VALUES(?,?)");
+
+ double k = 0.0;
+ QVERIFY_SQL(q,prepare(queryString));
+ q.bindValue(0,0.0 / k); // nan
+ q.bindValue(1,0.0 / k); // nan
+ QVERIFY_SQL(q,exec());
+}
+
QTEST_MAIN( tst_QSqlQuery )
#include "tst_qsqlquery.moc"
diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
index e2dace8629..1e23d3d9ab 100644
--- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
+++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
@@ -145,8 +145,17 @@ void tst_QSqlRelationalTableModel::recreateTestTables(QSqlDatabase db)
void tst_QSqlRelationalTableModel::initTestCase()
{
- foreach (const QString &dbname, dbs.dbNames)
- recreateTestTables(QSqlDatabase::database(dbname));
+ foreach (const QString &dbname, dbs.dbNames) {
+ QSqlDatabase db=QSqlDatabase::database(dbname);
+ if (db.driverName().startsWith("QIBASE"))
+ db.exec("SET DIALECT 3");
+ else if (tst_Databases::isSqlServer(db)) {
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec("SET ANSI_DEFAULTS ON"));
+ QVERIFY_SQL(q, exec("SET IMPLICIT_TRANSACTIONS OFF"));
+ }
+ recreateTestTables(db);
+ }
}
void tst_QSqlRelationalTableModel::cleanupTestCase()
@@ -167,10 +176,10 @@ void tst_QSqlRelationalTableModel::dropTestTables( QSqlDatabase db )
<< qTableName( "reltest3" )
<< qTableName( "reltest4" )
<< qTableName( "reltest5" )
- << qTableName( "rel test6", db.driver() )
- << qTableName( "rel test7", db.driver() )
- << qTableName("CASETEST1", db.driver() )
- << qTableName("casetest1", db.driver() );
+ << qTableName( "rel test6" )
+ << qTableName( "rel test7" )
+ << qTableName("CASETEST1" )
+ << qTableName("casetest1" );
tst_Databases::safeDropTables( db, tableNames );
}
@@ -490,6 +499,7 @@ void tst_QSqlRelationalTableModel::insertWithStrategies()
model.setTable(qTableName("reltest1"));
model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title"));
+ model.setSort(0, Qt::AscendingOrder);
if (!db.driverName().startsWith("QTDS"))
model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title"));
@@ -914,8 +924,8 @@ void tst_QSqlRelationalTableModel::casing()
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- if (db.driverName().startsWith("QSQLITE"))
- QSKIP("The casing test for SQLITE is irrelevant since SQLITE is case insensitive", SkipAll);
+ if (db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QIBASE") || tst_Databases::isSqlServer(db))
+ QSKIP("The casing test for this database is irrelevant since this database does not treat different cases as separate entities", SkipAll);
QSqlQuery q(db);
QVERIFY_SQL( q, exec("create table " + qTableName("CASETEST1", db.driver()).toUpper() +
diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
index 1445f345e8..576c1900ed 100644
--- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -116,6 +116,8 @@ private slots:
void insertRecordsInLoop();
void sqlite_attachedDatabase_data() { generic_data("QSQLITE"); }
void sqlite_attachedDatabase(); // For task 130799
+ void tableModifyWithBlank_data() { generic_data(); }
+ void tableModifyWithBlank(); // For mail task
private:
void generic_data(const QString& engine=QString());
@@ -141,6 +143,7 @@ void tst_QSqlTableModel::dropTestTables()
tableNames << qTableName("test")
<< qTableName("test2")
<< qTableName("test3")
+ << qTableName("test4")
<< qTableName("emptytable")
<< qTableName("bigtable")
<< qTableName("foo");
@@ -167,6 +170,8 @@ void tst_QSqlTableModel::createTestTables()
QVERIFY_SQL( q, exec("create table " + qTableName("test3") + "(id int, random varchar(20), randomtwo varchar(20))"));
+ QVERIFY_SQL( q, exec("create table " + qTableName("test4") + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))"));
+
QVERIFY_SQL( q, exec("create table " + qTableName("emptytable") + "(id int)"));
if (testWhiteSpaceNames(db.driverName())) {
@@ -927,5 +932,62 @@ void tst_QSqlTableModel::sqlite_attachedDatabase()
QCOMPARE(model.data(model.index(0, 1), Qt::DisplayRole).toString(), QLatin1String("main"));
}
+
+void tst_QSqlTableModel::tableModifyWithBlank()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+
+ QSqlTableModel model(0, db);
+ model.setTable(qTableName("test4"));
+ model.select();
+
+ //generate a time stamp for the test. Add one second to the current time to make sure
+ //it is different than the QSqlQuery test.
+ QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate);
+
+ //insert a new row, with column0 being the timestamp.
+ //Should be equivalent to QSqlQuery INSERT INTO... command)
+ QVERIFY_SQL(model, insertRow(0));
+ QVERIFY_SQL(model, setData(model.index(0,0),timeString));
+ QVERIFY_SQL(model, submitAll());
+
+ //set a filter on the table so the only record we get is the one we just made
+ //I could just do another setData command, but I want to make sure the TableModel
+ //matches exactly what is stored in the database
+ model.setFilter("column1='"+timeString+"'"); //filter to get just the newly entered row
+ QVERIFY_SQL(model, select());
+
+ //Make sure we only get one record, and that it is the one we just made
+ QCOMPARE(model.rowCount(), 1); //verify only one entry
+ QCOMPARE(model.record(0).value(0).toString(), timeString); //verify correct record
+
+ //At this point we know that the intial value (timestamp) was succsefully stored in the database
+ //Attempt to modify the data in the new record
+ //equivalent to query.exec("update test set column3="... command in direct test
+ //set the data in the first column to "col1ModelData"
+ QVERIFY_SQL(model, setData(model.index(0,1), "col1ModelData"));
+
+ //do a quick check to make sure that the setData command properly set the value in the model
+ QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData"));
+
+ //submit the changed data to the database
+ //This is where I have been getting errors.
+ QVERIFY_SQL(model, submitAll());
+
+ //make sure the model has the most current data for our record
+ QVERIFY_SQL(model, select());
+
+ //verify that our new record was the only record returned
+ QCOMPARE(model.rowCount(), 1);
+
+ //And that the record returned is, in fact, our test record.
+ QCOMPARE(model.record(0).value(0).toString(), timeString);
+
+ //Make sure the value of the first column matches what we set it to previously.
+ QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData"));
+}
+
QTEST_MAIN(tst_QSqlTableModel)
#include "tst_qsqltablemodel.moc"
diff --git a/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp
index fa440348fe..fba7b1bd57 100644
--- a/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp
+++ b/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp
@@ -1454,6 +1454,7 @@ static QStandardItem *itemFromText(QStandardItem *parent, const QString &text)
return item;
}
+#ifdef QT_BUILD_INTERNAL
static QModelIndex indexFromText(QStandardItemModel *model, const QString &text)
{
QStandardItem *item = itemFromText(model->invisibleRootItem(), text);
@@ -1467,9 +1468,11 @@ struct FriendlyTreeView : public QTreeView
friend class tst_QStandardItemModel;
Q_DECLARE_PRIVATE(QTreeView)
};
+#endif
void tst_QStandardItemModel::treeDragAndDrop()
{
+#ifdef QT_BUILD_INTERNAL
const int nRow = 5;
const int nCol = 3;
@@ -1605,6 +1608,7 @@ void tst_QStandardItemModel::treeDragAndDrop()
QVERIFY(compareModels(&model, &checkModel));
}
+#endif
}
void tst_QStandardItemModel::removeRowsAndColumns()
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index a859866a1d..efcb983d61 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -1015,6 +1015,7 @@ void tst_QStateMachine::rootState()
void tst_QStateMachine::addAndRemoveState()
{
+#ifdef QT_BUILD_INTERNAL
QStateMachine machine;
QStatePrivate *root_d = QStatePrivate::get(machine.rootState());
QCOMPARE(root_d->childStates().size(), 0);
@@ -1075,6 +1076,7 @@ void tst_QStateMachine::addAndRemoveState()
delete s2;
// ### how to deal with this?
// machine.removeState(machine.errorState());
+#endif
}
void tst_QStateMachine::stateEntryAndExit()
diff --git a/tests/auto/qstringbuilder/tst_qstringbuilder.cpp b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp
index fdbaf2126d..72889bc13b 100644
--- a/tests/auto/qstringbuilder/tst_qstringbuilder.cpp
+++ b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp
@@ -85,28 +85,18 @@
#undef QT_NO_CAST_TO_ASCII
#endif
-
#include <QtTest/QtTest>
//TESTED_CLASS=QStringBuilder
//TESTED_FILES=qstringbuilder.cpp
-#include <qtest.h>
-
#define LITERAL "some literal"
class tst_QStringBuilder : public QObject
{
Q_OBJECT
-public:
- tst_QStringBuilder() {}
- ~tst_QStringBuilder() {}
-
-public slots:
- void init() {}
- void cleanup() {}
-
+private slots:
void scenario();
};
@@ -119,6 +109,7 @@ void tst_QStringBuilder::scenario()
QLatin1Char achar('c');
QString r2(QLatin1String(LITERAL LITERAL));
QString r;
+ QByteArray ba(LITERAL);
r = l1literal P l1literal;
QCOMPARE(r, r2);
@@ -139,6 +130,10 @@ void tst_QStringBuilder::scenario()
QCOMPARE(r, r2);
r = LITERAL P string;
QCOMPARE(r, r2);
+ r = ba P string;
+ QCOMPARE(r, r2);
+ r = string P ba;
+ QCOMPARE(r, r2);
#endif
}
diff --git a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro
index 6acb0b4b24..f6101f4f04 100644
--- a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro
+++ b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro
@@ -13,3 +13,4 @@ contains(QT_CONFIG, qt3support): QT += qt3support
# Input
SOURCES += tst_qstylesheetstyle.cpp
RESOURCES += resources.qrc
+requires(contains(QT_CONFIG,private_tests))
diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
index 7b62eaec9c..2bbe897cbf 100644
--- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
+++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
@@ -81,6 +81,8 @@ private slots:
void paths();
void displayMode();
void strokeInherit();
+ void testFillInheritance();
+ void testStopOffsetOpacity();
#ifndef QT_NO_COMPRESS
void testGzLoading();
@@ -625,9 +627,11 @@ void tst_QSvgRenderer::testGzLoading()
QVERIFY(autoDetectGzData.isValid());
}
+#ifdef QT_BUILD_INTERNAL
QT_BEGIN_NAMESPACE
QByteArray qt_inflateGZipDataFrom(QIODevice *device);
QT_END_NAMESPACE
+#endif
void tst_QSvgRenderer::testGzHelper_data()
{
@@ -660,6 +664,7 @@ void tst_QSvgRenderer::testGzHelper_data()
void tst_QSvgRenderer::testGzHelper()
{
+#ifdef QT_BUILD_INTERNAL
QFETCH(QByteArray, in);
QFETCH(QByteArray, out);
@@ -668,6 +673,7 @@ void tst_QSvgRenderer::testGzHelper()
QVERIFY(buffer.isReadable());
QByteArray result = qt_inflateGZipDataFrom(&buffer);
QCOMPARE(result, out);
+#endif
}
#endif
@@ -1049,5 +1055,155 @@ void tst_QSvgRenderer::strokeInherit()
}
}
+void tst_QSvgRenderer::testFillInheritance()
+{
+ static const char *svgs[] = {
+ //reference
+ "<svg viewBox = \"0 0 200 200\">"
+ " <polygon points=\"20,20 50,120 100,10 40,80 50,80\" fill= \"red\" stroke = \"blue\" fill-opacity = \"0.5\" fill-rule = \"evenodd\"/>"
+ "</svg>",
+ "<svg viewBox = \"0 0 200 200\">"
+ " <polygon points=\"20,20 50,120 100,10 40,80 50,80\" fill= \"red\" stroke = \"blue\" fill-opacity = \"0.5\" fill-rule = \"evenodd\"/>"
+ " <rect x = \"40\" y = \"40\" width = \"70\" height =\"20\" fill = \"green\" fill-opacity = \"0\"/>"
+ "</svg>",
+ "<svg viewBox = \"0 0 200 200\">"
+ " <g fill = \"red\" fill-opacity = \"0.5\" fill-rule = \"evenodd\">"
+ " <polygon points=\"20,20 50,120 100,10 40,80 50,80\" stroke = \"blue\"/>"
+ " </g>"
+ " <rect x = \"40\" y = \"40\" width = \"70\" height =\"20\" fill = \"green\" fill-opacity = \"0\"/>"
+ "</svg>",
+ "<svg viewBox = \"0 0 200 200\">"
+ " <g fill = \"green\" fill-rule = \"nonzero\">"
+ " <polygon points=\"20,20 50,120 100,10 40,80 50,80\" stroke = \"blue\" fill = \"red\" fill-opacity = \"0.5\" fill-rule = \"evenodd\"/>"
+ " </g>"
+ " <g fill-opacity = \"0.8\" fill = \"red\">"
+ " <rect x = \"40\" y = \"40\" width = \"70\" height =\"20\" fill = \"green\" fill-opacity = \"0\"/>"
+ " </g>"
+ "</svg>",
+ "<svg viewBox = \"0 0 200 200\">"
+ " <g fill = \"red\" >"
+ " <g fill-opacity = \"0.5\">"
+ " <g fill-rule = \"evenodd\">"
+ " <g>"
+ " <polygon points=\"20,20 50,120 100,10 40,80 50,80\" stroke = \"blue\"/>"
+ " </g>"
+ " </g>"
+ " </g>"
+ " </g>"
+ " <g fill-opacity = \"0.8\" >"
+ " <rect x = \"40\" y = \"40\" width = \"70\" height =\"20\" fill = \"none\"/>"
+ " </g>"
+ "</svg>",
+ "<svg viewBox = \"0 0 200 200\">"
+ " <g fill = \"none\" fill-opacity = \"0\">"
+ " <polygon points=\"20,20 50,120 100,10 40,80 50,80\" stroke = \"blue\" fill = \"red\" fill-opacity = \"0.5\" fill-rule = \"evenodd\"/>"
+ " </g>"
+ " <g fill-opacity = \"0\" >"
+ " <rect x = \"40\" y = \"40\" width = \"70\" height =\"20\" fill = \"green\"/>"
+ " </g>"
+ "</svg>"
+ };
+
+ const int COUNT = sizeof(svgs) / sizeof(svgs[0]);
+ QImage images[COUNT];
+ QPainter p;
+
+ for (int i = 0; i < COUNT; ++i) {
+ QByteArray data(svgs[i]);
+ QSvgRenderer renderer(data);
+ QVERIFY(renderer.isValid());
+ images[i] = QImage(200, 200, QImage::Format_ARGB32_Premultiplied);
+ images[i].fill(-1);
+ p.begin(&images[i]);
+ renderer.render(&p);
+ p.end();
+ if (i != 0) {
+ QCOMPARE(images[0], images[i]);
+ }
+ }
+}
+void tst_QSvgRenderer::testStopOffsetOpacity()
+{
+ static const char *svgs[] = {
+ //reference
+ "<svg viewBox=\"0 0 64 64\">"
+ "<radialGradient id=\"MyGradient1\" gradientUnits=\"userSpaceOnUse\" cx=\"50\" cy=\"50\" r=\"30\" fx=\"20\" fy=\"20\">"
+ "<stop offset=\"0.0\" style=\"stop-color:red\" stop-opacity=\"0.3\"/>"
+ "<stop offset=\"0.5\" style=\"stop-color:green\" stop-opacity=\"1\"/>"
+ "<stop offset=\"1\" style=\"stop-color:yellow\" stop-opacity=\"1\"/>"
+ "</radialGradient>"
+ "<radialGradient id=\"MyGradient2\" gradientUnits=\"userSpaceOnUse\" cx=\"50\" cy=\"70\" r=\"70\" fx=\"20\" fy=\"20\">"
+ "<stop offset=\"0.0\" style=\"stop-color:blue\" stop-opacity=\"0.3\"/>"
+ "<stop offset=\"0.5\" style=\"stop-color:violet\" stop-opacity=\"1\"/>"
+ "<stop offset=\"1\" style=\"stop-color:orange\" stop-opacity=\"1\"/>"
+ "</radialGradient>"
+ "<rect x=\"5\" y=\"5\" width=\"55\" height=\"55\" fill=\"url(#MyGradient1)\" stroke=\"black\" />"
+ "<rect x=\"20\" y=\"20\" width=\"35\" height=\"35\" fill=\"url(#MyGradient2)\"/>"
+ "</svg>",
+ //Stop Offset
+ "<svg viewBox=\"0 0 64 64\">"
+ "<radialGradient id=\"MyGradient1\" gradientUnits=\"userSpaceOnUse\" cx=\"50\" cy=\"50\" r=\"30\" fx=\"20\" fy=\"20\">"
+ "<stop offset=\"abc\" style=\"stop-color:red\" stop-opacity=\"0.3\"/>"
+ "<stop offset=\"0.5\" style=\"stop-color:green\" stop-opacity=\"1\"/>"
+ "<stop offset=\"1\" style=\"stop-color:yellow\" stop-opacity=\"1\"/>"
+ "</radialGradient>"
+ "<radialGradient id=\"MyGradient2\" gradientUnits=\"userSpaceOnUse\" cx=\"50\" cy=\"70\" r=\"70\" fx=\"20\" fy=\"20\">"
+ "<stop offset=\"-3.bc\" style=\"stop-color:blue\" stop-opacity=\"0.3\"/>"
+ "<stop offset=\"0.5\" style=\"stop-color:violet\" stop-opacity=\"1\"/>"
+ "<stop offset=\"1\" style=\"stop-color:orange\" stop-opacity=\"1\"/>"
+ "</radialGradient>"
+ "<rect x=\"5\" y=\"5\" width=\"55\" height=\"55\" fill=\"url(#MyGradient1)\" stroke=\"black\" />"
+ "<rect x=\"20\" y=\"20\" width=\"35\" height=\"35\" fill=\"url(#MyGradient2)\"/>"
+ "</svg>",
+ //Stop Opacity
+ "<svg viewBox=\"0 0 64 64\">"
+ "<radialGradient id=\"MyGradient1\" gradientUnits=\"userSpaceOnUse\" cx=\"50\" cy=\"50\" r=\"30\" fx=\"20\" fy=\"20\">"
+ "<stop offset=\"0.0\" style=\"stop-color:red\" stop-opacity=\"0.3\"/>"
+ "<stop offset=\"0.5\" style=\"stop-color:green\" stop-opacity=\"x.45\"/>"
+ "<stop offset=\"1\" style=\"stop-color:yellow\" stop-opacity=\"-3.abc\"/>"
+ "</radialGradient>"
+ "<radialGradient id=\"MyGradient2\" gradientUnits=\"userSpaceOnUse\" cx=\"50\" cy=\"70\" r=\"70\" fx=\"20\" fy=\"20\">"
+ "<stop offset=\"0.0\" style=\"stop-color:blue\" stop-opacity=\"0.3\"/>"
+ "<stop offset=\"0.5\" style=\"stop-color:violet\" stop-opacity=\"-0.xy\"/>"
+ "<stop offset=\"1\" style=\"stop-color:orange\" stop-opacity=\"z.5\"/>"
+ "</radialGradient>"
+ "<rect x=\"5\" y=\"5\" width=\"55\" height=\"55\" fill=\"url(#MyGradient1)\" stroke=\"black\" />"
+ "<rect x=\"20\" y=\"20\" width=\"35\" height=\"35\" fill=\"url(#MyGradient2)\"/>"
+ "</svg>",
+ //Stop offset and Stop opacity
+ "<svg viewBox=\"0 0 64 64\">"
+ "<radialGradient id=\"MyGradient1\" gradientUnits=\"userSpaceOnUse\" cx=\"50\" cy=\"50\" r=\"30\" fx=\"20\" fy=\"20\">"
+ "<stop offset=\"abc\" style=\"stop-color:red\" stop-opacity=\"0.3\"/>"
+ "<stop offset=\"0.5\" style=\"stop-color:green\" stop-opacity=\"x.45\"/>"
+ "<stop offset=\"1\" style=\"stop-color:yellow\" stop-opacity=\"-3.abc\"/>"
+ "</radialGradient>"
+ "<radialGradient id=\"MyGradient2\" gradientUnits=\"userSpaceOnUse\" cx=\"50\" cy=\"70\" r=\"70\" fx=\"20\" fy=\"20\">"
+ "<stop offset=\"-3.bc\" style=\"stop-color:blue\" stop-opacity=\"0.3\"/>"
+ "<stop offset=\"0.5\" style=\"stop-color:violet\" stop-opacity=\"-0.xy\"/>"
+ "<stop offset=\"1\" style=\"stop-color:orange\" stop-opacity=\"z.5\"/>"
+ "</radialGradient>"
+ "<rect x=\"5\" y=\"5\" width=\"55\" height=\"55\" fill=\"url(#MyGradient1)\" stroke=\"black\" />"
+ "<rect x=\"20\" y=\"20\" width=\"35\" height=\"35\" fill=\"url(#MyGradient2)\"/>"
+ "</svg>"
+ };
+
+ QImage images[4];
+ QPainter p;
+
+ for (int i = 0; i < 4; ++i) {
+ QByteArray data(svgs[i]);
+ QSvgRenderer renderer(data);
+ QVERIFY(renderer.isValid());
+ images[i] = QImage(64, 64, QImage::Format_ARGB32_Premultiplied);
+ images[i].fill(-1);
+ p.begin(&images[i]);
+ renderer.render(&p);
+ p.end();
+ }
+ QCOMPARE(images[0], images[1]);
+ QCOMPARE(images[0], images[2]);
+ QCOMPARE(images[0], images[3]);
+}
+
QTEST_MAIN(tst_QSvgRenderer)
#include "tst_qsvgrenderer.moc"
diff --git a/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
index 22e9455965..1699e72c61 100644
--- a/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
+++ b/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
@@ -99,7 +99,8 @@ private slots:
void avoidUnnecessaryRehighlight();
void noContentsChangedDuringHighlight();
void rehighlight();
-
+ void rehighlightBlock();
+
private:
QTextDocument *doc;
QTestDocumentLayout *lout;
@@ -517,6 +518,32 @@ void tst_QSyntaxHighlighter::rehighlight()
QCOMPARE(hl->callCount, 1);
}
+void tst_QSyntaxHighlighter::rehighlightBlock()
+{
+ TestHighlighter *hl = new TestHighlighter(doc);
+
+ cursor.movePosition(QTextCursor::Start);
+ cursor.beginEditBlock();
+ cursor.insertText("Hello");
+ cursor.insertBlock();
+ cursor.insertText("World");
+ cursor.endEditBlock();
+
+ hl->callCount = 0;
+ hl->highlightedText.clear();
+ QTextBlock block = doc->begin();
+ hl->rehighlightBlock(block);
+
+ QCOMPARE(hl->highlightedText, QString("Hello"));
+ QCOMPARE(hl->callCount, 1);
+
+ hl->callCount = 0;
+ hl->highlightedText.clear();
+ hl->rehighlightBlock(block.next());
+
+ QCOMPARE(hl->highlightedText, QString("World"));
+ QCOMPARE(hl->callCount, 1);
+}
QTEST_MAIN(tst_QSyntaxHighlighter)
#include "tst_qsyntaxhighlighter.moc"
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index ae023baa94..6fa57f0a75 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -175,6 +175,8 @@ private slots:
// task-specific tests:
void task173773_updateVerticalHeader();
void task227953_setRootIndex();
+ void task240266_veryBigColumn();
+ void task248688_autoScrollNavigation();
void mouseWheel_data();
void mouseWheel();
@@ -586,7 +588,7 @@ void tst_QTableView::keyboardNavigation()
QModelIndex index = model.index(rowCount - 1, columnCount - 1);
view.setCurrentIndex(index);
- QApplication::instance()->processEvents();
+ QApplication::processEvents();
int row = rowCount - 1;
int column = columnCount - 1;
@@ -618,7 +620,7 @@ void tst_QTableView::keyboardNavigation()
}
QTest::keyClick(&view, key);
- QApplication::instance()->processEvents();
+ QApplication::processEvents();
QModelIndex index = model.index(row, column);
QCOMPARE(view.currentIndex(), index);
@@ -3127,6 +3129,56 @@ void tst_QTableView::task227953_setRootIndex()
QVERIFY(!tableView.verticalHeader()->isHidden());
}
+void tst_QTableView::task240266_veryBigColumn()
+{
+ QTableView table;
+ table.setFixedSize(500, 300); //just to make sure we have the 2 first columns visible
+ QStandardItemModel model(1, 3);
+ table.setModel(&model);
+ table.setColumnWidth(0, 100); //normal column
+ table.setColumnWidth(1, 100); //normal column
+ table.setColumnWidth(2, 9000); //very big column
+ table.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(100);
+
+ QScrollBar *scroll = table.horizontalScrollBar();
+ QCOMPARE(scroll->minimum(), 0);
+ QCOMPARE(scroll->maximum(), model.columnCount() - 1);
+ QCOMPARE(scroll->singleStep(), 1);
+
+ //1 is not always a very correct value for pageStep. Ideally this should be dynamic.
+ //Maybe something for Qt 5 ;-)
+ QCOMPARE(scroll->pageStep(), 1);
+
+}
+
+void tst_QTableView::task248688_autoScrollNavigation()
+{
+ //we make sure that when navigating with the keyboard the view is correctly scrolled
+ //to the current item
+ QStandardItemModel model(16, 16);
+ QTableView view;
+ view.setModel(&model);
+
+ view.hideColumn(8);
+ view.hideRow(8);
+ view.show();
+ for (int r = 0; r < model.rowCount(); ++r) {
+ if (view.isRowHidden(r))
+ continue;
+ for (int c = 0; c < model.columnCount(); ++c) {
+ if (view.isColumnHidden(c))
+ continue;
+ QModelIndex index = model.index(r, c);
+ view.setCurrentIndex(index);
+ QVERIFY(view.viewport()->rect().contains(view.visualRect(index)));
+ }
+ }
+}
+
void tst_QTableView::mouseWheel_data()
{
diff --git a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
index 56f5e7a32b..4559daa120 100644
--- a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
+++ b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
@@ -2758,6 +2758,16 @@ void tst_QTextDocumentFragment::css_listStyleType()
QVERIFY(cursor.currentList());
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListUpperAlpha);
+ doc->setHtml("<ul style=\"list-style-type: upper-roman\"><li>Blah</li></ul>");
+ cursor.movePosition(QTextCursor::End);
+ QVERIFY(cursor.currentList());
+ QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListUpperRoman);
+
+ doc->setHtml("<ul style=\"list-style-type: lower-roman\"><li>Blah</li></ul>");
+ cursor.movePosition(QTextCursor::End);
+ QVERIFY(cursor.currentList());
+ QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListLowerRoman);
+
// ignore the unsupported list-style-position inside the list-style shorthand property
doc->setHtml("<ul style=\"list-style: outside decimal\"><li>Blah</li></ul>");
cursor.movePosition(QTextCursor::End);
diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp
index 3bc1517599..d54645c9cf 100644
--- a/tests/auto/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/qtextedit/tst_qtextedit.cpp
@@ -1460,6 +1460,7 @@ void tst_QTextEdit::mimeDataReimplementations()
QCOMPARE(ed.canInsertCallCount, 0);
QCOMPARE(ed.insertCallCount, 0);
+#ifdef QT_BUILD_INTERNAL
QTextControl *control = qFindChild<QTextControl *>(&ed);
QVERIFY(control);
@@ -1474,6 +1475,7 @@ void tst_QTextEdit::mimeDataReimplementations()
QCOMPARE(ed.createMimeDataCallCount, 1);
QCOMPARE(ed.canInsertCallCount, 1);
QCOMPARE(ed.insertCallCount, 1);
+#endif
}
void tst_QTextEdit::ctrlEnterShouldInsertLineSeparator_NOT()
@@ -2066,6 +2068,7 @@ void tst_QTextEdit::cursorRect()
void tst_QTextEdit::setDocumentPreservesPalette()
{
+#ifdef QT_BUILD_INTERNAL
QTextControl *control = qFindChild<QTextControl *>(ed);
QVERIFY(control);
@@ -2085,6 +2088,7 @@ void tst_QTextEdit::setDocumentPreservesPalette()
QVERIFY(control->document() == newDoc);
QVERIFY(whitePal.color(QPalette::Active, QPalette::Text)
== control->palette().color(QPalette::Active, QPalette::Text));
+#endif
}
class PublicTextEdit : public QTextEdit
diff --git a/tests/auto/qtextlist/tst_qtextlist.cpp b/tests/auto/qtextlist/tst_qtextlist.cpp
index 658b8bb0e6..4ab6f5a7ae 100644
--- a/tests/auto/qtextlist/tst_qtextlist.cpp
+++ b/tests/auto/qtextlist/tst_qtextlist.cpp
@@ -67,6 +67,8 @@ private slots:
void item();
void autoNumbering();
void autoNumberingRTL();
+ void romanNumbering();
+ void romanNumberingLimit();
void formatChange();
void cursorNavigation();
void partialRemoval();
@@ -75,6 +77,8 @@ private slots:
void add();
void defaultIndent();
void blockUpdate();
+ void numbering_data();
+ void numbering();
private:
QTextDocument *doc;
@@ -142,6 +146,40 @@ void tst_QTextList::autoNumberingRTL()
QVERIFY(cursor.currentList()->itemText(cursor.block()) == ".B");
}
+void tst_QTextList::romanNumbering()
+{
+ QTextListFormat fmt;
+ fmt.setStyle(QTextListFormat::ListUpperRoman);
+ QTextList *list = cursor.createList(fmt);
+ QVERIFY(list);
+
+ for (int i = 0; i < 4998; ++i)
+ cursor.insertBlock();
+
+ QVERIFY(list->count() == 4999);
+
+ QVERIFY(cursor.currentList());
+ QVERIFY(cursor.currentList()->itemNumber(cursor.block()) == 4998);
+ QVERIFY(cursor.currentList()->itemText(cursor.block()) == "MMMMCMXCIX.");
+}
+
+void tst_QTextList::romanNumberingLimit()
+{
+ QTextListFormat fmt;
+ fmt.setStyle(QTextListFormat::ListLowerRoman);
+ QTextList *list = cursor.createList(fmt);
+ QVERIFY(list);
+
+ for (int i = 0; i < 4999; ++i)
+ cursor.insertBlock();
+
+ QVERIFY(list->count() == 5000);
+
+ QVERIFY(cursor.currentList());
+ QVERIFY(cursor.currentList()->itemNumber(cursor.block()) == 4999);
+ QVERIFY(cursor.currentList()->itemText(cursor.block()) == "?.");
+}
+
void tst_QTextList::formatChange()
{
// testing the formatChanged slot in QTextListManager
@@ -300,5 +338,43 @@ void tst_QTextList::blockUpdate()
QVERIFY(!layout->error);
}
+void tst_QTextList::numbering_data()
+{
+ QTest::addColumn<int>("format");
+ QTest::addColumn<int>("number");
+ QTest::addColumn<QString>("result");
+
+ QTest::newRow("E.") << int(QTextListFormat::ListUpperAlpha) << 5 << "E.";
+ QTest::newRow("abc.") << int(QTextListFormat::ListLowerAlpha) << (26 + 2) * 26 + 3 << "abc.";
+ QTest::newRow("12.") << int(QTextListFormat::ListDecimal) << 12 << "12.";
+ QTest::newRow("XXIV.") << int(QTextListFormat::ListUpperRoman) << 24 << "XXIV.";
+ QTest::newRow("VIII.") << int(QTextListFormat::ListUpperRoman) << 8 << "VIII.";
+ QTest::newRow("xxx.") << int(QTextListFormat::ListLowerRoman) << 30 << "xxx.";
+ QTest::newRow("xxix.") << int(QTextListFormat::ListLowerRoman) << 29 << "xxix.";
+// QTest::newRow("xxx. alpha") << int(QTextListFormat::ListLowerAlpha) << (24 * 26 + 24) * 26 + 24 << "xxx."; //Too slow
+}
+
+void tst_QTextList::numbering()
+{
+ QFETCH(int, format);
+ QFETCH(int, number);
+ QFETCH(QString, result);
+
+
+ QTextListFormat fmt;
+ fmt.setStyle(QTextListFormat::Style(format));
+ QTextList *list = cursor.createList(fmt);
+ QVERIFY(list);
+
+ for (int i = 1; i < number; ++i)
+ cursor.insertBlock();
+
+ QCOMPARE(list->count(), number);
+
+ QVERIFY(cursor.currentList());
+ QCOMPARE(cursor.currentList()->itemNumber(cursor.block()), number - 1);
+ QCOMPARE(cursor.currentList()->itemText(cursor.block()), result);
+}
+
QTEST_MAIN(tst_QTextList)
#include "tst_qtextlist.moc"
diff --git a/tests/auto/qtextpiecetable/qtextpiecetable.pro b/tests/auto/qtextpiecetable/qtextpiecetable.pro
index 318a8c78b8..0926b83ccc 100644
--- a/tests/auto/qtextpiecetable/qtextpiecetable.pro
+++ b/tests/auto/qtextpiecetable/qtextpiecetable.pro
@@ -2,7 +2,6 @@ load(qttest_p4)
SOURCES += tst_qtextpiecetable.cpp
HEADERS += ../qtextdocument/common.h
-!win32:DEFINES += QTEST_REDUCED_EXPORTS
-
-
+requires(!win32)
+requires(contains(QT_CONFIG,private_tests))
diff --git a/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp b/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp
index accbabb1ff..0e60c16543 100644
--- a/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp
+++ b/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp
@@ -42,9 +42,7 @@
#include <QtTest/QtTest>
-#ifdef QTEST_REDUCED_EXPORTS
#define private public
-#endif
#include <qtextdocument.h>
#include <private/qtextdocument_p.h>
@@ -65,7 +63,6 @@ public:
tst_QTextPieceTable();
-#ifdef QTEST_REDUCED_EXPORTS
public slots:
void init();
void cleanup();
@@ -112,13 +109,7 @@ private slots:
void removeFrameDirect();
void removeWithChildFrame();
void clearWithFrames();
-#else
-public slots:
- void init();
- void cleanup();
-private slots:
- void skip();
-#endif
+
private:
QTextDocument *doc;
QTextDocumentPrivate *table;
@@ -130,8 +121,6 @@ tst_QTextPieceTable::tst_QTextPieceTable()
{ doc = 0; table = 0; }
-#ifdef QTEST_REDUCED_EXPORTS
-
void tst_QTextPieceTable::init()
{
doc = new QTextDocument(0);
@@ -1148,25 +1137,6 @@ void tst_QTextPieceTable::clearWithFrames()
QVERIFY(true);
}
-#else // QTEST_REDUCED_EXPORTS
-
-void tst_QTextPieceTable::init()
-{
-}
-
-void tst_QTextPieceTable::cleanup()
-{
-}
-
-void tst_QTextPieceTable::skip()
-{
- QSKIP( "Not tested on win32", SkipAll );
-}
-
-
-#endif // QTEST_REDUCED_EXPORTS
-
-
QTEST_MAIN(tst_QTextPieceTable)
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index ea551dafa3..723f8829a1 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -3057,12 +3057,15 @@ void tst_QUrl::nameprep_testsuite_data()
<< QString() << 0 << 0;
}
+#ifdef QT_BUILD_INTERNAL
QT_BEGIN_NAMESPACE
extern QString qt_nameprep(const QString &source);
QT_END_NAMESPACE
+#endif
void tst_QUrl::nameprep_testsuite()
{
+#ifdef QT_BUILD_INTERNAL
QFETCH(QString, in);
QFETCH(QString, out);
QFETCH(QString, profile);
@@ -3082,6 +3085,7 @@ void tst_QUrl::nameprep_testsuite()
QEXPECT_FAIL("Larger test (expanding)",
"Investigate further", Continue);
QCOMPARE(qt_nameprep(in), out);
+#endif
}
void tst_QUrl::ace_testsuite_data()
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 04ec77d5c6..0f0a1af91c 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -351,8 +351,10 @@ private slots:
#endif
void updateOnDestroyedSignal();
void toplevelLineEditFocus();
+ void inputFocus_task257832();
void focusWidget_task254563();
+ void rectOutsideCoordinatesLimit_task144779();
private:
bool ensureScreenSize(int width, int height);
@@ -9117,5 +9119,53 @@ void tst_QWidget::focusWidget_task254563()
QVERIFY(top.focusWidget() != widget); //dangling pointer
}
+void tst_QWidget::rectOutsideCoordinatesLimit_task144779()
+{
+ QWidget main;
+ QPalette palette;
+ palette.setColor(QPalette::Window, Qt::red);
+ main.setPalette(palette);
+ main.resize(400, 400);
+
+ QWidget *offsetWidget = new QWidget(&main);
+ offsetWidget->setGeometry(0, -14600, 400, 15000);
+
+ // big widget is too big for the coordinates, it must be limited by wrect
+ // if wrect is not at the right position because of offsetWidget, bigwidget
+ // is not painted correctly
+ QWidget *bigWidget = new QWidget(offsetWidget);
+ bigWidget->setGeometry(0, 0, 400, 50000);
+ palette.setColor(QPalette::Window, Qt::green);
+ bigWidget->setPalette(palette);
+ bigWidget->setAutoFillBackground(true);
+
+ main.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&main);
+#endif
+ QTest::qWait(100);
+ QPixmap pixmap = QPixmap::grabWindow(main.winId());
+
+ QPixmap correct(main.size());
+ correct.fill(Qt::green);
+
+ QRect center(100, 100, 200, 200); // to avoid the decorations
+ QCOMPARE(pixmap.toImage().copy(center), correct.toImage().copy(center));
+}
+
+void tst_QWidget::inputFocus_task257832()
+{
+ QLineEdit *widget = new QLineEdit;
+ QInputContext *context = widget->inputContext();
+ if (!context)
+ QSKIP("No input context", SkipSingle);
+ widget->setFocus();
+ context->setFocusWidget(widget);
+ QCOMPARE(context->focusWidget(), widget);
+ widget->setReadOnly(true);
+ QVERIFY(!context->focusWidget());
+ delete widget;
+}
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"
diff --git a/tests/auto/selftests/exception/exception.pro b/tests/auto/selftests/exceptionthrow/exceptionthrow.pro
index 65705c685d..641818ca18 100644
--- a/tests/auto/selftests/exception/exception.pro
+++ b/tests/auto/selftests/exceptionthrow/exceptionthrow.pro
@@ -1,9 +1,9 @@
load(qttest_p4)
-SOURCES += tst_exception.cpp
+SOURCES += tst_exceptionthrow.cpp
QT = core
mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
-TARGET = exception
+TARGET = exceptionthrow
diff --git a/tests/auto/selftests/exception/tst_exception.cpp b/tests/auto/selftests/exceptionthrow/tst_exceptionthrow.cpp
index a54bfbec8f..7a65c2da3e 100644
--- a/tests/auto/selftests/exception/tst_exception.cpp
+++ b/tests/auto/selftests/exceptionthrow/tst_exceptionthrow.cpp
@@ -66,4 +66,4 @@ void tst_Exception::throwException() const
QTEST_MAIN(tst_Exception)
-#include "tst_exception.moc"
+#include "tst_exceptionthrow.moc"
diff --git a/tests/auto/selftests/expected_exception.txt b/tests/auto/selftests/expected_exceptionthrow.txt
index 141ea8be77..141ea8be77 100644
--- a/tests/auto/selftests/expected_exception.txt
+++ b/tests/auto/selftests/expected_exceptionthrow.txt
diff --git a/tests/auto/selftests/expected_maxwarnings.txt b/tests/auto/selftests/expected_maxwarnings.txt
index bb5e54fdc0..8dae5f775a 100644
--- a/tests/auto/selftests/expected_maxwarnings.txt
+++ b/tests/auto/selftests/expected_maxwarnings.txt
@@ -1,5 +1,5 @@
********* Start testing of MaxWarnings *********
-Config: Using QTest library 4.1.0, Qt 4.1.0
+Config: Using QTest library 4.6.0, Qt 4.6.0
PASS : MaxWarnings::initTestCase()
QWARN : MaxWarnings::warn() 0
QWARN : MaxWarnings::warn() 1
@@ -2002,7 +2002,7 @@ QWARN : MaxWarnings::warn() 1997
QWARN : MaxWarnings::warn() 1998
QWARN : MaxWarnings::warn() 1999
QWARN : MaxWarnings::warn() 2000
-QSYSTEM: MaxWarnings::warn() Maximum amount of warnings exceeded.
+QSYSTEM: MaxWarnings::warn() Maximum amount of warnings exceeded. Use -maxwarnings to override.
PASS : MaxWarnings::warn()
PASS : MaxWarnings::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
diff --git a/tests/auto/selftests/selftests.pro b/tests/auto/selftests/selftests.pro
index ca69afaa36..45de658fa5 100644
--- a/tests/auto/selftests/selftests.pro
+++ b/tests/auto/selftests/selftests.pro
@@ -3,7 +3,7 @@ TEMPLATE = subdirs
SUBDIRS = subtest test warnings maxwarnings cmptest globaldata skipglobal skip \
strcmp expectfail sleep fetchbogus crashes multiexec failinit failinitdata \
skipinit skipinitdata datetime singleskip assert waitwithoutgui differentexec \
- exception qexecstringlist datatable commandlinedata\
+ exceptionthrow qexecstringlist datatable commandlinedata\
benchlibwalltime benchlibcallgrind benchlibeventcounter benchlibtickcounter \
benchliboptions xunit badxml
diff --git a/tests/auto/selftests/selftests.qrc b/tests/auto/selftests/selftests.qrc
index d57ff293f5..9dc9dd0117 100644
--- a/tests/auto/selftests/selftests.qrc
+++ b/tests/auto/selftests/selftests.qrc
@@ -25,7 +25,7 @@
<file>expected_fatal.txt</file>
<file>expected_waitwithoutgui.txt</file>
<file>expected_differentexec.txt</file>
- <file>expected_exception.txt</file>
+ <file>expected_exceptionthrow.txt</file>
<file>expected_qexecstringlist.txt</file>
<file>expected_datatable.txt</file>
<file>expected_commandlinedata.txt</file>
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index de51f53d84..ba17ccb537 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -170,7 +170,7 @@ void tst_Selftests::runSubTest_data()
// with a warning that an uncaught exception was thrown.
// This will time out and falsely fail, therefore we disable the test for that platform.
# if !defined(Q_CC_INTEL) || !defined(Q_OS_WIN)
- QTest::newRow("exception") << "exception" << QStringList();
+ QTest::newRow("exceptionthrow") << "exceptionthrow" << QStringList();
# endif
#endif
QTest::newRow("qexecstringlist") << "qexecstringlist" << QStringList();
@@ -207,7 +207,7 @@ void tst_Selftests::doRunSubTest(QString &subdir, QStringList &arguments )
/* Windows-MSVC decide to output an error message when exceptions are thrown,
* so let's not check stderr for those. */
#if defined(Q_OS_WIN)
- if(subdir != QLatin1String("exception") && subdir != QLatin1String("fetchbogus"))
+ if(subdir != QLatin1String("exceptionthrow") && subdir != QLatin1String("fetchbogus"))
#endif
if(subdir != QLatin1String("xunit"))
QVERIFY2(err.isEmpty(), err.constData());
@@ -343,7 +343,7 @@ void tst_Selftests::checkXML() const
* this is what windows platforms says:
* "This application has requested the Runtime to terminate it in an unusual way.
* Please contact the application's support team for more information." */
- if(subdir != QLatin1String("exception") && subdir != QLatin1String("fetchbogus"))
+ if(subdir != QLatin1String("exceptionthrow") && subdir != QLatin1String("fetchbogus"))
QVERIFY2(err.isEmpty(), err.constData());
QXmlStreamReader reader(out);
@@ -385,7 +385,7 @@ void tst_Selftests::checkXunitxml() const
* this is what windows platforms says:
* "This application has requested the Runtime to terminate it in an unusual way.
* Please contact the application's support team for more information." */
- if(subdir != QLatin1String("exception") && subdir != QLatin1String("fetchbogus"))
+ if(subdir != QLatin1String("exceptionthrow") && subdir != QLatin1String("fetchbogus"))
QVERIFY2(err.isEmpty(), err.constData());
QXmlStreamReader reader(out);
diff --git a/tests/auto/uiloader/baseline/css_scrollarea_base.ui b/tests/auto/uiloader/baseline/css_scrollarea_base.ui
new file mode 100644
index 0000000000..495401f407
--- /dev/null
+++ b/tests/auto/uiloader/baseline/css_scrollarea_base.ui
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>407</width>
+ <height>339</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QAbstractScrollArea { border: 2px dashed #e12; }
+QHeaderView { border-color: blue; }
+
+</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QPlainTextEdit" name="plainTextEdit">
+ <property name="plainText">
+ <string>Note that the task 257517 requires to scroll down, and check that the backgroud is still filled with the base color (white by default)
+
+x
+x
+
+x
+x
+
+x
+x
+
+x
+x
+
+</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTableWidget" name="tableWidget">
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="textEdit">
+ <property name="html">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;x&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;x&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;x&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;x&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;x&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;x&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;x&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;x&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;x&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;x&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro b/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro
index e90b335d76..3d82eaf438 100644
--- a/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro
+++ b/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro
@@ -2,3 +2,4 @@ TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = ../xmlpatternsxqts test
+requires(contains(QT_CONFIG,private_tests))
diff --git a/tests/auto/xmlpatternsview/xmlpatternsview.pro b/tests/auto/xmlpatternsview/xmlpatternsview.pro
index 3544264847..04ee4d0efe 100644
--- a/tests/auto/xmlpatternsview/xmlpatternsview.pro
+++ b/tests/auto/xmlpatternsview/xmlpatternsview.pro
@@ -6,3 +6,4 @@ SUBDIRS = ../xmlpatternsxqts test
contains(QT_CONFIG,xmlpatterns) {
SUBDIRS += view
}
+requires(contains(QT_CONFIG,private_tests))
diff --git a/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro b/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro
index 368a0289fc..a3b13da9c4 100644
--- a/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro
+++ b/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro
@@ -9,3 +9,6 @@ contains(QT_CONFIG,xmlpatterns) {
# Needed on the win32-g++ setup and on the test machine arsia.
INCLUDEPATH += $$QT_BUILD_TREE/include/QtXmlPatterns/private \
../../../include/QtXmlPatterns/private
+
+requires(contains(QT_CONFIG,private_tests))
+
diff --git a/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro b/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro
index 4a688c4149..9b63a52834 100644
--- a/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro
+++ b/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro
@@ -23,3 +23,4 @@ wince*: {
DEPLOYMENT += testdata
}
+requires(contains(QT_CONFIG,private_tests))