summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-04 08:33:52 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-04 09:02:17 (GMT)
commit4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1 (patch)
treeb34985c5716d98f01b9f36fd4a98f2ac9710099f /tests
parenta0df97c03f26a38af17a42fb44ad6910536c8857 (diff)
parent2076f150995e541308b1d8da936b3e12ab68b886 (diff)
downloadQt-4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1.zip
Qt-4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1.tar.gz
Qt-4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1.tar.bz2
Merge commit 'qt/master-stable'
Conflicts: config.tests/unix/openssl/openssl.pri demos/embedded/embedded.pro examples/itemviews/chart/chart.pro examples/network/network.pro examples/painting/painterpaths/painterpaths.pro examples/threads/mandelbrot/mandelbrot.pro qmake/project.cpp src/3rdparty/libtiff/libtiff/tif_config.h src/corelib/arch/arch.pri src/corelib/global/qglobal.cpp src/corelib/kernel/kernel.pri src/corelib/kernel/qcore_unix_p.h src/corelib/kernel/qobject.cpp src/corelib/thread/qthread_unix.cpp src/corelib/tools/qsharedpointer_impl.h src/corelib/tools/tools.pri src/gui/kernel/qaction.h src/gui/kernel/qapplication.cpp src/gui/painting/qregion.h src/gui/widgets/qlineedit.cpp src/gui/widgets/qlineedit_p.h src/network/socket/qnativesocketengine_unix.cpp tests/auto/qdir/tst_qdir.cpp tests/auto/qdiriterator/tst_qdiriterator.cpp tests/auto/qhttp/qhttp.pro tests/auto/qline/qline.pro tests/auto/qnetworkreply/tst_qnetworkreply.cpp tests/auto/qresourceengine/qresourceengine.pro tests/auto/qsharedpointer/qsharedpointer.pro tests/auto/qstring/qstring.pro tests/auto/qtcpsocket/qtcpsocket.pro tests/auto/qtcpsocket/tst_qtcpsocket.cpp
Diffstat (limited to 'tests')
-rw-r--r--tests/arthur/data/1.2/textArea01.svg2
-rw-r--r--tests/arthur/data/qps/linear_gradients_perspectives_qps.pngbin78017 -> 77944 bytes
-rw-r--r--tests/arthur/data/qps/linear_gradients_qps.pngbin82119 -> 162643 bytes
-rw-r--r--tests/arthur/data/qps/lineconsistency_qps.pngbin12500 -> 12388 bytes
-rw-r--r--tests/arthur/data/qps/linedashes2_aa_qps.pngbin28956 -> 28418 bytes
-rw-r--r--tests/arthur/data/qps/paths_aa_qps.pngbin92711 -> 92147 bytes
-rw-r--r--tests/arthur/data/qps/paths_qps.pngbin20637 -> 20392 bytes
-rw-r--r--tests/arthur/data/qps/pixmap_scaling.qps346
-rw-r--r--tests/arthur/data/qps/radial_gradients_perspectives_qps.pngbin133150 -> 131744 bytes
-rw-r--r--tests/arthur/data/qps/radial_gradients_qps.pngbin156036 -> 161009 bytes
-rw-r--r--tests/arthur/data/qps/rasterops.qps167
-rw-r--r--tests/arthur/data/qps/rasterops_qps.pngbin20400 -> 11059 bytes
-rw-r--r--tests/arthur/data/qps/text_perspectives_qps.pngbin112750 -> 116847 bytes
-rw-r--r--tests/arthur/data/qps/text_qps.pngbin72027 -> 32991 bytes
-rw-r--r--tests/arthur/lance/interactivewidget.cpp2
-rw-r--r--tests/arthur/lance/lance.pro2
-rw-r--r--tests/arthur/lance/main.cpp16
-rw-r--r--tests/arthur/lance/widgets.h151
-rw-r--r--tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp47
-rw-r--r--tests/auto/math3d/qquaternion/tst_qquaternion.cpp52
-rw-r--r--tests/auto/math3d/qvectornd/tst_qvectornd.cpp96
-rw-r--r--tests/auto/moc/os9-newlines.h2
-rw-r--r--tests/auto/moc/tst_moc.cpp7
-rw-r--r--tests/auto/q3socket/tst_qsocket.cpp14
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp6
-rw-r--r--tests/auto/q3urloperator/tst_q3urloperator.cpp12
-rw-r--r--tests/auto/qbytearray/tst_qbytearray.cpp2
-rw-r--r--tests/auto/qcompleter/tst_qcompleter.cpp27
-rw-r--r--tests/auto/qdir/tst_qdir.cpp77
-rw-r--r--tests/auto/qdiriterator/tst_qdiriterator.cpp20
-rw-r--r--tests/auto/qdom/qdom.pro4
-rw-r--r--tests/auto/qdom/tst_qdom.cpp54
-rw-r--r--tests/auto/qfilesystemmodel/qfilesystemmodel.pro2
-rw-r--r--tests/auto/qformlayout/tst_qformlayout.cpp30
-rw-r--r--tests/auto/qgl/tst_qgl.cpp330
-rw-r--r--tests/auto/qguard/qguard.pro2
-rw-r--r--tests/auto/qguard/tst_qguard.cpp350
-rw-r--r--tests/auto/qhelpenginecore/data/collection.qhcbin10240 -> 10240 bytes
-rw-r--r--tests/auto/qhelpenginecore/data/collection1.qhcbin10240 -> 10240 bytes
-rw-r--r--tests/auto/qhelpenginecore/data/linguist-3.3.8.qchbin131072 -> 131072 bytes
-rw-r--r--tests/auto/qhelpenginecore/data/qmake-3.3.8.qchbin61440 -> 61440 bytes
-rw-r--r--tests/auto/qhelpenginecore/data/qmake-4.3.0.qchbin93184 -> 93184 bytes
-rw-r--r--tests/auto/qhelpenginecore/data/test.qchbin22528 -> 22528 bytes
-rw-r--r--tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp40
-rw-r--r--tests/auto/qhelpindexmodel/data/collection.qhcbin10240 -> 10240 bytes
-rw-r--r--tests/auto/qhelpindexmodel/data/collection1.qhcbin10240 -> 10240 bytes
-rw-r--r--tests/auto/qhelpindexmodel/data/linguist-3.3.8.qchbin131072 -> 131072 bytes
-rw-r--r--tests/auto/qhelpindexmodel/data/qmake-3.3.8.qchbin61440 -> 61440 bytes
-rw-r--r--tests/auto/qhelpindexmodel/data/qmake-4.3.0.qchbin93184 -> 93184 bytes
-rw-r--r--tests/auto/qhelpindexmodel/data/test.qchbin22528 -> 22528 bytes
-rw-r--r--tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp6
-rw-r--r--tests/auto/qhttp/qhttp.pro2
-rw-r--r--tests/auto/qline/qline.pro5
-rw-r--r--tests/auto/qlocale/tst_qlocale.cpp16
-rw-r--r--tests/auto/qmake/testdata/simple_app_build/README1
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp36
-rw-r--r--tests/auto/qmetaobject/qmetaobject.pro3
-rw-r--r--tests/auto/qmetaobject/tst_qmetaobject.cpp34
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp263
-rw-r--r--tests/auto/qnumeric/tst_qnumeric.cpp5
-rw-r--r--tests/auto/qobject/tst_qobject.cpp11
-rw-r--r--tests/auto/qobjectrace/tst_qobjectrace.cpp8
-rw-r--r--tests/auto/qreadwritelock/tst_qreadwritelock.cpp2
-rw-r--r--tests/auto/qregexp/qregexp.pro3
-rw-r--r--tests/auto/qresourceengine/qresourceengine.pro1
-rw-r--r--tests/auto/qresourceengine/tst_resourceengine.cpp2
-rw-r--r--tests/auto/qscriptcontext/tst_qscriptcontext.cpp30
-rw-r--r--tests/auto/qscriptengine/qscriptengine.pro2
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp134
-rw-r--r--tests/auto/qscriptqobject/qscriptqobject.pro2
-rw-r--r--tests/auto/qscriptvalue/qscriptvalue.pro2
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp8
-rw-r--r--tests/auto/qsharedpointer/qsharedpointer.pro11
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp297
-rw-r--r--tests/auto/qsharedpointer/wrapper.cpp60
-rw-r--r--tests/auto/qsharedpointer/wrapper.h55
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp4
-rw-r--r--tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp8
-rw-r--r--tests/auto/qstate/tst_qstate.cpp5
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp71
-rw-r--r--tests/auto/qtcpsocket/qtcpsocket.pro2
-rw-r--r--tests/auto/qtcpsocket/test/test.pro1
-rw-r--r--tests/auto/qtcpsocket/tst_qtcpsocket.cpp27
-rw-r--r--tests/auto/qthreadonce/tst_qthreadonce.cpp2
-rw-r--r--tests/auto/qthreadpool/tst_qthreadpool.cpp6
-rw-r--r--tests/auto/qxmlsimplereader/parser/main.cpp1
-rw-r--r--tests/auto/selftests/expected_longstring.txt16
-rw-r--r--tests/auto/selftests/longstring/longstring.pro10
-rw-r--r--tests/auto/selftests/longstring/tst_longstring.cpp72
-rw-r--r--tests/auto/selftests/selftests.pro2
-rw-r--r--tests/auto/selftests/selftests.qrc1
-rw-r--r--tests/auto/selftests/tst_selftests.cpp8
-rw-r--r--tests/auto/uic3/uic3.pro3
-rw-r--r--tests/manual/qdesktopwidget/main.cpp2
-rw-r--r--tests/manual/windowflags/controllerwindow.cpp263
-rw-r--r--tests/manual/windowflags/controllerwindow.h115
-rw-r--r--tests/manual/windowflags/main.cpp52
-rw-r--r--tests/manual/windowflags/previewwindow.cpp146
-rw-r--r--tests/manual/windowflags/previewwindow.h81
-rw-r--r--tests/manual/windowflags/windowflags.pro5
100 files changed, 3263 insertions, 499 deletions
diff --git a/tests/arthur/data/1.2/textArea01.svg b/tests/arthur/data/1.2/textArea01.svg
index 79fcd0a..945c34c 100644
--- a/tests/arthur/data/1.2/textArea01.svg
+++ b/tests/arthur/data/1.2/textArea01.svg
@@ -6,5 +6,5 @@
height="300">Tomorrow, and tomorrow, and
tomorrow; creeps in this petty pace from day to day, until the last syll&#xAD;able of recorded
time. And all our yesterdays have lighted fools the way to dusty death.</textArea>
- <rect x="5" y="5" width="210" height="310" stroke-width="3" stroke="#777"/>
+ <rect x="5" y="5" width="210" height="310" stroke-width="3" stroke="#777" fill="none"/>
</svg>
diff --git a/tests/arthur/data/qps/linear_gradients_perspectives_qps.png b/tests/arthur/data/qps/linear_gradients_perspectives_qps.png
index 42ba872..3315ebe 100644
--- a/tests/arthur/data/qps/linear_gradients_perspectives_qps.png
+++ b/tests/arthur/data/qps/linear_gradients_perspectives_qps.png
Binary files differ
diff --git a/tests/arthur/data/qps/linear_gradients_qps.png b/tests/arthur/data/qps/linear_gradients_qps.png
index dc5223b..a4cdc43 100644
--- a/tests/arthur/data/qps/linear_gradients_qps.png
+++ b/tests/arthur/data/qps/linear_gradients_qps.png
Binary files differ
diff --git a/tests/arthur/data/qps/lineconsistency_qps.png b/tests/arthur/data/qps/lineconsistency_qps.png
index 48768ef..9d19a5d 100644
--- a/tests/arthur/data/qps/lineconsistency_qps.png
+++ b/tests/arthur/data/qps/lineconsistency_qps.png
Binary files differ
diff --git a/tests/arthur/data/qps/linedashes2_aa_qps.png b/tests/arthur/data/qps/linedashes2_aa_qps.png
index 0cb5b40..54c84b3 100644
--- a/tests/arthur/data/qps/linedashes2_aa_qps.png
+++ b/tests/arthur/data/qps/linedashes2_aa_qps.png
Binary files differ
diff --git a/tests/arthur/data/qps/paths_aa_qps.png b/tests/arthur/data/qps/paths_aa_qps.png
index 45b4b74..e51a4ac 100644
--- a/tests/arthur/data/qps/paths_aa_qps.png
+++ b/tests/arthur/data/qps/paths_aa_qps.png
Binary files differ
diff --git a/tests/arthur/data/qps/paths_qps.png b/tests/arthur/data/qps/paths_qps.png
index a9a8743..094a84f 100644
--- a/tests/arthur/data/qps/paths_qps.png
+++ b/tests/arthur/data/qps/paths_qps.png
Binary files differ
diff --git a/tests/arthur/data/qps/pixmap_scaling.qps b/tests/arthur/data/qps/pixmap_scaling.qps
index 81b8fae..c5053ad 100644
--- a/tests/arthur/data/qps/pixmap_scaling.qps
+++ b/tests/arthur/data/qps/pixmap_scaling.qps
@@ -3,8 +3,8 @@
translate 5 25
setFont "arial" 8
-save
- drawText 15 0 "opaque image"
+save
+ drawText 15 0 "opaque image"
translate 50 50
save
translate 1 1
@@ -16,23 +16,23 @@ save
scale -20 20
drawImage solid2x2.png 0 0
restore
- save
+ save
translate 1 -1
scale 20 -20
drawImage solid2x2.png 0 0
restore
- save
+ save
translate -1 -1
scale -20 -20
drawImage solid2x2.png 0 0
restore
-
-restore
+
+restore
save
translate 150 0
- drawText 15 0 "alpha image"
+ drawText 15 0 "alpha image"
translate 50 50
save
translate 1 1
@@ -44,12 +44,12 @@ save
scale -20 20
drawImage alpha2x2.png 0 0
restore
- save
+ save
translate 1 -1
scale 20 -20
drawImage alpha2x2.png 0 0
restore
- save
+ save
translate -1 -1
scale -20 -20
drawImage alpha2x2.png 0 0
@@ -59,7 +59,7 @@ restore
save
translate 0 150
- drawText 15 0 "solid pixmap"
+ drawText 15 0 "solid pixmap"
translate 50 50
save
translate 1 1
@@ -71,12 +71,12 @@ save
scale -20 20
drawPixmap solid2x2.png 0 0
restore
- save
+ save
translate 1 -1
scale 20 -20
drawPixmap solid2x2.png 0 0
restore
- save
+ save
translate -1 -1
scale -20 -20
drawPixmap solid2x2.png 0 0
@@ -85,9 +85,9 @@ restore
save
- translate 150 150
+ translate 150 150
drawText 15 0 "alpha pixmap"
- translate 50 50
+ translate 50 50
save
translate 1 1
scale 20 20
@@ -98,12 +98,12 @@ save
scale -20 20
drawPixmap alpha2x2.png 0 0
restore
- save
+ save
translate 1 -1
scale 20 -20
drawPixmap alpha2x2.png 0 0
restore
- save
+ save
translate -1 -1
scale -20 -20
drawPixmap alpha2x2.png 0 0
@@ -111,7 +111,7 @@ save
restore
-save
+save
translate 300 10
save
drawText 0 -10 "subrect solid image"
@@ -138,7 +138,7 @@ save
drawImage solid2x2.png 45 0 5 50 1.8 0 0.2 2
restore
- save
+ save
translate 150 0
drawText 0 -10 "subrect solid image"
drawImage alpha2x2.png 0 0 50 5 0 0.0 2 0.2
@@ -151,7 +151,7 @@ save
drawImage alpha2x2.png 0 35 50 5 0 1.4 2 0.2
drawImage alpha2x2.png 0 40 50 5 0 1.6 2 0.2
drawImage alpha2x2.png 0 45 50 5 0 1.8 2 0.2
- translate 60 0
+ translate 60 0
drawImage alpha2x2.png 0 0 5 50 0.0 0 0.2 2
drawImage alpha2x2.png 5 0 5 50 0.2 0 0.2 2
drawImage alpha2x2.png 10 0 5 50 0.4 0 0.2 2
@@ -217,3 +217,311 @@ save
restore
restore
+
+
+
+image_load alpha2x2.png alpha2x2
+image_convertToFormat alpha2x2 alpha2x2_argb32 ARGB32
+image_convertToFormat alpha2x2 alpha2x2_argb32pre ARGB32_Premultiplied
+image_convertToFormat alpha2x2 alpha2x2_rgb888 Format_RGB888
+image_convertToFormat alpha2x2 alpha2x2_rgb32 RGB32
+image_convertToFormat alpha2x2 alpha2x2_rgb16 Format_RGB16
+
+save
+ translate 0 300
+ drawText 15 0 "drawImage - argb32"
+ translate 50 50
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_argb32 0 0
+ restore
+restore
+
+save
+ translate 150 300
+ drawText 15 0 "drawImage - argb32premul"
+ translate 50 50
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+restore
+
+
+
+save
+ translate 0 450
+ drawText 15 0 "drawImage - rgb888"
+ translate 50 50
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_rgb888 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_rgb888 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_rgb888 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_rgb888 0 0
+ restore
+restore
+
+save
+ translate 150 450
+ drawText 15 0 "drawImage - rgb32"
+ translate 50 50
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_rgb32 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_rgb32 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_rgb32 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_rgb32 0 0
+ restore
+restore
+
+save
+ translate 300 450
+ drawText 15 0 "drawImage - rgb16"
+ translate 50 50
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+restore
+
+
+
+save
+ translate 0 600
+ drawText 15 0 "clipping - argb32"
+ translate 50 50
+ setClipRect -30 -30 60 60 ReplaceClip
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_argb32 0 0
+ restore
+restore
+
+save
+ translate 150 600
+ drawText 15 0 "clipping - argb32premul"
+ translate 50 50
+ setClipRect -30 -30 60 60 ReplaceClip
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+restore
+
+save
+ translate 300 600
+ drawText 15 0 "clipping - rgb16"
+ translate 50 50
+ setClipRect -30 -30 60 60 ReplaceClip
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+restore
+
+
+path_addEllipse ellipse -30 -30 60 60
+
+save
+ translate 0 750
+ drawText 15 0 "clipping - argb32"
+ translate 50 50
+ setClipPath ellipse ReplaceClip
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_argb32 0 0
+ restore
+restore
+
+save
+ translate 150 750
+ drawText 15 0 "clipping - argb32premul"
+ translate 50 50
+ setClipPath ellipse ReplaceClip
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+restore
+
+save
+ translate 300 750
+ drawText 15 0 "clipping - rgb16"
+ translate 50 50
+ setClipPath ellipse ReplaceClip
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+restore
diff --git a/tests/arthur/data/qps/radial_gradients_perspectives_qps.png b/tests/arthur/data/qps/radial_gradients_perspectives_qps.png
index 0e28aae..d833250 100644
--- a/tests/arthur/data/qps/radial_gradients_perspectives_qps.png
+++ b/tests/arthur/data/qps/radial_gradients_perspectives_qps.png
Binary files differ
diff --git a/tests/arthur/data/qps/radial_gradients_qps.png b/tests/arthur/data/qps/radial_gradients_qps.png
index 66fcfc4..11043e8 100644
--- a/tests/arthur/data/qps/radial_gradients_qps.png
+++ b/tests/arthur/data/qps/radial_gradients_qps.png
Binary files differ
diff --git a/tests/arthur/data/qps/rasterops.qps b/tests/arthur/data/qps/rasterops.qps
index b79ec0d..ee3deca 100644
--- a/tests/arthur/data/qps/rasterops.qps
+++ b/tests/arthur/data/qps/rasterops.qps
@@ -1,83 +1,84 @@
-setPen NoPen
-
-setBrush black
-drawRect 10 10 1200 140
-
-setCompositionMode SourceOrDestination
-translate 20 20
-begin_block drawShape
-setBrush 0xffff0000
-drawEllipse 10 10 80 80
-setBrush 0xff00ff00
-drawRect 0 0 50 50
-setBrush 0xff0000ff
-drawRect 50 50 50 50
-end_block
-
-begin_block loop
-setCompositionMode SourceAndDestination
-translate 120 0
-repeat_block drawShape
-
-setCompositionMode SourceXorDestination
-translate 120 0
-repeat_block drawShape
-
-setCompositionMode NotSourceAndNotDestination
-translate 120 0
-repeat_block drawShape
-
-setCompositionMode NotSourceOrNotDestination
-translate 120 0
-repeat_block drawShape
-
-setCompositionMode NotSourceXorDestination
-translate 120 0
-repeat_block drawShape
-
-setCompositionMode NotSource
-translate 120 0
-repeat_block drawShape
-
-setCompositionMode NotSourceAndDestination
-translate 120 0
-repeat_block drawShape
-
-setCompositionMode SourceAndNotDestination
-translate 120 0
-repeat_block drawShape
-end_block
-
-resetMatrix
-setCompositionMode Source
-setBrush white
-drawRect 10 160 1200 140
-translate 20 170
-repeat_block loop
-
-resetMatrix
-setCompositionMode Source
-translate 20 320
-repeat_block loop
-
-resetMatrix
-setPen black
-setCompositionMode SourceOver
-translate 20 470
-drawText 20 0 "Or ROP"
-translate 120 0
-drawText 20 0 "And ROP"
-translate 120 0
-drawText 20 0 "Xor ROP"
-translate 120 0
-drawText 20 0 "Nor ROP"
-translate 120 0
-drawText 20 0 "Nand ROP"
-translate 120 0
-drawText 0 0 "NSrcXorDst ROP"
-translate 120 0
-drawText 20 0 "NSrc ROP"
-translate 120 0
-drawText 0 0 "NSrcAndDst ROP"
-translate 120 0
-drawText 0 0 "SrcAndNDst ROP"
+setPen NoPen
+
+setBrush black
+drawRect 10 10 60 500
+
+setCompositionMode SourceOrDestination
+translate 20 20
+
+begin_block drawShape
+ setBrush 0xffff0000
+ drawEllipse 5 5 30 30
+ setBrush 0xff00ff00
+ drawRect 0 0 20 20
+ setBrush 0xff0000ff
+ drawRect 20 20 20 20
+end_block
+
+begin_block loop
+ setCompositionMode SourceAndDestination
+ translate 0 50
+repeat_block drawShape
+
+setCompositionMode SourceXorDestination
+translate 0 50
+repeat_block drawShape
+
+setCompositionMode NotSourceAndNotDestination
+translate 0 50
+repeat_block drawShape
+
+setCompositionMode NotSourceOrNotDestination
+translate 0 50
+repeat_block drawShape
+
+setCompositionMode NotSourceXorDestination
+translate 0 50
+repeat_block drawShape
+
+setCompositionMode NotSource
+translate 0 50
+repeat_block drawShape
+
+setCompositionMode NotSourceAndDestination
+translate 0 50
+repeat_block drawShape
+
+setCompositionMode SourceAndNotDestination
+translate 0 50
+repeat_block drawShape
+end_block
+
+resetMatrix
+setCompositionMode Source
+setBrush white
+drawRect 100 10 60 500
+translate 110 20
+repeat_block loop
+
+resetMatrix
+setCompositionMode Source
+translate 190 20
+repeat_block loop
+
+resetMatrix
+setPen black
+setCompositionMode SourceOver
+translate 250 45
+drawText 20 0 "Or ROP"
+translate 0 50
+drawText 20 0 "And ROP"
+translate 0 50
+drawText 20 0 "Xor ROP"
+translate 0 50
+drawText 20 0 "Nor ROP"
+translate 0 50
+drawText 20 0 "Nand ROP"
+translate 0 50
+drawText 0 0 "NSrcXorDst ROP"
+translate 0 50
+drawText 20 0 "NSrc ROP"
+translate 0 50
+drawText 0 0 "NSrcAndDst ROP"
+translate 0 50
+drawText 0 0 "SrcAndNDst ROP"
diff --git a/tests/arthur/data/qps/rasterops_qps.png b/tests/arthur/data/qps/rasterops_qps.png
index 80ca8ae..7b93001 100644
--- a/tests/arthur/data/qps/rasterops_qps.png
+++ b/tests/arthur/data/qps/rasterops_qps.png
Binary files differ
diff --git a/tests/arthur/data/qps/text_perspectives_qps.png b/tests/arthur/data/qps/text_perspectives_qps.png
index 483ccc0..183ad6f 100644
--- a/tests/arthur/data/qps/text_perspectives_qps.png
+++ b/tests/arthur/data/qps/text_perspectives_qps.png
Binary files differ
diff --git a/tests/arthur/data/qps/text_qps.png b/tests/arthur/data/qps/text_qps.png
index 2c2ebf2..9a95493 100644
--- a/tests/arthur/data/qps/text_qps.png
+++ b/tests/arthur/data/qps/text_qps.png
Binary files differ
diff --git a/tests/arthur/lance/interactivewidget.cpp b/tests/arthur/lance/interactivewidget.cpp
index 0febbed..0c2c7a6 100644
--- a/tests/arthur/lance/interactivewidget.cpp
+++ b/tests/arthur/lance/interactivewidget.cpp
@@ -43,7 +43,7 @@
InteractiveWidget::InteractiveWidget()
{
- m_onScreenWidget = new OnScreenWidget<QWidget>();
+ m_onScreenWidget = new OnScreenWidget<QWidget>("");
m_onScreenWidget->setMinimumSize(320, 240);
setCentralWidget(m_onScreenWidget);
diff --git a/tests/arthur/lance/lance.pro b/tests/arthur/lance/lance.pro
index 341eabc..3692f21 100644
--- a/tests/arthur/lance/lance.pro
+++ b/tests/arthur/lance/lance.pro
@@ -6,7 +6,7 @@ INCLUDEPATH += .
# Input
HEADERS += widgets.h interactivewidget.h
-SOURCES += interactivewidget.cpp main.cpp
+SOURCES += interactivewidget.cpp main.cpp
RESOURCES += icons.qrc
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2):QT += opengl
diff --git a/tests/arthur/lance/main.cpp b/tests/arthur/lance/main.cpp
index 4e5437e..b199cd5 100644
--- a/tests/arthur/lance/main.cpp
+++ b/tests/arthur/lance/main.cpp
@@ -66,7 +66,7 @@ extern bool qt_show_painter_debug_output = false;
//#define CONSOLE_APPLICATION
-static const struct {
+static const struct {
const char *name;
QImage::Format format;
} imageFormats[] = {
@@ -281,7 +281,7 @@ int main(int argc, char **argv)
if (imageFormat == QImage::Format_Invalid) {
printf("Invalid image format. Available formats are:\n");
- for (int ff = 0; ff < formatCount; ++ff)
+ for (int ff = 0; ff < formatCount; ++ff)
printf("\t%s\n", imageFormats[ff].name);
return -1;
}
@@ -402,12 +402,10 @@ int main(int argc, char **argv)
case WidgetType:
{
OnScreenWidget<QWidget> *qWidget =
- new OnScreenWidget<QWidget>;
+ new OnScreenWidget<QWidget>(files.at(j));
qWidget->setVerboseMode(verboseMode);
qWidget->setType(type);
qWidget->setCheckersBackground(checkers_background);
- qWidget->m_filename = files.at(j);
- qWidget->setWindowTitle(fileinfo.filePath());
qWidget->m_commands = content;
qWidget->resize(width, height);
qWidget->show();
@@ -417,12 +415,10 @@ int main(int argc, char **argv)
case ImageWidgetType:
{
- OnScreenWidget<QWidget> *qWidget = new OnScreenWidget<QWidget>;
+ OnScreenWidget<QWidget> *qWidget = new OnScreenWidget<QWidget>(files.at(j));
qWidget->setVerboseMode(verboseMode);
qWidget->setType(type);
qWidget->setCheckersBackground(checkers_background);
- qWidget->m_filename = files.at(j);
- qWidget->setWindowTitle(fileinfo.filePath());
qWidget->m_commands = content;
qWidget->resize(width, height);
qWidget->show();
@@ -451,12 +447,10 @@ int main(int argc, char **argv)
}
case OpenGLType:
{
- OnScreenWidget<QGLWidget> *qGLWidget = new OnScreenWidget<QGLWidget>;
+ OnScreenWidget<QGLWidget> *qGLWidget = new OnScreenWidget<QGLWidget>(files.at(j));
qGLWidget->setVerboseMode(verboseMode);
qGLWidget->setType(type);
qGLWidget->setCheckersBackground(checkers_background);
- qGLWidget->m_filename = files.at(j);
- qGLWidget->setWindowTitle(fileinfo.filePath());
qGLWidget->m_commands = content;
qGLWidget->resize(width, height);
qGLWidget->show();
diff --git a/tests/arthur/lance/widgets.h b/tests/arthur/lance/widgets.h
index 271c18a..7247608 100644
--- a/tests/arthur/lance/widgets.h
+++ b/tests/arthur/lance/widgets.h
@@ -57,15 +57,47 @@
#include <QTextStream>
#include <QPaintEngine>
+#include <private/qwindowsurface_p.h>
+
#include <qmath.h>
const int CP_RADIUS = 10;
+class StupidWorkaround : public QObject
+{
+ Q_OBJECT
+public:
+ StupidWorkaround(QWidget *widget, int *value)
+ : QObject(widget), w(widget), mode(value)
+ {
+ }
+
+public slots:
+ void setViewMode(int m) {
+ *mode = m;
+ w->update();
+ }
+
+private:
+ QWidget *w;
+ int *mode;
+};
+
template <class T>
class OnScreenWidget : public T
{
public:
- OnScreenWidget(QWidget *parent = 0) : T(parent)
+
+ enum ViewMode {
+ RenderView,
+ BaselineView,
+ DifferenceView
+ };
+
+ OnScreenWidget(const QString &file, QWidget *parent = 0)
+ : T(parent),
+ m_view_mode(RenderView),
+ m_filename(file)
{
QSettings settings("Trolltech", "lance");
for (int i=0; i<10; ++i) {
@@ -78,11 +110,47 @@ public:
m_deviceType = WidgetType;
m_checkersBackground = true;
m_verboseMode = false;
- }
- void setVerboseMode(bool v) { m_verboseMode = v; }
- void setCheckersBackground(bool b) { m_checkersBackground = b; }
- void setType(DeviceType t) { m_deviceType = t; }
+ m_baseline_name = QString(m_filename).replace(".qps", "_qps") + ".png";
+ if (QFileInfo(m_baseline_name).exists()) {
+ m_baseline = QPixmap(m_baseline_name);
+ }
+
+ if (m_baseline.isNull()) {
+ setWindowTitle("Rendering: '" + file + "'. No baseline available");
+ } else {
+ setWindowTitle("Rendering: '" + file + "'. Shortcuts: 1=render, 2=baseline, 3=difference");
+
+ StupidWorkaround *workaround = new StupidWorkaround(this, &m_view_mode);
+
+ QSignalMapper *mapper = new QSignalMapper(this);
+ connect(mapper, SIGNAL(mapped(int)), workaround, SLOT(setViewMode(int)));
+ connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setWindowTitle(QString)));
+
+ QAction *renderViewAction = new QAction("Render View", this);
+ renderViewAction->setShortcut(Qt::Key_1);
+ connect(renderViewAction, SIGNAL(triggered()), mapper, SLOT(map()));
+ mapper->setMapping(renderViewAction, RenderView);
+ mapper->setMapping(renderViewAction, "Render View: " + file);
+ addAction(renderViewAction);
+
+ QAction *baselineAction = new QAction("Baseline", this);
+ baselineAction->setShortcut(Qt::Key_2);
+ connect(baselineAction, SIGNAL(triggered()), mapper, SLOT(map()));
+ mapper->setMapping(baselineAction, BaselineView);
+ mapper->setMapping(baselineAction, "Baseline View: " + file);
+ addAction(baselineAction);
+
+ QAction *differenceAction = new QAction("Differenfe View", this);
+ differenceAction->setShortcut(Qt::Key_3);
+ connect(differenceAction, SIGNAL(triggered()), mapper, SLOT(map()));
+ mapper->setMapping(differenceAction, DifferenceView);
+ mapper->setMapping(differenceAction, "Difference View" + file);
+ addAction(differenceAction);
+
+ }
+
+ }
~OnScreenWidget()
{
@@ -93,12 +161,24 @@ public:
settings.sync();
}
+ void setVerboseMode(bool v) { m_verboseMode = v; }
+ void setCheckersBackground(bool b) { m_checkersBackground = b; }
+ void setType(DeviceType t) { m_deviceType = t; }
+
void resizeEvent(QResizeEvent *e) {
m_image = QImage();
T::resizeEvent(e);
}
- void paintEvent(QPaintEvent *)
+ void paintEvent(QPaintEvent *) {
+ switch (m_view_mode) {
+ case RenderView: paintRenderView(); break;
+ case BaselineView: paintBaselineView(); break;
+ case DifferenceView: paintDifferenceView(); break;
+ }
+ }
+
+ void OnScreenWidget<T>::paintRenderView()
{
QPainter pt;
QPaintDevice *dev = this;
@@ -152,6 +232,57 @@ public:
}
}
+ if (m_render_view.isNull()) {
+ m_render_view = window()->windowSurface()->grabWidget(this);
+ m_render_view.save("renderView.png");
+ }
+ }
+
+ void paintBaselineView() {
+ QPainter p(this);
+
+ if (m_baseline.isNull()) {
+ p.drawText(rect(), Qt::AlignCenter,
+ "No baseline found\n"
+ "file '" + m_baseline_name + "' does not exist...");
+ return;
+ }
+
+ p.drawPixmap(0, 0, m_baseline);
+
+ p.setPen(QColor::fromRgb(0, 0, 0, 0.1));
+ p.setFont(QFont("Arial", 128));
+ p.rotate(45);
+ p.drawText(100, 0, "BASELINE");
+ }
+
+ QPixmap generateDifference()
+ {
+ QImage img(size(), QImage::Format_RGB32);
+ img.fill(0);
+
+ QPainter p(&img);
+ p.drawPixmap(0, 0, m_render_view);
+
+ p.setCompositionMode(QPainter::RasterOp_SourceXorDestination);
+ p.drawPixmap(0, 0, m_baseline);
+
+ p.end();
+
+ return QPixmap::fromImage(img);
+ }
+
+ void paintDifferenceView() {
+ QPainter p(this);
+ if (m_baseline.isNull()) {
+ p.drawText(rect(), Qt::AlignCenter,
+ "No baseline found\n"
+ "file '" + m_baseline_name + "' does not exist...");
+ return;
+ }
+
+ p.fillRect(rect(), Qt::black);
+ p.drawPixmap(0, 0, generateDifference());
}
@@ -190,8 +321,6 @@ public:
T::update();
}
-
-
QSize sizeHint() const { return QSize(800, 800); }
QVector<QPointF> m_controlPoints;
@@ -200,12 +329,18 @@ public:
QStringList m_commands;
QString m_filename;
+ QString m_baseline_name;
bool m_verboseMode;
bool m_checkersBackground;
DeviceType m_deviceType;
+ int m_view_mode;
+
QImage m_image;
+
+ QPixmap m_baseline;
+ QPixmap m_render_view;
};
#endif
diff --git a/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
index d799c1b..fe1d0db 100644
--- a/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
+++ b/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
@@ -170,6 +170,9 @@ private slots:
void mapRect_data();
void mapRect();
+ void properties();
+ void metaTypes();
+
private:
static void setMatrix(QMatrix2x2& m, const qreal *values);
static void setMatrixDirect(QMatrix2x2& m, const qreal *values);
@@ -3331,6 +3334,50 @@ void tst_QMatrix::mapRect()
QVERIFY(mri == tri);
}
+class tst_QMatrix4x4Properties : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix)
+public:
+ tst_QMatrix4x4Properties(QObject *parent = 0) : QObject(parent) {}
+
+ QMatrix4x4 matrix() const { return m; }
+ void setMatrix(const QMatrix4x4& value) { m = value; }
+
+private:
+ QMatrix4x4 m;
+};
+
+// Test getting and setting matrix properties via the metaobject system.
+void tst_QMatrix::properties()
+{
+ tst_QMatrix4x4Properties obj;
+
+ QMatrix4x4 m1(uniqueValues4);
+ obj.setMatrix(m1);
+
+ QMatrix4x4 m2 = qVariantValue<QMatrix4x4>(obj.property("matrix"));
+ QVERIFY(isSame(m2, uniqueValues4));
+
+ QMatrix4x4 m3(transposedValues4);
+ obj.setProperty("matrix", qVariantFromValue(m3));
+
+ m2 = qVariantValue<QMatrix4x4>(obj.property("matrix"));
+ QVERIFY(isSame(m2, transposedValues4));
+}
+
+void tst_QMatrix::metaTypes()
+{
+ QVERIFY(QMetaType::type("QMatrix4x4") == QMetaType::QMatrix4x4);
+
+ QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QMatrix4x4)),
+ QByteArray("QMatrix4x4"));
+
+ QVERIFY(QMetaType::isRegistered(QMetaType::QMatrix4x4));
+
+ QVERIFY(qMetaTypeId<QMatrix4x4>() == QMetaType::QMatrix4x4);
+}
+
QTEST_APPLESS_MAIN(tst_QMatrix)
#include "tst_qmatrixnxn.moc"
diff --git a/tests/auto/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/math3d/qquaternion/tst_qquaternion.cpp
index 16b87a1..369f5ac 100644
--- a/tests/auto/math3d/qquaternion/tst_qquaternion.cpp
+++ b/tests/auto/math3d/qquaternion/tst_qquaternion.cpp
@@ -93,6 +93,9 @@ private slots:
void nlerp_data();
void nlerp();
+
+ void properties();
+ void metaTypes();
};
// qFuzzyCompare isn't always "fuzzy" enough to handle conversion
@@ -825,6 +828,55 @@ void tst_QQuaternion::nlerp()
QVERIFY(fuzzyCompare(result.scalar(), q3.scalar()));
}
+class tst_QQuaternionProperties : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuaternion quaternion READ quaternion WRITE setQuaternion)
+public:
+ tst_QQuaternionProperties(QObject *parent = 0) : QObject(parent) {}
+
+ QQuaternion quaternion() const { return q; }
+ void setQuaternion(const QQuaternion& value) { q = value; }
+
+private:
+ QQuaternion q;
+};
+
+// Test getting and setting quaternion properties via the metaobject system.
+void tst_QQuaternion::properties()
+{
+ tst_QQuaternionProperties obj;
+
+ obj.setQuaternion(QQuaternion(6.0f, 7.0f, 8.0f, 9.0f));
+
+ QQuaternion q = qVariantValue<QQuaternion>(obj.property("quaternion"));
+ QCOMPARE(q.scalar(), (qreal)6.0f);
+ QCOMPARE(q.x(), (qreal)7.0f);
+ QCOMPARE(q.y(), (qreal)8.0f);
+ QCOMPARE(q.z(), (qreal)9.0f);
+
+ obj.setProperty("quaternion",
+ qVariantFromValue(QQuaternion(-6.0f, -7.0f, -8.0f, -9.0f)));
+
+ q = qVariantValue<QQuaternion>(obj.property("quaternion"));
+ QCOMPARE(q.scalar(), (qreal)-6.0f);
+ QCOMPARE(q.x(), (qreal)-7.0f);
+ QCOMPARE(q.y(), (qreal)-8.0f);
+ QCOMPARE(q.z(), (qreal)-9.0f);
+}
+
+void tst_QQuaternion::metaTypes()
+{
+ QVERIFY(QMetaType::type("QQuaternion") == QMetaType::QQuaternion);
+
+ QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QQuaternion)),
+ QByteArray("QQuaternion"));
+
+ QVERIFY(QMetaType::isRegistered(QMetaType::QQuaternion));
+
+ QVERIFY(qMetaTypeId<QQuaternion>() == QMetaType::QQuaternion);
+}
+
QTEST_APPLESS_MAIN(tst_QQuaternion)
#include "tst_qquaternion.moc"
diff --git a/tests/auto/math3d/qvectornd/tst_qvectornd.cpp b/tests/auto/math3d/qvectornd/tst_qvectornd.cpp
index 9c1ea83..6368874 100644
--- a/tests/auto/math3d/qvectornd/tst_qvectornd.cpp
+++ b/tests/auto/math3d/qvectornd/tst_qvectornd.cpp
@@ -137,6 +137,9 @@ private slots:
void dotProduct3();
void dotProduct4_data();
void dotProduct4();
+
+ void properties();
+ void metaTypes();
};
// qFuzzyCompare isn't always "fuzzy" enough to handle conversion
@@ -2040,6 +2043,99 @@ void tst_QVector::dotProduct4()
QCOMPARE(QVector4D::dotProduct(v1, v2), d);
}
+class tst_QVectorProperties : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QVector2D vector2D READ vector2D WRITE setVector2D)
+ Q_PROPERTY(QVector3D vector3D READ vector3D WRITE setVector3D)
+ Q_PROPERTY(QVector4D vector4D READ vector4D WRITE setVector4D)
+public:
+ tst_QVectorProperties(QObject *parent = 0) : QObject(parent) {}
+
+ QVector2D vector2D() const { return v2; }
+ void setVector2D(const QVector2D& value) { v2 = value; }
+
+ QVector3D vector3D() const { return v3; }
+ void setVector3D(const QVector3D& value) { v3 = value; }
+
+ QVector4D vector4D() const { return v4; }
+ void setVector4D(const QVector4D& value) { v4 = value; }
+
+private:
+ QVector2D v2;
+ QVector3D v3;
+ QVector4D v4;
+};
+
+// Test getting and setting vector properties via the metaobject system.
+void tst_QVector::properties()
+{
+ tst_QVectorProperties obj;
+
+ obj.setVector2D(QVector2D(1.0f, 2.0f));
+ obj.setVector3D(QVector3D(3.0f, 4.0f, 5.0f));
+ obj.setVector4D(QVector4D(6.0f, 7.0f, 8.0f, 9.0f));
+
+ QVector2D v2 = qVariantValue<QVector2D>(obj.property("vector2D"));
+ QCOMPARE(v2.x(), (qreal)1.0f);
+ QCOMPARE(v2.y(), (qreal)2.0f);
+
+ QVector3D v3 = qVariantValue<QVector3D>(obj.property("vector3D"));
+ QCOMPARE(v3.x(), (qreal)3.0f);
+ QCOMPARE(v3.y(), (qreal)4.0f);
+ QCOMPARE(v3.z(), (qreal)5.0f);
+
+ QVector4D v4 = qVariantValue<QVector4D>(obj.property("vector4D"));
+ QCOMPARE(v4.x(), (qreal)6.0f);
+ QCOMPARE(v4.y(), (qreal)7.0f);
+ QCOMPARE(v4.z(), (qreal)8.0f);
+ QCOMPARE(v4.w(), (qreal)9.0f);
+
+ obj.setProperty("vector2D",
+ qVariantFromValue(QVector2D(-1.0f, -2.0f)));
+ obj.setProperty("vector3D",
+ qVariantFromValue(QVector3D(-3.0f, -4.0f, -5.0f)));
+ obj.setProperty("vector4D",
+ qVariantFromValue(QVector4D(-6.0f, -7.0f, -8.0f, -9.0f)));
+
+ v2 = qVariantValue<QVector2D>(obj.property("vector2D"));
+ QCOMPARE(v2.x(), (qreal)-1.0f);
+ QCOMPARE(v2.y(), (qreal)-2.0f);
+
+ v3 = qVariantValue<QVector3D>(obj.property("vector3D"));
+ QCOMPARE(v3.x(), (qreal)-3.0f);
+ QCOMPARE(v3.y(), (qreal)-4.0f);
+ QCOMPARE(v3.z(), (qreal)-5.0f);
+
+ v4 = qVariantValue<QVector4D>(obj.property("vector4D"));
+ QCOMPARE(v4.x(), (qreal)-6.0f);
+ QCOMPARE(v4.y(), (qreal)-7.0f);
+ QCOMPARE(v4.z(), (qreal)-8.0f);
+ QCOMPARE(v4.w(), (qreal)-9.0f);
+}
+
+void tst_QVector::metaTypes()
+{
+ QVERIFY(QMetaType::type("QVector2D") == QMetaType::QVector2D);
+ QVERIFY(QMetaType::type("QVector3D") == QMetaType::QVector3D);
+ QVERIFY(QMetaType::type("QVector4D") == QMetaType::QVector4D);
+
+ QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QVector2D)),
+ QByteArray("QVector2D"));
+ QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QVector3D)),
+ QByteArray("QVector3D"));
+ QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QVector4D)),
+ QByteArray("QVector4D"));
+
+ QVERIFY(QMetaType::isRegistered(QMetaType::QVector2D));
+ QVERIFY(QMetaType::isRegistered(QMetaType::QVector3D));
+ QVERIFY(QMetaType::isRegistered(QMetaType::QVector4D));
+
+ QVERIFY(qMetaTypeId<QVector2D>() == QMetaType::QVector2D);
+ QVERIFY(qMetaTypeId<QVector3D>() == QMetaType::QVector3D);
+ QVERIFY(qMetaTypeId<QVector4D>() == QMetaType::QVector4D);
+}
+
QTEST_APPLESS_MAIN(tst_QVector)
#include "tst_qvectornd.moc"
diff --git a/tests/auto/moc/os9-newlines.h b/tests/auto/moc/os9-newlines.h
index fb9bbe4..85fa671 100644
--- a/tests/auto/moc/os9-newlines.h
+++ b/tests/auto/moc/os9-newlines.h
@@ -1 +1 @@
-/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (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 http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QObject> class Os9Newlines : public QObject { Q_OBJECT public Q_SLOTS: inline void testSlot() {} };
+/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (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 http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QObject> class Os9Newlines : public QObject { Q_OBJECT public Q_SLOTS: inline void testSlot() {} }; \ No newline at end of file
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index d66791f..488f068 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -1157,6 +1157,13 @@ void tst_Moc::constructors()
QObject *o3 = mo->newInstance(Q_ARG(QString, str));
QVERIFY(o3 != 0);
QCOMPARE(qobject_cast<CtorTestClass*>(o3)->m_str, str);
+
+ {
+ //explicit constructor
+ QObject *o = QObject::staticMetaObject.newInstance();
+ QVERIFY(o);
+ delete o;
+ }
}
#include "task234909.h"
diff --git a/tests/auto/q3socket/tst_qsocket.cpp b/tests/auto/q3socket/tst_qsocket.cpp
index b07fa2f..854cc75 100644
--- a/tests/auto/q3socket/tst_qsocket.cpp
+++ b/tests/auto/q3socket/tst_qsocket.cpp
@@ -124,8 +124,10 @@ void tst_Q3Socket::peerAddress_data()
QTest::addColumn<bool>("peerClosesConnection");
QTest::addColumn<QString>("peerAddr");
- QTest::newRow( "echo" ) << QString("qt-test-server.troll.no") << (uint)7 << false << QString("10.3.3.69");
- QTest::newRow( "daytime" ) << QString("qt-test-server.troll.no") << (uint)13 << true << QString("10.3.3.69");
+ QTest::newRow( "echo" ) << QtNetworkSettings::serverLocalName() << (uint)7 << false
+ << QtNetworkSettings::serverIP().toString();
+ QTest::newRow( "daytime" ) << QtNetworkSettings::serverLocalName() << (uint)13 << true
+ << QtNetworkSettings::serverIP().toString();
}
void tst_Q3Socket::peerAddress()
@@ -191,7 +193,7 @@ void tst_Q3Socket::emitConnectionRefused()
{
Q3Socket sock;
connect( &sock, SIGNAL(error(int)), SLOT(emitConnectionRefused_error(int)) );
- sock.connectToHost( "ares.troll.no", 12331 );
+ sock.connectToHost( QtNetworkSettings::serverLocalName(), 12331 );
emitConnectionRefused_errorReceived = false;
QTestEventLoop::instance().enterLoop( 30 );
@@ -225,8 +227,8 @@ void tst_Q3Socket::connectionAttempts_data()
QTest::addColumn<int>("port");
QTest::addColumn<bool>("expectedResult");
- QTest::newRow("fluke port 80") << QString("qt-test-server.troll.no") << 80 << true;
- QTest::newRow("fluke port 79") << QString("qt-test-server.troll.no") << 79 << false;
+ QTest::newRow("fluke port 80") << QtNetworkSettings::serverLocalName() << 80 << true;
+ QTest::newRow("fluke port 79") << QtNetworkSettings::serverLocalName() << 79 << false;
}
void tst_Q3Socket::connectionAttempts()
@@ -266,7 +268,7 @@ void tst_Q3Socket::canReadLine()
connect(&socket, SIGNAL(connected()), &loop, SLOT(quit()));
// timeout error will fail in #238
connect(&socket, SIGNAL(error(int)), &loop, SLOT(quit()));
- socket.connectToHost("qt-test-server.troll.no", 143);
+ socket.connectToHost(QtNetworkSettings::serverLocalName(), 143);
loop.exec();
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
index e4b1a55..e5a9b01 100644
--- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
+++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
@@ -548,7 +548,7 @@ void tst_Q3SqlCursor::unicode()
else
QFAIL( QString( "Strings differ at position %1: orig: %2, db: %3" ).arg( i ).arg( utf8str[ i ].unicode(), 0, 16 ).arg( res[ i ].unicode(), 0, 16 ) );
}
- if(db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QDB2"))
+ if((db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QDB2")) && res != utf8str)
QEXPECT_FAIL("", "See above message", Continue);
QVERIFY( res == utf8str );
}
@@ -721,7 +721,9 @@ void tst_Q3SqlCursor::updateNoPK()
// Sqlite returns 2, don't ask why.
QVERIFY(cur.update() != 0);
QString expect = "update " + qTableName("qtestPK") +
- " set id = 1 , name = NULL , num = NULL where " + qTableName("qtestPK") + ".id"
+ " set "+db.driver()->escapeIdentifier("id", QSqlDriver::FieldName)+" = 1 , "
+ +db.driver()->escapeIdentifier("name", QSqlDriver::FieldName)+" = NULL , "
+ +db.driver()->escapeIdentifier("num", QSqlDriver::FieldName)+" = NULL where " + qTableName("qtestPK") + ".id"
" IS NULL and " + qTableName("qtestPK") + ".name IS NULL and " +
qTableName("qtestPK") + ".num IS NULL";
if (!db.driver()->hasFeature(QSqlDriver::PreparedQueries)) {
diff --git a/tests/auto/q3urloperator/tst_q3urloperator.cpp b/tests/auto/q3urloperator/tst_q3urloperator.cpp
index f1e1059..a9e5096 100644
--- a/tests/auto/q3urloperator/tst_q3urloperator.cpp
+++ b/tests/auto/q3urloperator/tst_q3urloperator.cpp
@@ -55,6 +55,8 @@
#include <q3valuelist.h>
#include <qlist.h>
+#include "../network-settings.h"
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -150,7 +152,7 @@ void tst_Q3UrlOperator::initTestCase()
// prepare: make sure that there is a unique directory for FTP upload
// testing (to avoid parallel executed tests interfere with each other)
- ftpQtestUpload = "ftp://qt-test-server.troll.no/";
+ ftpQtestUpload = QString("ftp://%1/").arg(QtNetworkSettings::serverLocalName());
QString dir = QString( "qtest/upload/%1" ).arg( (ulong)this );
Q3UrlOperator opMkdir( ftpQtestUpload );
@@ -218,8 +220,8 @@ void tst_Q3UrlOperator::cleanup()
void tst_Q3UrlOperator::copy_data()
{
- const QString ftpQtest( "ftp://qt-test-server.troll.no/qtest" );
- const QString httpQtest( "http://qt-test-server.troll.no/qtest" );
+ const QString ftpQtest( QString("ftp://%1/qtest").arg(QtNetworkSettings::serverLocalName()) );
+ const QString httpQtest( QString("http://%1/qtest").arg(QtNetworkSettings::serverLocalName()) );
// argument for the constructor
QTest::addColumn<QString>("url");
@@ -339,8 +341,8 @@ void tst_Q3UrlOperator::slotFinished_copy( Q3NetworkOperation *op )
void tst_Q3UrlOperator::put_data()
{
- const QString httpQtest( "http://qt-test-server.troll.no/qtest/cgi-bin" );
- const QString httpQtestGet( "http://qt-test-server.troll.no/qtest/cgi-bin/retrieve_testfile.cgi" );
+ const QString httpQtest( QString("http://%1/qtest/cgi-bin").arg(QtNetworkSettings::serverLocalName()) );
+ const QString httpQtestGet( QString("http://%1/qtest/cgi-bin/retrieve_testfile.cgi").arg(QtNetworkSettings::serverLocalName()) );
QByteArray putData_1( 5 );
putData_1[0] = 'a';
diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp
index 5daaffd..e338028 100644
--- a/tests/auto/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/qbytearray/tst_qbytearray.cpp
@@ -240,7 +240,7 @@ void tst_QByteArray::qUncompress()
#elif defined Q_OS_SOLARIS
QSKIP("Corrupt data causes this tests to lock up on Solaris", SkipAll);
#elif defined Q_OS_QNX
- QSKIP("Currupt data cuases this test to lock up on QNX", SkipAll);
+ QSKIP("Corrupt data causes this test to lock up on QNX", SkipAll);
#endif
QTEST(::qUncompress(in), "out");
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp
index 46d78c4..8ce59a4 100644
--- a/tests/auto/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/qcompleter/tst_qcompleter.cpp
@@ -138,6 +138,7 @@ private slots:
void setters();
void dynamicSortOrder();
+ void disabledItems();
// task-specific tests below me
void task178797_activatedOnReturn();
@@ -147,7 +148,6 @@ private slots:
void task253125_lineEditCompletion_data();
void task253125_lineEditCompletion();
-
void task247560_keyboardNavigation();
private:
@@ -1109,6 +1109,31 @@ void tst_QCompleter::dynamicSortOrder()
QCOMPARE(completer.completionCount(), 12);
}
+void tst_QCompleter::disabledItems()
+{
+ QLineEdit lineEdit;
+ QStandardItemModel *model = new QStandardItemModel(&lineEdit);
+ QStandardItem *suggestions = new QStandardItem("suggestions");
+ suggestions->setEnabled(false);
+ model->appendRow(suggestions);
+ model->appendRow(new QStandardItem("suggestions Enabled"));
+ QCompleter *completer = new QCompleter(model, &lineEdit);
+ QSignalSpy spy(completer, SIGNAL(activated(const QString &)));
+ lineEdit.setCompleter(completer);
+ lineEdit.show();
+
+ QTest::keyPress(&lineEdit, Qt::Key_S);
+ QTest::keyPress(&lineEdit, Qt::Key_U);
+ QAbstractItemView *view = lineEdit.completer()->popup();
+ QVERIFY(view->isVisible());
+ QTest::mouseClick(view->viewport(), Qt::LeftButton, 0, view->visualRect(view->model()->index(0, 0)).center());
+ QCOMPARE(spy.count(), 0);
+ QVERIFY(view->isVisible());
+ QTest::mouseClick(view->viewport(), Qt::LeftButton, 0, view->visualRect(view->model()->index(1, 0)).center());
+ QCOMPARE(spy.count(), 1);
+ QVERIFY(!view->isVisible());
+}
+
void tst_QCompleter::task178797_activatedOnReturn()
{
QStringList words;
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp
index 771b0c6..60bb177 100644
--- a/tests/auto/qdir/tst_qdir.cpp
+++ b/tests/auto/qdir/tst_qdir.cpp
@@ -56,6 +56,10 @@
# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
#endif
+#if defined(Q_OS_VXWORKS)
+#define Q_NO_SYMLINKS
+#endif
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -374,6 +378,20 @@ void tst_QDir::compare()
QVERIFY(dir == QDir::currentPath());
}
+static QStringList filterLinks(const QStringList &list)
+{
+#ifndef Q_NO_SYMLINKS
+ return list;
+#else
+ QStringList result;
+ foreach (QString str, list) {
+ if (!str.endsWith(QLatin1String(".lnk")))
+ result.append(str);
+ }
+ return result;
+#endif
+}
+
void tst_QDir::entryList_data()
{
QTest::addColumn<QString>("dirName"); // relative from current path or abs
@@ -415,94 +433,95 @@ void tst_QDir::entryList_data()
QTest::newRow("nofilter") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::NoFilter) << int(QDir::Name)
- << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::AllEntries") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllEntries) << int(QDir::Name)
- << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::Files") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Files) << int(QDir::Name)
- << QString("file,linktofile.lnk,writable").split(',');
+ << filterLinks(QString("file,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::Dirs") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Dirs) << int(QDir::Name)
- << QString(".,..,directory,linktodirectory.lnk").split(',');
+ << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(','));
QTest::newRow("QDir::Dirs | QDir::NoDotAndDotDot") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Dirs | QDir::NoDotAndDotDot) << int(QDir::Name)
- << QString("directory,linktodirectory.lnk").split(',');
+ << filterLinks(QString("directory,linktodirectory.lnk").split(','));
QTest::newRow("QDir::AllDirs") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllDirs) << int(QDir::Name)
- << QString(".,..,directory,linktodirectory.lnk").split(',');
+ << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(','));
QTest::newRow("QDir::AllDirs | QDir::Dirs") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllDirs | QDir::Dirs) << int(QDir::Name)
- << QString(".,..,directory,linktodirectory.lnk").split(',');
+ << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(','));
QTest::newRow("QDir::AllDirs | QDir::Files") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllDirs | QDir::Files) << int(QDir::Name)
- << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::AllEntries | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllEntries | QDir::NoSymLinks) << int(QDir::Name)
- << QString(".,..,directory,file,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,writable").split(','));
QTest::newRow("QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot) << int(QDir::Name)
- << QString("directory,file,writable").split(',');
+ << filterLinks(QString("directory,file,writable").split(','));
QTest::newRow("QDir::Files | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Files | QDir::NoSymLinks) << int(QDir::Name)
- << QString("file,writable").split(',');
+ << filterLinks(QString("file,writable").split(','));
QTest::newRow("QDir::Dirs | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Dirs | QDir::NoSymLinks) << int(QDir::Name)
- << QString(".,..,directory").split(',');
+ << filterLinks(QString(".,..,directory").split(','));
QTest::newRow("QDir::Drives | QDir::Files | QDir::NoDotAndDotDot") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Drives | QDir::Files | QDir::NoDotAndDotDot) << int(QDir::Name)
- << QString("file,linktofile.lnk,writable").split(',');
+ << filterLinks(QString("file,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::System") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::System) << int(QDir::Name)
- << QStringList("brokenlink.lnk");
+ << filterLinks(QStringList("brokenlink.lnk"));
QTest::newRow("QDir::Hidden") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::Hidden) << int(QDir::Name)
<< QStringList();
QTest::newRow("QDir::System | QDir::Hidden") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::System | QDir::Hidden) << int(QDir::Name)
- << QStringList("brokenlink.lnk");
+ << filterLinks(QStringList("brokenlink.lnk"));
QTest::newRow("QDir::AllDirs | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllDirs | QDir::NoSymLinks) << int(QDir::Name)
- << QString(".,..,directory").split(',');
+ << filterLinks(QString(".,..,directory").split(','));
#ifdef QT3_SUPPORT
QTest::newRow("QDir::All | QDir::Hidden | QDir::System") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::All | QDir::Hidden | QDir::System) << int(QDir::Name)
- << QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::All | QDir::Readable") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::All | QDir::Readable) << int(QDir::Name)
- << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::All | QDir::Writable") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::All | QDir::Writable) << int(QDir::Name)
- << QString(".,..,directory,linktodirectory.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,linktodirectory.lnk,writable").split(','));
#else
QTest::newRow("QDir::AllEntries | QDir::Hidden | QDir::System") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllEntries | QDir::Hidden | QDir::System) << int(QDir::Name)
- << QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::AllEntries | QDir::Readable") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllEntries | QDir::Readable) << int(QDir::Name)
- << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("QDir::AllEntries | QDir::Writable") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::AllEntries | QDir::Writable) << int(QDir::Name)
- << QString(".,..,directory,linktodirectory.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,linktodirectory.lnk,writable").split(','));
#endif
QTest::newRow("Namefilters b*") << SRCDIR "entrylist/" << QStringList("d*")
<< int(QDir::NoFilter) << int(QDir::Name)
- << QString("directory").split(',');
+ << filterLinks(QString("directory").split(','));
QTest::newRow("Namefilters f*") << SRCDIR "entrylist/" << QStringList("f*")
<< int(QDir::NoFilter) << int(QDir::Name)
- << QString("file").split(',');
+ << filterLinks(QString("file").split(','));
QTest::newRow("Namefilters link*") << SRCDIR "entrylist/" << QStringList("link*")
<< int(QDir::NoFilter) << int(QDir::Name)
- << QString("linktodirectory.lnk,linktofile.lnk").split(',');
+ << filterLinks(QString("linktodirectory.lnk,linktofile.lnk").split(','));
QTest::newRow("Namefilters *to*") << SRCDIR "entrylist/" << QStringList("*to*")
<< int(QDir::NoFilter) << int(QDir::Name)
- << QString("directory,linktodirectory.lnk,linktofile.lnk").split(',');
+ << filterLinks(QString("directory,linktodirectory.lnk,linktofile.lnk").split(','));
QTest::newRow("Sorting QDir::Name") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::NoFilter) << int(QDir::Name)
- << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',');
+ << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
QTest::newRow("Sorting QDir::Name | QDir::Reversed") << SRCDIR "entrylist/" << QStringList("*")
<< int(QDir::NoFilter) << int(QDir::Name | QDir::Reversed)
- << QString("writable,linktofile.lnk,linktodirectory.lnk,file,directory,..,.").split(',');
+ << filterLinks(QString("writable,linktofile.lnk,linktodirectory.lnk,file,directory,..,.").split(','));
+
QTest::newRow("Sorting QDir::Type") << SRCDIR "types/" << QStringList("*")
<< int(QDir::NoFilter) << int(QDir::Type)
<< QString(".,..,a,b,c,d,e,f,a.a,b.a,c.a,d.a,e.a,f.a,a.b,b.b,c.b,d.b,e.b,f.b,a.c,b.c,c.c,d.c,e.c,f.c").split(',');
@@ -687,6 +706,7 @@ void tst_QDir::entryListSimple()
void tst_QDir::entryListWithSymLinks()
{
+#ifndef Q_NO_SYMLINKS
QFile::remove("myLinkToDir.lnk");
QFile::remove("myLinkToFile.lnk");
QFile::remove("testfile.cpp");
@@ -728,6 +748,7 @@ void tst_QDir::entryListWithSymLinks()
QFile::remove("myLinkToFile.lnk");
QFile::remove("testfile.cpp");
dir.rmdir("myDir");
+#endif
}
void tst_QDir::canonicalPath_data()
diff --git a/tests/auto/qdiriterator/tst_qdiriterator.cpp b/tests/auto/qdiriterator/tst_qdiriterator.cpp
index c821623..5708b50 100644
--- a/tests/auto/qdiriterator/tst_qdiriterator.cpp
+++ b/tests/auto/qdiriterator/tst_qdiriterator.cpp
@@ -48,6 +48,10 @@
#include <qfileinfo.h>
#include <qstringlist.h>
+#if defined(Q_OS_VXWORKS)
+#define Q_NO_SYMLINKS
+#endif
+
Q_DECLARE_METATYPE(QDirIterator::IteratorFlags)
Q_DECLARE_METATYPE(QDir::Filters)
@@ -87,7 +91,8 @@ tst_QDirIterator::tst_QDirIterator()
QFile::remove("entrylist/directory/entrylist3.lnk");
QFile::remove("entrylist/directory/entrylist4.lnk");
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#ifndef Q_NO_SYMLINKS
+#ifdef Q_OS_WIN || defined(Q_OS_SYMBIAN)
// ### Sadly, this is a platform difference right now.
QFile::link("entrylist/file", "entrylist/linktofile.lnk");
QFile::link("entrylist/directory", "entrylist/linktodirectory.lnk");
@@ -97,6 +102,7 @@ tst_QDirIterator::tst_QDirIterator()
QFile::link("directory", "entrylist/linktodirectory.lnk");
QFile::link("nothing", "entrylist/brokenlink.lnk");
#endif
+#endif
QFile("entrylist/writable").open(QIODevice::ReadWrite);
}
@@ -135,9 +141,13 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
"entrylist/..,"
#endif
"entrylist/file,"
+#ifndef Q_NO_SYMLINKS
"entrylist/linktofile.lnk,"
+#endif
"entrylist/directory,"
+#ifndef Q_NO_SYMLINKS
"entrylist/linktodirectory.lnk,"
+#endif
"entrylist/writable").split(',');
QTest::newRow("QDir::Subdirectories | QDir::FollowSymlinks")
@@ -151,10 +161,14 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
"entrylist/directory/..,"
#endif
"entrylist/file,"
+#ifndef Q_NO_SYMLINKS
"entrylist/linktofile.lnk,"
+#endif
"entrylist/directory,"
"entrylist/directory/dummy,"
+#ifndef Q_NO_SYMLINKS
"entrylist/linktodirectory.lnk,"
+#endif
"entrylist/writable").split(',');
QTest::newRow("QDir::Subdirectories / QDir::Files")
@@ -162,14 +176,18 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
<< QDir::Filters(QDir::Files) << QStringList("*")
<< QString("entrylist/directory/dummy,"
"entrylist/file,"
+#ifndef Q_NO_SYMLINKS
"entrylist/linktofile.lnk,"
+#endif
"entrylist/writable").split(',');
QTest::newRow("QDir::Subdirectories | QDir::FollowSymlinks / QDir::Files")
<< QString("entrylist") << QDirIterator::IteratorFlags(QDirIterator::Subdirectories | QDirIterator::FollowSymlinks)
<< QDir::Filters(QDir::Files) << QStringList("*")
<< QString("entrylist/file,"
+#ifndef Q_NO_SYMLINKS
"entrylist/linktofile.lnk,"
+#endif
"entrylist/directory/dummy,"
"entrylist/writable").split(',');
}
diff --git a/tests/auto/qdom/qdom.pro b/tests/auto/qdom/qdom.pro
index 9a9bcbb..84b721e 100644
--- a/tests/auto/qdom/qdom.pro
+++ b/tests/auto/qdom/qdom.pro
@@ -10,6 +10,10 @@ wince*|symbian*: {
DEPLOYMENT += addFiles
DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs
+ DEFINES += SRCDIR=\\\"\\\"
+}
+else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
symbian: TARGET.EPOCHEAPSIZE="0x100000 0x1000000"
diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp
index cea0bfb..5b4787f 100644
--- a/tests/auto/qdom/tst_qdom.cpp
+++ b/tests/auto/qdom/tst_qdom.cpp
@@ -290,17 +290,17 @@ void tst_QDom::toString_01_data()
{
QTest::addColumn<QString>("fileName");
- QTest::newRow( "01" ) << QString("testdata/toString_01/doc01.xml");
- QTest::newRow( "02" ) << QString("testdata/toString_01/doc02.xml");
- QTest::newRow( "03" ) << QString("testdata/toString_01/doc03.xml");
- QTest::newRow( "04" ) << QString("testdata/toString_01/doc04.xml");
- QTest::newRow( "05" ) << QString("testdata/toString_01/doc05.xml");
+ QTest::newRow( "01" ) << QString(SRCDIR "testdata/toString_01/doc01.xml");
+ QTest::newRow( "02" ) << QString(SRCDIR "testdata/toString_01/doc02.xml");
+ QTest::newRow( "03" ) << QString(SRCDIR "testdata/toString_01/doc03.xml");
+ QTest::newRow( "04" ) << QString(SRCDIR "testdata/toString_01/doc04.xml");
+ QTest::newRow( "05" ) << QString(SRCDIR "testdata/toString_01/doc05.xml");
- QTest::newRow( "euc-jp" ) << QString("testdata/toString_01/doc_euc-jp.xml");
- QTest::newRow( "iso-2022-jp" ) << QString("testdata/toString_01/doc_iso-2022-jp.xml");
- QTest::newRow( "little-endian" ) << QString("testdata/toString_01/doc_little-endian.xml");
- QTest::newRow( "utf-16" ) << QString("testdata/toString_01/doc_utf-16.xml");
- QTest::newRow( "utf-8" ) << QString("testdata/toString_01/doc_utf-8.xml");
+ QTest::newRow( "euc-jp" ) << QString(SRCDIR "testdata/toString_01/doc_euc-jp.xml");
+ QTest::newRow( "iso-2022-jp" ) << QString(SRCDIR "testdata/toString_01/doc_iso-2022-jp.xml");
+ QTest::newRow( "little-endian" ) << QString(SRCDIR "testdata/toString_01/doc_little-endian.xml");
+ QTest::newRow( "utf-16" ) << QString(SRCDIR "testdata/toString_01/doc_utf-16.xml");
+ QTest::newRow( "utf-8" ) << QString(SRCDIR "testdata/toString_01/doc_utf-8.xml");
}
@@ -474,7 +474,7 @@ void tst_QDom::initTestCase()
QSKIP("Our current test machine, arsia, is too slow for this auto test.", SkipAll);
#endif
- QFile file("testdata/excludedCodecs.txt");
+ QFile file(SRCDIR "testdata/excludedCodecs.txt");
QVERIFY(file.open(QIODevice::ReadOnly|QIODevice::Text));
QByteArray codecName;
@@ -550,18 +550,18 @@ void tst_QDom::saveWithSerialization_data() const
{
QTest::addColumn<QString>("fileName");
- QTest::newRow("doc01.xml") << QString("testdata/toString_01/doc01.xml");
- QTest::newRow("doc01.xml") << QString("testdata/toString_01/doc01.xml");
- QTest::newRow("doc02.xml") << QString("testdata/toString_01/doc02.xml");
- QTest::newRow("doc03.xml") << QString("testdata/toString_01/doc03.xml");
- QTest::newRow("doc04.xml") << QString("testdata/toString_01/doc04.xml");
- QTest::newRow("doc05.xml") << QString("testdata/toString_01/doc05.xml");
+ QTest::newRow("doc01.xml") << QString(SRCDIR "testdata/toString_01/doc01.xml");
+ QTest::newRow("doc01.xml") << QString(SRCDIR "testdata/toString_01/doc01.xml");
+ QTest::newRow("doc02.xml") << QString(SRCDIR "testdata/toString_01/doc02.xml");
+ QTest::newRow("doc03.xml") << QString(SRCDIR "testdata/toString_01/doc03.xml");
+ QTest::newRow("doc04.xml") << QString(SRCDIR "testdata/toString_01/doc04.xml");
+ QTest::newRow("doc05.xml") << QString(SRCDIR "testdata/toString_01/doc05.xml");
- QTest::newRow("doc_euc-jp.xml") << QString("testdata/toString_01/doc_euc-jp.xml");
- QTest::newRow("doc_iso-2022-jp.xml") << QString("testdata/toString_01/doc_iso-2022-jp.xml");
- QTest::newRow("doc_little-endian.xml") << QString("testdata/toString_01/doc_little-endian.xml");
- QTest::newRow("doc_utf-16.xml") << QString("testdata/toString_01/doc_utf-16.xml");
- QTest::newRow("doc_utf-8.xml") << QString("testdata/toString_01/doc_utf-8.xml");
+ QTest::newRow("doc_euc-jp.xml") << QString(SRCDIR "testdata/toString_01/doc_euc-jp.xml");
+ QTest::newRow("doc_iso-2022-jp.xml") << QString(SRCDIR "testdata/toString_01/doc_iso-2022-jp.xml");
+ QTest::newRow("doc_little-endian.xml") << QString(SRCDIR "testdata/toString_01/doc_little-endian.xml");
+ QTest::newRow("doc_utf-16.xml") << QString(SRCDIR "testdata/toString_01/doc_utf-16.xml");
+ QTest::newRow("doc_utf-8.xml") << QString(SRCDIR "testdata/toString_01/doc_utf-8.xml");
}
void tst_QDom::cloneNode_data()
@@ -1386,7 +1386,7 @@ void tst_QDom::roundTripAttributes() const
doc.save(stream, 0);
stream.flush();
- const QByteArray expected("<localName xmlns=\"\" attr=\" &#xd;&#xa;&#x9; \" />\n");
+ const QByteArray expected("<localName xmlns=\"\" attr=\" &#xd;&#xa;&#x9; \"/>\n");
QCOMPARE(QString::fromLatin1(serialized.constData()), QString::fromLatin1(expected.constData()));
}
@@ -1671,7 +1671,7 @@ void tst_QDom::appendDocumentNode() const
doc.appendChild(elem);
Q_ASSERT(!xml.isNull());
- const QString expected(QLatin1String("<document>\n<test_elem name=\"value\" />\n</document>\n"));
+ const QString expected(QLatin1String("<document>\n<test_elem name=\"value\"/>\n</document>\n"));
elem.appendChild(xml);
QCOMPARE(doc.childNodes().count(), 1);
@@ -1780,7 +1780,7 @@ void tst_QDom::doubleNamespaceDeclarations() const
{
QDomDocument doc;
- QFile file("doubleNamespaces.xml" );
+ QFile file(SRCDIR "doubleNamespaces.xml" );
QVERIFY(file.open(QIODevice::ReadOnly));
QXmlSimpleReader reader;
@@ -1788,8 +1788,8 @@ void tst_QDom::doubleNamespaceDeclarations() const
QXmlInputSource source(&file);
QVERIFY(doc.setContent(&source, &reader));
- QVERIFY(doc.toString(0) == QString::fromLatin1("<a>\n<b p:c=\"\" xmlns:p=\"NS\" p:d=\"\" />\n</a>\n") ||
- doc.toString(0) == QString::fromLatin1("<a>\n<b p:c=\"\" p:d=\"\" xmlns:p=\"NS\" />\n</a>\n"));
+ QVERIFY(doc.toString(0) == QString::fromLatin1("<a>\n<b p:c=\"\" xmlns:p=\"NS\" p:d=\"\"/>\n</a>\n") ||
+ doc.toString(0) == QString::fromLatin1("<a>\n<b p:c=\"\" p:d=\"\" xmlns:p=\"NS\"/>\n</a>\n"));
}
void tst_QDom::setContentQXmlReaderOverload() const
diff --git a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
index e9d7272..8701318 100644
--- a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
+++ b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
@@ -3,6 +3,8 @@ CONFIG += qttest_p4
include(../../src/qfiledialog.pri)
include(../../../../modeltest/modeltest.pri)
+QT = core gui
+
SOURCES += tst_qfilesystemmodel.cpp
TARGET = tst_qfilesystemmodel
diff --git a/tests/auto/qformlayout/tst_qformlayout.cpp b/tests/auto/qformlayout/tst_qformlayout.cpp
index 74384a9..9806557 100644
--- a/tests/auto/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/qformlayout/tst_qformlayout.cpp
@@ -125,7 +125,6 @@ private slots:
Qt::Orientations expandingDirections() const;
*/
- void fieldMinimumSize();
};
tst_QFormLayout::tst_QFormLayout()
@@ -906,35 +905,6 @@ void tst_QFormLayout::layoutAlone()
QTest::qWait(500);
}
-
-void tst_QFormLayout::fieldMinimumSize()
-{
- //check that the field with is bigger than its minimumSizeHint for any size of the widget
- // even if the label with is not fixed
- QWidget w;
- QFormLayout layout;
- layout.setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
- w.setLayout(&layout);
- QLabel label1("Here is a strange test case");
- label1.setWordWrap(true);
- QLabel label2("Here is another label");
- label2.setWordWrap(true);
- QLabel shortLabel("short");
- QLabel longLabel("Quite long label");
- layout.addRow(&label1, &shortLabel);
- layout.addRow(&label2, &longLabel);
- w.show();
- int width = w.size().width() + 9;
-
- do {
- w.resize(width, w.size().height());
- layout.activate();
- QVERIFY(shortLabel.size().width() >= shortLabel.minimumSizeHint().width());
- QVERIFY(longLabel.size().width() >= longLabel.minimumSizeHint().width());
- width -= 3;
- } while(width >= w.minimumSizeHint().width());
-}
-
QTEST_MAIN(tst_QFormLayout)
#include "tst_qformlayout.moc"
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index 96f5ddd..31c4a3c 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -45,6 +45,7 @@
#include <qcoreapplication.h>
#include <qdebug.h>
#include <qgl.h>
+#include <qglcolormap.h>
#include <QGraphicsView>
#include <QGraphicsProxyWidget>
@@ -66,6 +67,7 @@ private slots:
void graphicsViewClipping();
void partialGLWidgetUpdates_data();
void partialGLWidgetUpdates();
+ void colormap();
};
tst_QGL::tst_QGL()
@@ -94,6 +96,11 @@ public:
void setAutoBufferSwap(bool on) { QGLWidget::setAutoBufferSwap(on); }
};
+// Using INT_MIN and INT_MAX will cause failures on systems
+// where "int" is 64-bit, so use the explicit values instead.
+#define TEST_INT_MIN (-2147483647 - 1)
+#define TEST_INT_MAX 2147483647
+
// Testing get/set functions
void tst_QGL::getSetCheck()
{
@@ -103,120 +110,286 @@ void tst_QGL::getSetCheck()
QGLFormat obj1;
// int QGLFormat::depthBufferSize()
// void QGLFormat::setDepthBufferSize(int)
+ QCOMPARE(-1, obj1.depthBufferSize());
obj1.setDepthBufferSize(0);
QCOMPARE(0, obj1.depthBufferSize());
- obj1.setDepthBufferSize(INT_MIN);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setDepthBufferSize: Cannot set negative depth buffer size -2147483648");
+ obj1.setDepthBufferSize(TEST_INT_MIN);
QCOMPARE(0, obj1.depthBufferSize()); // Makes no sense with a negative buffer size
- obj1.setDepthBufferSize(INT_MAX);
- QCOMPARE(INT_MAX, obj1.depthBufferSize());
+ obj1.setDepthBufferSize(3);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setDepthBufferSize: Cannot set negative depth buffer size -1");
+ obj1.setDepthBufferSize(-1);
+ QCOMPARE(3, obj1.depthBufferSize());
+ obj1.setDepthBufferSize(TEST_INT_MAX);
+ QCOMPARE(TEST_INT_MAX, obj1.depthBufferSize());
// int QGLFormat::accumBufferSize()
// void QGLFormat::setAccumBufferSize(int)
+ QCOMPARE(-1, obj1.accumBufferSize());
obj1.setAccumBufferSize(0);
QCOMPARE(0, obj1.accumBufferSize());
- obj1.setAccumBufferSize(INT_MIN);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setAccumBufferSize: Cannot set negative accumulate buffer size -2147483648");
+ obj1.setAccumBufferSize(TEST_INT_MIN);
QCOMPARE(0, obj1.accumBufferSize()); // Makes no sense with a negative buffer size
- obj1.setAccumBufferSize(INT_MAX);
- QCOMPARE(INT_MAX, obj1.accumBufferSize());
+ obj1.setAccumBufferSize(3);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setAccumBufferSize: Cannot set negative accumulate buffer size -1");
+ obj1.setAccumBufferSize(-1);
+ QCOMPARE(3, obj1.accumBufferSize());
+ obj1.setAccumBufferSize(TEST_INT_MAX);
+ QCOMPARE(TEST_INT_MAX, obj1.accumBufferSize());
+
+ // int QGLFormat::redBufferSize()
+ // void QGLFormat::setRedBufferSize(int)
+ QCOMPARE(-1, obj1.redBufferSize());
+ obj1.setRedBufferSize(0);
+ QCOMPARE(0, obj1.redBufferSize());
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setRedBufferSize: Cannot set negative red buffer size -2147483648");
+ obj1.setRedBufferSize(TEST_INT_MIN);
+ QCOMPARE(0, obj1.redBufferSize()); // Makes no sense with a negative buffer size
+ obj1.setRedBufferSize(3);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setRedBufferSize: Cannot set negative red buffer size -1");
+ obj1.setRedBufferSize(-1);
+ QCOMPARE(3, obj1.redBufferSize());
+ obj1.setRedBufferSize(TEST_INT_MAX);
+ QCOMPARE(TEST_INT_MAX, obj1.redBufferSize());
+
+ // int QGLFormat::greenBufferSize()
+ // void QGLFormat::setGreenBufferSize(int)
+ QCOMPARE(-1, obj1.greenBufferSize());
+ obj1.setGreenBufferSize(0);
+ QCOMPARE(0, obj1.greenBufferSize());
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setGreenBufferSize: Cannot set negative green buffer size -2147483648");
+ obj1.setGreenBufferSize(TEST_INT_MIN);
+ QCOMPARE(0, obj1.greenBufferSize()); // Makes no sense with a negative buffer size
+ obj1.setGreenBufferSize(3);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setGreenBufferSize: Cannot set negative green buffer size -1");
+ obj1.setGreenBufferSize(-1);
+ QCOMPARE(3, obj1.greenBufferSize());
+ obj1.setGreenBufferSize(TEST_INT_MAX);
+ QCOMPARE(TEST_INT_MAX, obj1.greenBufferSize());
+
+ // int QGLFormat::blueBufferSize()
+ // void QGLFormat::setBlueBufferSize(int)
+ QCOMPARE(-1, obj1.blueBufferSize());
+ obj1.setBlueBufferSize(0);
+ QCOMPARE(0, obj1.blueBufferSize());
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setBlueBufferSize: Cannot set negative blue buffer size -2147483648");
+ obj1.setBlueBufferSize(TEST_INT_MIN);
+ QCOMPARE(0, obj1.blueBufferSize()); // Makes no sense with a negative buffer size
+ obj1.setBlueBufferSize(3);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setBlueBufferSize: Cannot set negative blue buffer size -1");
+ obj1.setBlueBufferSize(-1);
+ QCOMPARE(3, obj1.blueBufferSize());
+ obj1.setBlueBufferSize(TEST_INT_MAX);
+ QCOMPARE(TEST_INT_MAX, obj1.blueBufferSize());
// int QGLFormat::alphaBufferSize()
// void QGLFormat::setAlphaBufferSize(int)
+ QCOMPARE(-1, obj1.alphaBufferSize());
+ QCOMPARE(false, obj1.alpha());
+ QVERIFY(!obj1.testOption(QGL::AlphaChannel));
+ QVERIFY(obj1.testOption(QGL::NoAlphaChannel));
obj1.setAlphaBufferSize(0);
+ QCOMPARE(true, obj1.alpha()); // setAlphaBufferSize() enables alpha.
QCOMPARE(0, obj1.alphaBufferSize());
- obj1.setAlphaBufferSize(INT_MIN);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setAlphaBufferSize: Cannot set negative alpha buffer size -2147483648");
+ obj1.setAlphaBufferSize(TEST_INT_MIN);
QCOMPARE(0, obj1.alphaBufferSize()); // Makes no sense with a negative buffer size
- obj1.setAlphaBufferSize(INT_MAX);
- QCOMPARE(INT_MAX, obj1.alphaBufferSize());
+ obj1.setAlphaBufferSize(3);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setAlphaBufferSize: Cannot set negative alpha buffer size -1");
+ obj1.setAlphaBufferSize(-1);
+ QCOMPARE(3, obj1.alphaBufferSize());
+ obj1.setAlphaBufferSize(TEST_INT_MAX);
+ QCOMPARE(TEST_INT_MAX, obj1.alphaBufferSize());
// int QGLFormat::stencilBufferSize()
// void QGLFormat::setStencilBufferSize(int)
+ QCOMPARE(-1, obj1.stencilBufferSize());
obj1.setStencilBufferSize(0);
QCOMPARE(0, obj1.stencilBufferSize());
- obj1.setStencilBufferSize(INT_MIN);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setStencilBufferSize: Cannot set negative stencil buffer size -2147483648");
+ obj1.setStencilBufferSize(TEST_INT_MIN);
QCOMPARE(0, obj1.stencilBufferSize()); // Makes no sense with a negative buffer size
- obj1.setStencilBufferSize(INT_MAX);
- QCOMPARE(INT_MAX, obj1.stencilBufferSize());
+ obj1.setStencilBufferSize(3);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setStencilBufferSize: Cannot set negative stencil buffer size -1");
+ obj1.setStencilBufferSize(-1);
+ QCOMPARE(3, obj1.stencilBufferSize());
+ obj1.setStencilBufferSize(TEST_INT_MAX);
+ QCOMPARE(TEST_INT_MAX, obj1.stencilBufferSize());
// bool QGLFormat::sampleBuffers()
// void QGLFormat::setSampleBuffers(bool)
+ QCOMPARE(false, obj1.sampleBuffers());
+ QVERIFY(!obj1.testOption(QGL::SampleBuffers));
+ QVERIFY(obj1.testOption(QGL::NoSampleBuffers));
obj1.setSampleBuffers(false);
QCOMPARE(false, obj1.sampleBuffers());
+ QVERIFY(obj1.testOption(QGL::NoSampleBuffers));
obj1.setSampleBuffers(true);
QCOMPARE(true, obj1.sampleBuffers());
+ QVERIFY(obj1.testOption(QGL::SampleBuffers));
// int QGLFormat::samples()
// void QGLFormat::setSamples(int)
+ QCOMPARE(-1, obj1.samples());
obj1.setSamples(0);
QCOMPARE(0, obj1.samples());
- obj1.setSamples(INT_MIN);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setSamples: Cannot have negative number of samples per pixel -2147483648");
+ obj1.setSamples(TEST_INT_MIN);
QCOMPARE(0, obj1.samples()); // Makes no sense with a negative sample size
- obj1.setSamples(INT_MAX);
- QCOMPARE(INT_MAX, obj1.samples());
+ obj1.setSamples(3);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setSamples: Cannot have negative number of samples per pixel -1");
+ obj1.setSamples(-1);
+ QCOMPARE(3, obj1.samples());
+ obj1.setSamples(TEST_INT_MAX);
+ QCOMPARE(TEST_INT_MAX, obj1.samples());
+
+ // int QGLFormat::swapInterval()
+ // void QGLFormat::setSwapInterval(int)
+ QCOMPARE(-1, obj1.swapInterval());
+ obj1.setSwapInterval(0);
+ QCOMPARE(0, obj1.swapInterval());
+ obj1.setSwapInterval(TEST_INT_MIN);
+ QCOMPARE(TEST_INT_MIN, obj1.swapInterval());
+ obj1.setSwapInterval(-1);
+ QCOMPARE(-1, obj1.swapInterval());
+ obj1.setSwapInterval(TEST_INT_MAX);
+ QCOMPARE(TEST_INT_MAX, obj1.swapInterval());
// bool QGLFormat::doubleBuffer()
// void QGLFormat::setDoubleBuffer(bool)
+ QCOMPARE(true, obj1.doubleBuffer());
+ QVERIFY(obj1.testOption(QGL::DoubleBuffer));
+ QVERIFY(!obj1.testOption(QGL::SingleBuffer));
obj1.setDoubleBuffer(false);
QCOMPARE(false, obj1.doubleBuffer());
+ QVERIFY(!obj1.testOption(QGL::DoubleBuffer));
+ QVERIFY(obj1.testOption(QGL::SingleBuffer));
obj1.setDoubleBuffer(true);
QCOMPARE(true, obj1.doubleBuffer());
+ QVERIFY(obj1.testOption(QGL::DoubleBuffer));
+ QVERIFY(!obj1.testOption(QGL::SingleBuffer));
// bool QGLFormat::depth()
// void QGLFormat::setDepth(bool)
+ QCOMPARE(true, obj1.depth());
+ QVERIFY(obj1.testOption(QGL::DepthBuffer));
+ QVERIFY(!obj1.testOption(QGL::NoDepthBuffer));
obj1.setDepth(false);
QCOMPARE(false, obj1.depth());
+ QVERIFY(!obj1.testOption(QGL::DepthBuffer));
+ QVERIFY(obj1.testOption(QGL::NoDepthBuffer));
obj1.setDepth(true);
QCOMPARE(true, obj1.depth());
+ QVERIFY(obj1.testOption(QGL::DepthBuffer));
+ QVERIFY(!obj1.testOption(QGL::NoDepthBuffer));
// bool QGLFormat::rgba()
// void QGLFormat::setRgba(bool)
+ QCOMPARE(true, obj1.rgba());
+ QVERIFY(obj1.testOption(QGL::Rgba));
+ QVERIFY(!obj1.testOption(QGL::ColorIndex));
obj1.setRgba(false);
QCOMPARE(false, obj1.rgba());
+ QVERIFY(!obj1.testOption(QGL::Rgba));
+ QVERIFY(obj1.testOption(QGL::ColorIndex));
obj1.setRgba(true);
QCOMPARE(true, obj1.rgba());
+ QVERIFY(obj1.testOption(QGL::Rgba));
+ QVERIFY(!obj1.testOption(QGL::ColorIndex));
// bool QGLFormat::alpha()
// void QGLFormat::setAlpha(bool)
+ QVERIFY(obj1.testOption(QGL::AlphaChannel));
+ QVERIFY(!obj1.testOption(QGL::NoAlphaChannel));
obj1.setAlpha(false);
QCOMPARE(false, obj1.alpha());
+ QVERIFY(!obj1.testOption(QGL::AlphaChannel));
+ QVERIFY(obj1.testOption(QGL::NoAlphaChannel));
obj1.setAlpha(true);
QCOMPARE(true, obj1.alpha());
+ QVERIFY(obj1.testOption(QGL::AlphaChannel));
+ QVERIFY(!obj1.testOption(QGL::NoAlphaChannel));
// bool QGLFormat::accum()
// void QGLFormat::setAccum(bool)
+ QCOMPARE(false, obj1.accum());
+ QVERIFY(!obj1.testOption(QGL::AccumBuffer));
+ QVERIFY(obj1.testOption(QGL::NoAccumBuffer));
obj1.setAccum(false);
QCOMPARE(false, obj1.accum());
+ QVERIFY(!obj1.testOption(QGL::AccumBuffer));
+ QVERIFY(obj1.testOption(QGL::NoAccumBuffer));
obj1.setAccum(true);
QCOMPARE(true, obj1.accum());
+ QVERIFY(obj1.testOption(QGL::AccumBuffer));
+ QVERIFY(!obj1.testOption(QGL::NoAccumBuffer));
// bool QGLFormat::stencil()
// void QGLFormat::setStencil(bool)
+ QCOMPARE(true, obj1.stencil());
+ QVERIFY(obj1.testOption(QGL::StencilBuffer));
+ QVERIFY(!obj1.testOption(QGL::NoStencilBuffer));
obj1.setStencil(false);
QCOMPARE(false, obj1.stencil());
+ QVERIFY(!obj1.testOption(QGL::StencilBuffer));
+ QVERIFY(obj1.testOption(QGL::NoStencilBuffer));
obj1.setStencil(true);
QCOMPARE(true, obj1.stencil());
+ QVERIFY(obj1.testOption(QGL::StencilBuffer));
+ QVERIFY(!obj1.testOption(QGL::NoStencilBuffer));
// bool QGLFormat::stereo()
// void QGLFormat::setStereo(bool)
+ QCOMPARE(false, obj1.stereo());
+ QVERIFY(!obj1.testOption(QGL::StereoBuffers));
+ QVERIFY(obj1.testOption(QGL::NoStereoBuffers));
obj1.setStereo(false);
QCOMPARE(false, obj1.stereo());
+ QVERIFY(!obj1.testOption(QGL::StereoBuffers));
+ QVERIFY(obj1.testOption(QGL::NoStereoBuffers));
obj1.setStereo(true);
QCOMPARE(true, obj1.stereo());
+ QVERIFY(obj1.testOption(QGL::StereoBuffers));
+ QVERIFY(!obj1.testOption(QGL::NoStereoBuffers));
// bool QGLFormat::directRendering()
// void QGLFormat::setDirectRendering(bool)
+ QCOMPARE(true, obj1.directRendering());
+ QVERIFY(obj1.testOption(QGL::DirectRendering));
+ QVERIFY(!obj1.testOption(QGL::IndirectRendering));
obj1.setDirectRendering(false);
QCOMPARE(false, obj1.directRendering());
+ QVERIFY(!obj1.testOption(QGL::DirectRendering));
+ QVERIFY(obj1.testOption(QGL::IndirectRendering));
obj1.setDirectRendering(true);
QCOMPARE(true, obj1.directRendering());
+ QVERIFY(obj1.testOption(QGL::DirectRendering));
+ QVERIFY(!obj1.testOption(QGL::IndirectRendering));
+
+ // bool QGLFormat::overlay()
+ // void QGLFormat::setOverlay(bool)
+ QCOMPARE(false, obj1.hasOverlay());
+ QVERIFY(!obj1.testOption(QGL::HasOverlay));
+ QVERIFY(obj1.testOption(QGL::NoOverlay));
+ obj1.setOverlay(false);
+ QCOMPARE(false, obj1.hasOverlay());
+ QVERIFY(!obj1.testOption(QGL::HasOverlay));
+ QVERIFY(obj1.testOption(QGL::NoOverlay));
+ obj1.setOverlay(true);
+ QCOMPARE(true, obj1.hasOverlay());
+ QVERIFY(obj1.testOption(QGL::HasOverlay));
+ QVERIFY(!obj1.testOption(QGL::NoOverlay));
// int QGLFormat::plane()
// void QGLFormat::setPlane(int)
+ QCOMPARE(0, obj1.plane());
obj1.setPlane(0);
QCOMPARE(0, obj1.plane());
- obj1.setPlane(INT_MIN);
- QCOMPARE(INT_MIN, obj1.plane());
- obj1.setPlane(INT_MAX);
- QCOMPARE(INT_MAX, obj1.plane());
+ obj1.setPlane(TEST_INT_MIN);
+ QCOMPARE(TEST_INT_MIN, obj1.plane());
+ obj1.setPlane(TEST_INT_MAX);
+ QCOMPARE(TEST_INT_MAX, obj1.plane());
MyGLContext obj2(obj1);
// bool QGLContext::windowCreated()
@@ -452,5 +625,124 @@ void tst_QGL::partialGLWidgetUpdates()
QCOMPARE(widget.paintEventRegion, QRegion(widget.rect()));
}
+class ColormapExtended : public QGLColormap
+{
+public:
+ ColormapExtended() {}
+
+ Qt::HANDLE handle() { return QGLColormap::handle(); }
+ void setHandle(Qt::HANDLE handle) { QGLColormap::setHandle(handle); }
+};
+
+void tst_QGL::colormap()
+{
+ // Check the properties of the default empty colormap.
+ QGLColormap cmap1;
+ QVERIFY(cmap1.isEmpty());
+ QCOMPARE(cmap1.size(), 0);
+ QVERIFY(cmap1.entryRgb(0) == 0);
+ QVERIFY(cmap1.entryRgb(-1) == 0);
+ QVERIFY(cmap1.entryRgb(100) == 0);
+ QVERIFY(!cmap1.entryColor(0).isValid());
+ QVERIFY(!cmap1.entryColor(-1).isValid());
+ QVERIFY(!cmap1.entryColor(100).isValid());
+ QCOMPARE(cmap1.find(qRgb(255, 0, 0)), -1);
+ QCOMPARE(cmap1.findNearest(qRgb(255, 0, 0)), -1);
+
+ // Set an entry and re-test.
+ cmap1.setEntry(56, qRgb(255, 0, 0));
+ // The colormap is still considered "empty" even though it
+ // has entries in it now. The isEmpty() method is used to
+ // detect when the colormap is in use by a GL widget,
+ // not to detect when it is empty!
+ QVERIFY(cmap1.isEmpty());
+ QCOMPARE(cmap1.size(), 256);
+ QVERIFY(cmap1.entryRgb(0) == 0);
+ QVERIFY(cmap1.entryColor(0) == QColor(0, 0, 0, 255));
+ QVERIFY(cmap1.entryRgb(56) == qRgb(255, 0, 0));
+ QVERIFY(cmap1.entryColor(56) == QColor(255, 0, 0, 255));
+ QCOMPARE(cmap1.find(qRgb(255, 0, 0)), 56);
+ QCOMPARE(cmap1.findNearest(qRgb(255, 0, 0)), 56);
+
+ // Set some more entries.
+ static QRgb const colors[] = {
+ qRgb(255, 0, 0),
+ qRgb(0, 255, 0),
+ qRgb(255, 255, 255),
+ qRgb(0, 0, 255),
+ qRgb(0, 0, 0)
+ };
+ cmap1.setEntry(57, QColor(0, 255, 0));
+ cmap1.setEntries(3, colors + 2, 58);
+ cmap1.setEntries(5, colors, 251);
+ int idx;
+ for (idx = 0; idx < 5; ++idx) {
+ QVERIFY(cmap1.entryRgb(56 + idx) == colors[idx]);
+ QVERIFY(cmap1.entryColor(56 + idx) == QColor(colors[idx]));
+ QVERIFY(cmap1.entryRgb(251 + idx) == colors[idx]);
+ QVERIFY(cmap1.entryColor(251 + idx) == QColor(colors[idx]));
+ }
+ QCOMPARE(cmap1.size(), 256);
+
+ // Perform color lookups.
+ QCOMPARE(cmap1.find(qRgb(255, 0, 0)), 56);
+ QCOMPARE(cmap1.find(qRgb(0, 0, 0)), 60); // Actually finds 0, 0, 0, 255.
+ QCOMPARE(cmap1.find(qRgba(0, 0, 0, 0)), 0);
+ QCOMPARE(cmap1.find(qRgb(0, 255, 0)), 57);
+ QCOMPARE(cmap1.find(qRgb(255, 255, 255)), 58);
+ QCOMPARE(cmap1.find(qRgb(0, 0, 255)), 59);
+ QCOMPARE(cmap1.find(qRgb(140, 0, 0)), -1);
+ QCOMPARE(cmap1.find(qRgb(0, 140, 0)), -1);
+ QCOMPARE(cmap1.find(qRgb(0, 0, 140)), -1);
+ QCOMPARE(cmap1.find(qRgb(64, 0, 0)), -1);
+ QCOMPARE(cmap1.find(qRgb(0, 64, 0)), -1);
+ QCOMPARE(cmap1.find(qRgb(0, 0, 64)), -1);
+ QCOMPARE(cmap1.findNearest(qRgb(255, 0, 0)), 56);
+ QCOMPARE(cmap1.findNearest(qRgb(0, 0, 0)), 60);
+ QCOMPARE(cmap1.findNearest(qRgba(0, 0, 0, 0)), 0);
+ QCOMPARE(cmap1.findNearest(qRgb(0, 255, 0)), 57);
+ QCOMPARE(cmap1.findNearest(qRgb(255, 255, 255)), 58);
+ QCOMPARE(cmap1.findNearest(qRgb(0, 0, 255)), 59);
+ QCOMPARE(cmap1.findNearest(qRgb(140, 0, 0)), 56);
+ QCOMPARE(cmap1.findNearest(qRgb(0, 140, 0)), 57);
+ QCOMPARE(cmap1.findNearest(qRgb(0, 0, 140)), 59);
+ QCOMPARE(cmap1.findNearest(qRgb(64, 0, 0)), 0);
+ QCOMPARE(cmap1.findNearest(qRgb(0, 64, 0)), 0);
+ QCOMPARE(cmap1.findNearest(qRgb(0, 0, 64)), 0);
+
+ // Make some copies of the colormap and check that they are the same.
+ QGLColormap cmap2(cmap1);
+ QGLColormap cmap3;
+ cmap3 = cmap1;
+ QVERIFY(cmap2.isEmpty());
+ QVERIFY(cmap3.isEmpty());
+ QCOMPARE(cmap2.size(), 256);
+ QCOMPARE(cmap3.size(), 256);
+ for (idx = 0; idx < 256; ++idx) {
+ QCOMPARE(cmap1.entryRgb(idx), cmap2.entryRgb(idx));
+ QCOMPARE(cmap1.entryRgb(idx), cmap3.entryRgb(idx));
+ }
+
+ // Modify an entry in one of the copies and recheck the original.
+ cmap2.setEntry(45, qRgb(255, 0, 0));
+ for (idx = 0; idx < 256; ++idx) {
+ if (idx != 45)
+ QCOMPARE(cmap1.entryRgb(idx), cmap2.entryRgb(idx));
+ else
+ QCOMPARE(cmap2.entryRgb(45), qRgb(255, 0, 0));
+ QCOMPARE(cmap1.entryRgb(idx), cmap3.entryRgb(idx));
+ }
+
+ // Check that setting the handle will cause isEmpty() to work right.
+ ColormapExtended cmap4;
+ cmap4.setEntry(56, qRgb(255, 0, 0));
+ QVERIFY(cmap4.isEmpty());
+ QCOMPARE(cmap4.size(), 256);
+ cmap4.setHandle(Qt::HANDLE(42));
+ QVERIFY(cmap4.handle() == Qt::HANDLE(42));
+ QVERIFY(!cmap4.isEmpty());
+ QCOMPARE(cmap4.size(), 256);
+}
+
QTEST_MAIN(tst_QGL)
#include "tst_qgl.moc"
diff --git a/tests/auto/qguard/qguard.pro b/tests/auto/qguard/qguard.pro
new file mode 100644
index 0000000..f249dde
--- /dev/null
+++ b/tests/auto/qguard/qguard.pro
@@ -0,0 +1,2 @@
+load(qttest_p4)
+SOURCES += tst_qguard.cpp
diff --git a/tests/auto/qguard/tst_qguard.cpp b/tests/auto/qguard/tst_qguard.cpp
new file mode 100644
index 0000000..96d1b60
--- /dev/null
+++ b/tests/auto/qguard/tst_qguard.cpp
@@ -0,0 +1,350 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// NOTE: This is identical to the QPointer autotest
+
+#include <QtTest/QtTest>
+
+#include <QApplication>
+#include <QDebug>
+#include <QWidget>
+#include <private/qguard_p.h>
+
+class tst_QGuard : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QGuard();
+ ~tst_QGuard();
+
+ inline tst_QGuard *me() const
+ { return const_cast<tst_QGuard *>(this); }
+
+public slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+private slots:
+ void constructors();
+ void destructor();
+ void assignment_operators();
+ void equality_operators();
+ void isNull();
+ void dereference_operators();
+ void disconnect();
+ void castDuringDestruction();
+ void data() const;
+ void dataSignature() const;
+};
+
+tst_QGuard::tst_QGuard()
+{ }
+
+tst_QGuard::~tst_QGuard()
+{ }
+
+void tst_QGuard::initTestCase()
+{ }
+
+void tst_QGuard::cleanupTestCase()
+{ }
+
+void tst_QGuard::init()
+{ }
+
+void tst_QGuard::cleanup()
+{ }
+
+void tst_QGuard::constructors()
+{
+ QGuard<QObject> p1;
+ QGuard<QObject> p2(this);
+ QGuard<QObject> p3(p2);
+ QCOMPARE(p1, QGuard<QObject>(0));
+ QCOMPARE(p2, QGuard<QObject>(this));
+ QCOMPARE(p3, QGuard<QObject>(this));
+}
+
+void tst_QGuard::destructor()
+{
+ QObject *object = new QObject;
+ QGuard<QObject> p = object;
+ QCOMPARE(p, QGuard<QObject>(object));
+ delete object;
+ QCOMPARE(p, QGuard<QObject>(0));
+}
+
+void tst_QGuard::assignment_operators()
+{
+ QGuard<QObject> p1;
+ QGuard<QObject> p2;
+
+ p1 = this;
+ p2 = p1;
+
+ QCOMPARE(p1, QGuard<QObject>(this));
+ QCOMPARE(p2, QGuard<QObject>(this));
+ QCOMPARE(p1, QGuard<QObject>(p2));
+
+ p1 = 0;
+ p2 = p1;
+ QCOMPARE(p1, QGuard<QObject>(0));
+ QCOMPARE(p2, QGuard<QObject>(0));
+ QCOMPARE(p1, QGuard<QObject>(p2));
+
+ QObject *object = new QObject;
+
+ p1 = object;
+ p2 = p1;
+ QCOMPARE(p1, QGuard<QObject>(object));
+ QCOMPARE(p2, QGuard<QObject>(object));
+ QCOMPARE(p1, QGuard<QObject>(p2));
+
+ delete object;
+ QCOMPARE(p1, QGuard<QObject>(0));
+ QCOMPARE(p2, QGuard<QObject>(0));
+ QCOMPARE(p1, QGuard<QObject>(p2));
+}
+
+void tst_QGuard::equality_operators()
+{
+ QGuard<QObject> p1;
+ QGuard<QObject> p2;
+
+ QVERIFY(p1 == p2);
+
+ QObject *object = 0;
+ QWidget *widget = 0;
+
+ p1 = object;
+ QVERIFY(p1 == p2);
+ QVERIFY(p1 == object);
+ p2 = object;
+ QVERIFY(p2 == p1);
+ QVERIFY(p2 == object);
+
+ p1 = this;
+ QVERIFY(p1 != p2);
+ p2 = p1;
+ QVERIFY(p1 == p2);
+
+ // compare to zero
+ p1 = 0;
+ QVERIFY(p1 == 0);
+ QVERIFY(0 == p1);
+ QVERIFY(p2 != 0);
+ QVERIFY(0 != p2);
+ QVERIFY(p1 == object);
+ QVERIFY(object == p1);
+ QVERIFY(p2 != object);
+ QVERIFY(object != p2);
+ QVERIFY(p1 == widget);
+ QVERIFY(widget == p1);
+ QVERIFY(p2 != widget);
+ QVERIFY(widget != p2);
+}
+
+void tst_QGuard::isNull()
+{
+ QGuard<QObject> p1;
+ QVERIFY(p1.isNull());
+ p1 = this;
+ QVERIFY(!p1.isNull());
+ p1 = 0;
+ QVERIFY(p1.isNull());
+}
+
+void tst_QGuard::dereference_operators()
+{
+ QGuard<tst_QGuard> p1 = this;
+
+ QObject *object = p1->me();
+ QVERIFY(object == this);
+
+ QObject &ref = *p1;
+ QVERIFY(&ref == this);
+
+ object = static_cast<QObject *>(p1);
+ QVERIFY(object == this);
+}
+
+void tst_QGuard::disconnect()
+{
+ QGuard<QObject> p1 = new QObject;
+ QVERIFY(!p1.isNull());
+ p1->disconnect();
+ QVERIFY(!p1.isNull());
+ delete static_cast<QObject *>(p1);
+ QVERIFY(p1.isNull());
+}
+
+class ChildObject : public QObject
+{
+ QGuard<QObject> guardedPointer;
+
+public:
+ ChildObject(QObject *parent)
+ : QObject(parent), guardedPointer(parent)
+ { }
+ ~ChildObject();
+};
+
+ChildObject::~ChildObject()
+{
+ QCOMPARE(static_cast<QObject *>(guardedPointer), static_cast<QObject *>(0));
+ QCOMPARE(qobject_cast<QObject *>(guardedPointer), static_cast<QObject *>(0));
+}
+
+class ChildWidget : public QWidget
+{
+ QGuard<QWidget> guardedPointer;
+
+public:
+ ChildWidget(QWidget *parent)
+ : QWidget(parent), guardedPointer(parent)
+ { }
+ ~ChildWidget();
+};
+
+ChildWidget::~ChildWidget()
+{
+ QCOMPARE(static_cast<QWidget *>(guardedPointer), static_cast<QWidget *>(0));
+ QCOMPARE(qobject_cast<QWidget *>(guardedPointer), static_cast<QWidget *>(0));
+}
+
+class DerivedChild;
+
+class DerivedParent : public QObject
+{
+ Q_OBJECT
+
+ DerivedChild *derivedChild;
+
+public:
+ DerivedParent();
+ ~DerivedParent();
+};
+
+class DerivedChild : public QObject
+{
+ Q_OBJECT
+
+ DerivedParent *parentPointer;
+ QGuard<DerivedParent> guardedParentPointer;
+
+public:
+ DerivedChild(DerivedParent *parent)
+ : QObject(parent), parentPointer(parent), guardedParentPointer(parent)
+ { }
+ ~DerivedChild();
+};
+
+DerivedParent::DerivedParent()
+ : QObject()
+{
+ derivedChild = new DerivedChild(this);
+}
+
+DerivedParent::~DerivedParent()
+{
+ delete derivedChild;
+}
+
+DerivedChild::~DerivedChild()
+{
+ QCOMPARE(static_cast<DerivedParent *>(guardedParentPointer), parentPointer);
+ QCOMPARE(qobject_cast<DerivedParent *>(guardedParentPointer), parentPointer);
+}
+
+void tst_QGuard::castDuringDestruction()
+{
+ {
+ QObject *parentObject = new QObject();
+ (void) new ChildObject(parentObject);
+ delete parentObject;
+ }
+
+ {
+ QWidget *parentWidget = new QWidget();
+ (void) new ChildWidget(parentWidget);
+ delete parentWidget;
+ }
+
+ {
+ delete new DerivedParent();
+ }
+}
+
+void tst_QGuard::data() const
+{
+ /* Check value of a default constructed object. */
+ {
+ QGuard<QObject> p;
+ QCOMPARE(p.data(), static_cast<QObject *>(0));
+ }
+
+ /* Check value of a default constructed object. */
+ {
+ QObject *const object = new QObject();
+ QGuard<QObject> p(object);
+ QCOMPARE(p.data(), object);
+ }
+}
+
+void tst_QGuard::dataSignature() const
+{
+ /* data() should be const. */
+ {
+ const QGuard<QObject> p;
+ p.data();
+ }
+
+ /* The return type should be T. */
+ {
+ const QGuard<QWidget> p;
+ /* If the types differs, the QCOMPARE will fail to instansiate. */
+ QCOMPARE(p.data(), static_cast<QWidget *>(0));
+ }
+}
+
+QTEST_MAIN(tst_QGuard)
+#include "tst_qguard.moc"
diff --git a/tests/auto/qhelpenginecore/data/collection.qhc b/tests/auto/qhelpenginecore/data/collection.qhc
index 6fb8abb..bd2f37c 100644
--- a/tests/auto/qhelpenginecore/data/collection.qhc
+++ b/tests/auto/qhelpenginecore/data/collection.qhc
Binary files differ
diff --git a/tests/auto/qhelpenginecore/data/collection1.qhc b/tests/auto/qhelpenginecore/data/collection1.qhc
index 45acf33..de310ea 100644
--- a/tests/auto/qhelpenginecore/data/collection1.qhc
+++ b/tests/auto/qhelpenginecore/data/collection1.qhc
Binary files differ
diff --git a/tests/auto/qhelpenginecore/data/linguist-3.3.8.qch b/tests/auto/qhelpenginecore/data/linguist-3.3.8.qch
index 0b53cd8..ed9a89c 100644
--- a/tests/auto/qhelpenginecore/data/linguist-3.3.8.qch
+++ b/tests/auto/qhelpenginecore/data/linguist-3.3.8.qch
Binary files differ
diff --git a/tests/auto/qhelpenginecore/data/qmake-3.3.8.qch b/tests/auto/qhelpenginecore/data/qmake-3.3.8.qch
index a3ca18a..0e95c14 100644
--- a/tests/auto/qhelpenginecore/data/qmake-3.3.8.qch
+++ b/tests/auto/qhelpenginecore/data/qmake-3.3.8.qch
Binary files differ
diff --git a/tests/auto/qhelpenginecore/data/qmake-4.3.0.qch b/tests/auto/qhelpenginecore/data/qmake-4.3.0.qch
index 8f76134..337d7a1 100644
--- a/tests/auto/qhelpenginecore/data/qmake-4.3.0.qch
+++ b/tests/auto/qhelpenginecore/data/qmake-4.3.0.qch
Binary files differ
diff --git a/tests/auto/qhelpenginecore/data/test.qch b/tests/auto/qhelpenginecore/data/test.qch
index 8a8f7a1..06b789a 100644
--- a/tests/auto/qhelpenginecore/data/test.qch
+++ b/tests/auto/qhelpenginecore/data/test.qch
Binary files differ
diff --git a/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp b/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp
index d62c8e5..f9aa653 100644
--- a/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp
+++ b/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp
@@ -130,7 +130,7 @@ void tst_QHelpEngineCore::setCollectionFile()
QStringList docs = help.registeredDocumentations();
QCOMPARE(docs.count(), 1);
- QCOMPARE(docs.first(), QLatin1String("trolltech.com.1_0_0.test"));
+ QCOMPARE(docs.first(), QLatin1String("trolltech.com.1-0-0.test"));
}
void tst_QHelpEngineCore::copyCollectionFile()
@@ -177,7 +177,7 @@ void tst_QHelpEngineCore::copyCollectionFile()
i = 0;
while (m_query->next()) {
if (i == 0) {
- QCOMPARE(m_query->value(0).toString(), QString("trolltech.com.3_3_8.qmake"));
+ QCOMPARE(m_query->value(0).toString(), QString("trolltech.com.3-3-8.qmake"));
QCOMPARE(m_query->value(1).toString(), QString("data/qmake-3.3.8.qch"));
}
++i;
@@ -193,9 +193,9 @@ void tst_QHelpEngineCore::copyCollectionFile()
void tst_QHelpEngineCore::namespaceName()
{
QCOMPARE(QHelpEngineCore::namespaceName(m_path + "/data/qmake-3.3.8.qch"),
- QString("trolltech.com.3_3_8.qmake"));
+ QString("trolltech.com.3-3-8.qmake"));
QCOMPARE(QHelpEngineCore::namespaceName(m_path + "/data/linguist-3.3.8.qch"),
- QString("trolltech.com.3_3_8.linguist"));
+ QString("trolltech.com.3-3-8.linguist"));
}
void tst_QHelpEngineCore::registeredDocumentations()
@@ -205,8 +205,8 @@ void tst_QHelpEngineCore::registeredDocumentations()
QStringList docs = help.registeredDocumentations();
QCOMPARE(docs.count(), 3);
QStringList lst;
- lst << "trolltech.com.3_3_8.qmake" << "trolltech.com.4_3_0.qmake"
- << "trolltech.com.1_0_0.test";
+ lst << "trolltech.com.3-3-8.qmake" << "trolltech.com.4-3-0.qmake"
+ << "trolltech.com.1-0-0.test";
foreach (QString s, docs)
lst.removeAll(s);
QCOMPARE(lst.isEmpty(), true);
@@ -236,7 +236,7 @@ void tst_QHelpEngineCore::registerDocumentation()
}
QSqlQuery query(db);
query.exec("SELECT FilePath FROM NamespaceTable WHERE "
- "Name=\'trolltech.com.3_3_8.linguist\'");
+ "Name=\'trolltech.com.3-3-8.linguist\'");
if (query.next())
QCOMPARE(query.value(0).toString(),
QString("linguist-3.3.8.qch"));
@@ -251,7 +251,7 @@ void tst_QHelpEngineCore::unregisterDocumentation()
QHelpEngineCore c(m_colFile);
QCOMPARE(c.setupData(), true);
QCOMPARE(c.registeredDocumentations().count(), 3);
- c.unregisterDocumentation("trolltech.com.3_3_8.qmake");
+ c.unregisterDocumentation("trolltech.com.3-3-8.qmake");
QCOMPARE(c.registeredDocumentations().count(), 2);
QCOMPARE(c.unregisterDocumentation("noexisting"), false);
}
@@ -260,9 +260,9 @@ void tst_QHelpEngineCore::documentationFileName()
{
QHelpEngineCore c(m_colFile);
QCOMPARE(c.setupData(), true);
- QCOMPARE(c.documentationFileName(QLatin1String("trolltech.com.3_3_8.qmake")),
+ QCOMPARE(c.documentationFileName(QLatin1String("trolltech.com.3-3-8.qmake")),
QString(m_path + "/data/qmake-3.3.8.qch"));
- QCOMPARE(c.documentationFileName(QLatin1String("trolltech.com.1_0_0.test")),
+ QCOMPARE(c.documentationFileName(QLatin1String("trolltech.com.1-0-0.test")),
QString(m_path + "/data/test.qch"));
QCOMPARE(c.documentationFileName(QLatin1String("trolltech.com.empty")),
QString());
@@ -337,7 +337,7 @@ void tst_QHelpEngineCore::filterAttributeSets()
{
QHelpEngineCore help(m_colFile, 0);
QCOMPARE(help.setupData(), true);
- QList<QStringList> lst = help.filterAttributeSets("trolltech.com.1_0_0.test");
+ QList<QStringList> lst = help.filterAttributeSets("trolltech.com.1-0-0.test");
QCOMPARE(lst.count(), 2);
QCOMPARE(lst.first().count(), 2);
QCOMPARE((bool)lst.first().contains("filter1"), true);
@@ -348,22 +348,22 @@ void tst_QHelpEngineCore::files()
{
QHelpEngineCore help(m_colFile, 0);
QCOMPARE(help.setupData(), true);
- QList<QUrl> lst = help.files("trolltech.com.4_3_0.qmake",
+ QList<QUrl> lst = help.files("trolltech.com.4-3-0.qmake",
QStringList());
QCOMPARE(lst.count(), 16);
- lst = help.files("trolltech.com.4_3_0.qmake",
+ lst = help.files("trolltech.com.4-3-0.qmake",
QStringList(), "png");
QCOMPARE(lst.count(), 2);
- lst = help.files("trolltech.com.4_3_0.qmake",
+ lst = help.files("trolltech.com.4-3-0.qmake",
QStringList() << "qt", "html");
QCOMPARE(lst.count(), 13);
- lst = help.files("trolltech.com.4_3_0.qmake",
+ lst = help.files("trolltech.com.4-3-0.qmake",
QStringList() << "qt" << "qmake", "html");
QCOMPARE(lst.count(), 13);
- lst = help.files("trolltech.com.4_3_0.qmake",
+ lst = help.files("trolltech.com.4-3-0.qmake",
QStringList() << "qt" << "qmake" << "bla", "html");
QCOMPARE(lst.count(), 0);
- lst = help.files("trolltech.com.4_3_0.qmake",
+ lst = help.files("trolltech.com.4-3-0.qmake",
QStringList() << "qt" << "qmake", "foo");
QCOMPARE(lst.count(), 0);
@@ -378,7 +378,7 @@ void tst_QHelpEngineCore::fileData()
QCOMPARE(help.setupData(), true);
QByteArray ba = help.fileData(QUrl("NotExisting"));
QCOMPARE(ba.size(), 0);
- ba = help.fileData(QUrl("qthelp://trolltech.com.1_0_0.test/testFolder/test.html"));
+ ba = help.fileData(QUrl("qthelp://trolltech.com.1-0-0.test/testFolder/test.html"));
QTextStream s(ba, QIODevice::ReadOnly|QIODevice::Text);
QFile f(m_path + "/data/test.html");
if (!f.open(QIODevice::ReadOnly|QIODevice::Text))
@@ -396,7 +396,7 @@ void tst_QHelpEngineCore::linksForIdentifier()
QCOMPARE(map.contains("Test Manual"), true);
QCOMPARE(map.count(), 1);
QCOMPARE(map.value("Test Manual"),
- QUrl("qthelp://trolltech.com.1_0_0.test/testFolder/test.html#foo"));
+ QUrl("qthelp://trolltech.com.1-0-0.test/testFolder/test.html#foo"));
help.setCurrentFilter("Custom Filter 2");
map = help.linksForIdentifier("People::newton");
@@ -405,7 +405,7 @@ void tst_QHelpEngineCore::linksForIdentifier()
QCOMPARE(map.contains("Fancy"), true);
QCOMPARE(map.count(), 1);
QCOMPARE(map.value("Fancy"),
- QUrl("qthelp://trolltech.com.1_0_0.test/testFolder/fancy.html#foobar"));
+ QUrl("qthelp://trolltech.com.1-0-0.test/testFolder/fancy.html#foobar"));
}
void tst_QHelpEngineCore::customValue()
diff --git a/tests/auto/qhelpindexmodel/data/collection.qhc b/tests/auto/qhelpindexmodel/data/collection.qhc
index 6fb8abb..bd2f37c 100644
--- a/tests/auto/qhelpindexmodel/data/collection.qhc
+++ b/tests/auto/qhelpindexmodel/data/collection.qhc
Binary files differ
diff --git a/tests/auto/qhelpindexmodel/data/collection1.qhc b/tests/auto/qhelpindexmodel/data/collection1.qhc
index 45acf33..de310ea 100644
--- a/tests/auto/qhelpindexmodel/data/collection1.qhc
+++ b/tests/auto/qhelpindexmodel/data/collection1.qhc
Binary files differ
diff --git a/tests/auto/qhelpindexmodel/data/linguist-3.3.8.qch b/tests/auto/qhelpindexmodel/data/linguist-3.3.8.qch
index 0b53cd8..ed9a89c 100644
--- a/tests/auto/qhelpindexmodel/data/linguist-3.3.8.qch
+++ b/tests/auto/qhelpindexmodel/data/linguist-3.3.8.qch
Binary files differ
diff --git a/tests/auto/qhelpindexmodel/data/qmake-3.3.8.qch b/tests/auto/qhelpindexmodel/data/qmake-3.3.8.qch
index a3ca18a..0e95c14 100644
--- a/tests/auto/qhelpindexmodel/data/qmake-3.3.8.qch
+++ b/tests/auto/qhelpindexmodel/data/qmake-3.3.8.qch
Binary files differ
diff --git a/tests/auto/qhelpindexmodel/data/qmake-4.3.0.qch b/tests/auto/qhelpindexmodel/data/qmake-4.3.0.qch
index 8f76134..337d7a1 100644
--- a/tests/auto/qhelpindexmodel/data/qmake-4.3.0.qch
+++ b/tests/auto/qhelpindexmodel/data/qmake-4.3.0.qch
Binary files differ
diff --git a/tests/auto/qhelpindexmodel/data/test.qch b/tests/auto/qhelpindexmodel/data/test.qch
index 1d6c1a8..4ea9847 100644
--- a/tests/auto/qhelpindexmodel/data/test.qch
+++ b/tests/auto/qhelpindexmodel/data/test.qch
Binary files differ
diff --git a/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp b/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp
index 9482def..3adb894 100644
--- a/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp
+++ b/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp
@@ -185,11 +185,11 @@ void tst_QHelpIndexModel::linksForIndex()
QCOMPARE(map.count(), 2);
QCOMPARE(map.contains("Test Manual"), true);
QCOMPARE(map.value("Test Manual"),
- QUrl("qthelp://trolltech.com.1_0_0.test/testFolder/test.html#foo"));
+ QUrl("qthelp://trolltech.com.1-0-0.test/testFolder/test.html#foo"));
QCOMPARE(map.contains("Fancy"), true);
QCOMPARE(map.value("Fancy"),
- QUrl("qthelp://trolltech.com.1_0_0.test/testFolder/fancy.html#foo"));
+ QUrl("qthelp://trolltech.com.1-0-0.test/testFolder/fancy.html#foo"));
map = m->linksForKeyword("foobar");
QCOMPARE(map.count(), 1);
@@ -208,7 +208,7 @@ void tst_QHelpIndexModel::linksForIndex()
QCOMPARE(map.count(), 1);
QCOMPARE(map.contains("Test Manual"), true);
QCOMPARE(map.value("Test Manual"),
- QUrl("qthelp://trolltech.com.1_0_0.test/testFolder/test.html#foo"));
+ QUrl("qthelp://trolltech.com.1-0-0.test/testFolder/test.html#foo"));
}
QTEST_MAIN(tst_QHelpIndexModel)
diff --git a/tests/auto/qhttp/qhttp.pro b/tests/auto/qhttp/qhttp.pro
index 38569ba..8678a19 100644
--- a/tests/auto/qhttp/qhttp.pro
+++ b/tests/auto/qhttp/qhttp.pro
@@ -21,6 +21,8 @@ wince*: {
addFiles.sources = rfc3252.txt trolltech
addFiles.path = .
DEPLOYMENT = addFiles webFiles cgi
+} else:vxworks*: {
+ DEFINES += SRCDIR=\\\"\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qline/qline.pro b/tests/auto/qline/qline.pro
index 1c4f21a..715774a 100644
--- a/tests/auto/qline/qline.pro
+++ b/tests/auto/qline/qline.pro
@@ -1,4 +1,7 @@
load(qttest_p4)
SOURCES += tst_qline.cpp
QT -= gui
-unix:!mac:!symbian*:LIBS+=-lm
+SOURCES += tst_qline.cpp
+unix:!mac:!symbian*:!vxworks:LIBS+=-lm
+
+
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp
index c65908a..6301d40 100644
--- a/tests/auto/qlocale/tst_qlocale.cpp
+++ b/tests/auto/qlocale/tst_qlocale.cpp
@@ -335,9 +335,8 @@ void tst_QLocale::emptyCtor()
{ \
/* Test constructor without arguments. Needs separate process */ \
/* because of caching of the system locale. */ \
- QString oldEnv = QString::fromLocal8Bit(qgetenv("LANG")); \
- qputenv("LANG", QString(req_lc).toLocal8Bit()); \
QProcess process; \
+ process.setEnvironment(QStringList(env) << QString("LANG=%1").arg(req_lc)); \
process.start("syslocaleapp/syslocaleapp"); \
process.waitForReadyRead(); \
QString ret = QString(process.readAll()); \
@@ -345,18 +344,23 @@ void tst_QLocale::emptyCtor()
QVERIFY2(!ret.isEmpty(), "Cannot launch external process"); \
QVERIFY2(QString(exp_str) == ret, QString("Expected: " + QString(exp_str) + ", got: " \
+ ret + ". Requested: " + QString(req_lc)).toLatin1().constData()); \
- qputenv("LANG", oldEnv.toLocal8Bit()); \
+ }
+
+ // Get an environment free of any locale-related variables
+ QStringList env;
+ foreach (QString const& entry, QProcess::systemEnvironment()) {
+ if (entry.startsWith("LANG=") || entry.startsWith("LC_"))
+ continue;
+ env << entry;
}
// Get default locale.
- QString old = QString::fromLocal8Bit(qgetenv("LANG"));
- qputenv("LANG", "");
QProcess p;
+ p.setEnvironment(env);
p.start("syslocaleapp/syslocaleapp");
p.waitForReadyRead();
QString defaultLoc = QString(p.readAll());
p.waitForFinished();
- qputenv("LANG", old.toLocal8Bit());
TEST_CTOR("C", "C")
TEST_CTOR("bla", "C")
diff --git a/tests/auto/qmake/testdata/simple_app_build/README b/tests/auto/qmake/testdata/simple_app_build/README
new file mode 100644
index 0000000..81dc596
--- /dev/null
+++ b/tests/auto/qmake/testdata/simple_app_build/README
@@ -0,0 +1 @@
+Placeholder file to ensure this directory exists
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp
index ce6afa1..3ce7f7f 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -95,6 +95,7 @@ private slots:
void task250673_activeMultiColumnSubMenuPosition();
void task256918_setFont();
void menuSizeHint();
+ void task258920_mouseBorder();
protected slots:
void onActivated(QAction*);
void onHighlighted(QAction*);
@@ -770,5 +771,40 @@ void tst_QMenu::menuSizeHint()
QCOMPARE(resSize, menu.sizeHint());
}
+class Menu258920 : public QMenu
+{
+ Q_OBJECT
+public slots:
+ void paintEvent(QPaintEvent *e)
+ {
+ QMenu::paintEvent(e);
+ painted = true;
+ }
+
+public:
+ bool painted;
+};
+
+void tst_QMenu::task258920_mouseBorder()
+{
+ Menu258920 menu;
+ QAction *action = menu.addAction("test");
+
+ menu.popup(QPoint());
+ QTest::qWait(100);
+ QRect actionRect = menu.actionGeometry(action);
+ QTest::mouseMove(&menu, actionRect.center());
+ QTest::qWait(30);
+ QTest::mouseMove(&menu, actionRect.center() + QPoint(10, 0));
+ QTest::qWait(30);
+ QCOMPARE(action, menu.activeAction());
+ menu.painted = false;
+ QTest::mouseMove(&menu, QPoint(actionRect.center().x(), actionRect.bottom() + 1));
+ QTest::qWait(30);
+ QCOMPARE(static_cast<QAction*>(0), menu.activeAction());
+ QVERIFY(menu.painted);
+}
+
+
QTEST_MAIN(tst_QMenu)
#include "tst_qmenu.moc"
diff --git a/tests/auto/qmetaobject/qmetaobject.pro b/tests/auto/qmetaobject/qmetaobject.pro
index 22119bc..1df54f7 100644
--- a/tests/auto/qmetaobject/qmetaobject.pro
+++ b/tests/auto/qmetaobject/qmetaobject.pro
@@ -1,4 +1,7 @@
load(qttest_p4)
+
+QT = core gui
+
SOURCES += tst_qmetaobject.cpp
diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp
index dea0ffb..ac2858c 100644
--- a/tests/auto/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp
@@ -108,6 +108,8 @@ class tst_QMetaObject : public QObject
Q_PROPERTY(int value6 READ value6 NOTIFY value6Changed)
Q_PROPERTY(MyStruct value7 READ value7 WRITE setVal7 NOTIFY value7Changed)
Q_PROPERTY(int value8 READ value8 NOTIFY value8Changed)
+ Q_PROPERTY(int value9 READ value9 CONSTANT)
+ Q_PROPERTY(int value10 READ value10 FINAL)
public:
enum EnumType { EnumType1 };
@@ -137,6 +139,10 @@ public:
int value8() const { return 1; }
+ int value9() const { return 1; }
+
+ int value10() const { return 1; }
+
QList<QVariant> value4;
QVariantList value5;
@@ -159,6 +165,8 @@ private slots:
void customPropertyType();
void checkScope();
void propertyNotify();
+ void propertyConstant();
+ void propertyFinal();
void stdSet();
void classInfo();
@@ -785,6 +793,32 @@ void tst_QMetaObject::propertyNotify()
QCOMPARE(signal.signature(), (const char *)0);
}
+void tst_QMetaObject::propertyConstant()
+{
+ const QMetaObject *mo = metaObject();
+
+ QMetaProperty prop = mo->property(mo->indexOfProperty("value8"));
+ QVERIFY(prop.isValid());
+ QVERIFY(!prop.isConstant());
+
+ prop = mo->property(mo->indexOfProperty("value9"));
+ QVERIFY(prop.isValid());
+ QVERIFY(prop.isConstant());
+}
+
+void tst_QMetaObject::propertyFinal()
+{
+ const QMetaObject *mo = metaObject();
+
+ QMetaProperty prop = mo->property(mo->indexOfProperty("value10"));
+ QVERIFY(prop.isValid());
+ QVERIFY(prop.isFinal());
+
+ prop = mo->property(mo->indexOfProperty("value9"));
+ QVERIFY(prop.isValid());
+ QVERIFY(!prop.isFinal());
+}
+
class ClassInfoTestObjectA : public QObject
{
Q_OBJECT
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 18bd803..a4c3b80 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -232,8 +232,10 @@ private Q_SLOTS:
void rateControl();
void downloadPerformance();
void uploadPerformance();
- void httpUploadPerformance();
void performanceControlRate();
+ void httpUploadPerformance();
+ void httpDownloadPerformance_data();
+ void httpDownloadPerformance();
void downloadProgress_data();
void downloadProgress();
@@ -257,8 +259,6 @@ private Q_SLOTS:
void authorizationError();
void httpConnectionCount();
- void httpDownloadPerformance_data();
- void httpDownloadPerformance();
#ifndef QT_NO_OPENSSL
void ignoreSslErrorsList_data();
@@ -523,10 +523,10 @@ public:
QTcpSocket *active = new QTcpSocket(this);
active->connectToHost("127.0.0.1", server.serverPort());
#ifndef Q_OS_SYMBIAN
- if (!active->waitForConnected(10))
+ if (!active->waitForConnected(100))
return false;
- if (!server.waitForNewConnection(10))
+ if (!server.waitForNewConnection(100))
return false;
#else
if (!active->waitForConnected(5000))
@@ -853,6 +853,92 @@ protected:
}
};
+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) {
+ Q_UNUSED(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;
+ }
+ }
+};
tst_QNetworkReply::tst_QNetworkReply()
@@ -3228,7 +3314,7 @@ void tst_QNetworkReply::uploadPerformance()
void tst_QNetworkReply::httpUploadPerformance()
{
- enum {UploadSize = 1000*1024*1024}; // 1000 MB
+ enum {UploadSize = 128*1024*1024}; // 128 MB
ThreadedDataReaderHttpServer reader;
FixedSizeDataGenerator generator(UploadSize);
@@ -3250,7 +3336,7 @@ void tst_QNetworkReply::httpUploadPerformance()
<< ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec";
reader.exit();
- reader.wait(3000);
+ reader.wait();
}
@@ -3278,6 +3364,41 @@ void tst_QNetworkReply::performanceControlRate()
<< elapsedTime << "ms";
}
+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 = 128*1024*1024}; // 128 MB
+ HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding);
+
+ QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1"));
+ QNetworkReplyPtr 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";
+}
+
void tst_QNetworkReply::downloadProgress_data()
{
QTest::addColumn<int>("loopCount");
@@ -3788,130 +3909,6 @@ 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) {
- Q_UNUSED(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;
-}
-
#ifndef QT_NO_OPENSSL
void tst_QNetworkReply::ignoreSslErrorsList_data()
{
@@ -3940,7 +3937,7 @@ void tst_QNetworkReply::ignoreSslErrorsList()
{
QFETCH(QString, url);
QNetworkRequest request(url);
- QNetworkReply *reply = manager.get(request);
+ QNetworkReplyPtr reply = manager.get(request);
QFETCH(QList<QSslError>, expectedSslErrors);
reply->ignoreSslErrors(expectedSslErrors);
@@ -3969,7 +3966,7 @@ void tst_QNetworkReply::ignoreSslErrorsListWithSlot()
{
QFETCH(QString, url);
QNetworkRequest request(url);
- QNetworkReply *reply = manager.get(request);
+ QNetworkReplyPtr reply = manager.get(request);
QFETCH(QList<QSslError>, expectedSslErrors);
// store the errors to ignore them later in the slot connected below
diff --git a/tests/auto/qnumeric/tst_qnumeric.cpp b/tests/auto/qnumeric/tst_qnumeric.cpp
index fb01e1b..0c83db4 100644
--- a/tests/auto/qnumeric/tst_qnumeric.cpp
+++ b/tests/auto/qnumeric/tst_qnumeric.cpp
@@ -41,6 +41,7 @@
#include <QtTest/QtTest>
+#include <QtGlobal>
#include <math.h>
@@ -97,8 +98,12 @@ void tst_QNumeric::qNan()
if (0 > nan)
QFAIL("compiler thinks 0 > nan");
+# if defined(Q_CC_DIAB)
+ QWARN("!(0 < nan) would fail due to a bug in dcc");
+# else
if (0 < nan)
QFAIL("compiler thinks 0 < nan");
+# endif
#endif
QVERIFY(qIsNaN(nan));
QVERIFY(qIsNaN(nan + 1));
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index dd2567d..2627b8d 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -118,6 +118,7 @@ private slots:
void connectToSender();
void qobjectConstCast();
void uniqConnection();
+ void interfaceIid();
protected:
};
@@ -2899,5 +2900,15 @@ void tst_QObject::uniqConnection()
delete r2;
}
+void tst_QObject::interfaceIid()
+{
+ QCOMPARE(QByteArray(qobject_interface_iid<Foo::Bleh *>()),
+ QByteArray(Bleh_iid));
+ QCOMPARE(QByteArray(qobject_interface_iid<Foo::Bar *>()),
+ QByteArray("com.qtest.foobar"));
+ QCOMPARE(QByteArray(qobject_interface_iid<FooObject *>()),
+ QByteArray());
+}
+
QTEST_MAIN(tst_QObject)
#include "tst_qobject.moc"
diff --git a/tests/auto/qobjectrace/tst_qobjectrace.cpp b/tests/auto/qobjectrace/tst_qobjectrace.cpp
index b3052e0..1bd09cd 100644
--- a/tests/auto/qobjectrace/tst_qobjectrace.cpp
+++ b/tests/auto/qobjectrace/tst_qobjectrace.cpp
@@ -124,10 +124,10 @@ signals:
private slots:
void checkStopWatch()
{
-#ifndef Q_OS_WINCE
- if (stopWatch.elapsed() >= OneMinute)
-#else
+#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS)
if (stopWatch.elapsed() >= OneMinute / 2)
+#else
+ if (stopWatch.elapsed() >= OneMinute)
#endif
quit();
@@ -146,7 +146,7 @@ void tst_QObjectRace::moveToThreadRace()
#endif
RaceObject *object = new RaceObject;
- enum { ThreadCount = 10 };
+ enum { ThreadCount = 6 };
RaceThread *threads[ThreadCount];
for (int i = 0; i < ThreadCount; ++i) {
threads[i] = new RaceThread;
diff --git a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp b/tests/auto/qreadwritelock/tst_qreadwritelock.cpp
index 78ddc99..f298812 100644
--- a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp
+++ b/tests/auto/qreadwritelock/tst_qreadwritelock.cpp
@@ -719,6 +719,8 @@ void tst_QReadWriteLock::multipleReadersLoop()
int wait=0;
#if defined (Q_OS_HPUX)
const int numthreads=50;
+#elif defined(Q_OS_VXWORKS)
+ const int numthreads=40;
#else
const int numthreads=75;
#endif
diff --git a/tests/auto/qregexp/qregexp.pro b/tests/auto/qregexp/qregexp.pro
index ac1cdea..80b6827 100644
--- a/tests/auto/qregexp/qregexp.pro
+++ b/tests/auto/qregexp/qregexp.pro
@@ -2,4 +2,7 @@ load(qttest_p4)
QT = core
+
+QT = core
+
SOURCES += tst_qregexp.cpp
diff --git a/tests/auto/qresourceengine/qresourceengine.pro b/tests/auto/qresourceengine/qresourceengine.pro
index d98c2db..c06a5eb 100644
--- a/tests/auto/qresourceengine/qresourceengine.pro
+++ b/tests/auto/qresourceengine/qresourceengine.pro
@@ -19,6 +19,7 @@ runtime_resource.commands = $$QMAKE_RCC -root /runtime_resource/ -binary $${runt
QMAKE_EXTRA_TARGETS = runtime_resource
PRE_TARGETDEPS += $${runtime_resource.target}
+QT = core
wince*|symbian*:{
deploy.sources += runtime_resource.rcc parentdir.txt
test.sources = testqrc/*
diff --git a/tests/auto/qresourceengine/tst_resourceengine.cpp b/tests/auto/qresourceengine/tst_resourceengine.cpp
index f349eac..dfdc454 100644
--- a/tests/auto/qresourceengine/tst_resourceengine.cpp
+++ b/tests/auto/qresourceengine/tst_resourceengine.cpp
@@ -112,7 +112,7 @@ void tst_ResourceEngine::checkStructure_data()
<< QLatin1String("runtime_resource")
<< QLatin1String("searchpath1") << QLatin1String("searchpath2")
<< QLatin1String("secondary_root")
- << QLatin1String("test") << QLatin1String("trolltech")
+ << QLatin1String("test")
<< QLatin1String("withoutslashes"))
<< QLocale::c()
<< qlonglong(0);
diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
index d96006d..3c9ea4c9 100644
--- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
+++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
@@ -72,6 +72,7 @@ private slots:
void scopeChain();
void pushAndPopScope();
void getSetActivationObject();
+ void inheritActivationAndThisObject();
void toString();
};
@@ -689,6 +690,35 @@ void tst_QScriptContext::getSetActivationObject()
}
}
+static QScriptValue myEval(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QString code = ctx->argument(0).toString();
+ ctx->setActivationObject(ctx->parentContext()->activationObject());
+ ctx->setThisObject(ctx->parentContext()->thisObject());
+ return eng->evaluate(code);
+}
+
+void tst_QScriptContext::inheritActivationAndThisObject()
+{
+ QScriptEngine eng;
+ eng.globalObject().setProperty("myEval", eng.newFunction(myEval));
+ {
+ QScriptValue ret = eng.evaluate("var a = 123; myEval('a')");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 123);
+ }
+ {
+ QScriptValue ret = eng.evaluate("(function() { return myEval('this'); }).call(Number)");
+ QVERIFY(ret.isFunction());
+ QVERIFY(ret.equals(eng.globalObject().property("Number")));
+ }
+ {
+ QScriptValue ret = eng.evaluate("(function(a) { return myEval('a'); })(123)");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 123);
+ }
+}
+
static QScriptValue parentContextToString(QScriptContext *ctx, QScriptEngine *)
{
return ctx->parentContext()->toString();
diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro
index 6ff7b53..39484bd 100644
--- a/tests/auto/qscriptengine/qscriptengine.pro
+++ b/tests/auto/qscriptengine/qscriptengine.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
-QT += script
+QT = core gui script
SOURCES += tst_qscriptengine.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index e9d9747..ab4364e 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -122,6 +122,8 @@ private slots:
void reentrancy();
void incDecNonObjectProperty();
void installTranslatorFunctions();
+ void functionScopes();
+ void nativeFunctionScopes();
};
tst_QScriptEngine::tst_QScriptEngine()
@@ -891,6 +893,35 @@ void tst_QScriptEngine::getSetGlobalObject()
QVERIFY(eng.globalObject().strictlyEquals(obj));
QVERIFY(eng.currentContext()->thisObject().strictlyEquals(obj));
QVERIFY(eng.currentContext()->activationObject().strictlyEquals(obj));
+
+ QVERIFY(!obj.property("foo").isValid());
+ eng.evaluate("var foo = 123");
+ {
+ QScriptValue ret = obj.property("foo");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 123);
+ }
+
+ QVERIFY(!obj.property("bar").isValid());
+ eng.evaluate("bar = 456");
+ {
+ QScriptValue ret = obj.property("bar");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 456);
+ }
+
+ QVERIFY(!obj.property("baz").isValid());
+ eng.evaluate("this['baz'] = 789");
+ {
+ QScriptValue ret = obj.property("baz");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 789);
+ }
+
+ {
+ QScriptValue ret = eng.evaluate("(function() { return this; })()");
+ QVERIFY(ret.strictlyEquals(obj));
+ }
}
void tst_QScriptEngine::checkSyntax_data()
@@ -3578,5 +3609,108 @@ void tst_QScriptEngine::installTranslatorFunctions()
}
}
+void tst_QScriptEngine::functionScopes()
+{
+ QScriptEngine eng;
+ {
+ // top-level functions have only the global object in their scope
+ QScriptValue fun = eng.evaluate("(function() {})");
+ QVERIFY(fun.isFunction());
+ QVERIFY(fun.scope().isObject());
+ QVERIFY(fun.scope().strictlyEquals(eng.globalObject()));
+ QVERIFY(!eng.globalObject().scope().isValid());
+ }
+ {
+ QScriptValue fun = eng.globalObject().property("Object");
+ QVERIFY(fun.isFunction());
+ // native built-in functions don't have scope
+ QVERIFY(!fun.scope().isValid());
+ }
+ {
+ // closure
+ QScriptValue fun = eng.evaluate("(function(arg) { var foo = arg; return function() { return foo; }; })(123)");
+ QVERIFY(fun.isFunction());
+ {
+ QScriptValue ret = fun.call();
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 123);
+ }
+ QScriptValue scope = fun.scope();
+ QVERIFY(scope.isObject());
+ {
+ QScriptValue ret = scope.property("foo");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(scope.propertyFlags("foo"), QScriptValue::Undeletable);
+ }
+ {
+ QScriptValue ret = scope.property("arg");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(scope.propertyFlags("arg"), QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+ }
+
+ scope.setProperty("foo", 456);
+ {
+ QScriptValue ret = fun.call();
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 456);
+ }
+
+ scope = scope.scope();
+ QVERIFY(scope.isObject());
+ QVERIFY(scope.strictlyEquals(eng.globalObject()));
+ }
+}
+
+static QScriptValue counter_inner(QScriptContext *ctx, QScriptEngine *)
+{
+ QScriptValue outerAct = ctx->callee().scope();
+ double count = outerAct.property("count").toNumber();
+ outerAct.setProperty("count", count+1);
+ return count;
+}
+
+static QScriptValue counter(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QScriptValue act = ctx->activationObject();
+ act.setProperty("count", ctx->argument(0).toInt32());
+ QScriptValue result = eng->newFunction(counter_inner);
+ result.setScope(act);
+ return result;
+}
+
+static QScriptValue counter_hybrid(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QScriptValue act = ctx->activationObject();
+ act.setProperty("count", ctx->argument(0).toInt32());
+ return eng->evaluate("function() { return count++; }");
+}
+
+void tst_QScriptEngine::nativeFunctionScopes()
+{
+ QScriptEngine eng;
+ {
+ QScriptValue fun = eng.newFunction(counter);
+ QScriptValue cnt = fun.call(QScriptValue(), QScriptValueList() << 123);
+ QVERIFY(cnt.isFunction());
+ {
+ QScriptValue ret = cnt.call();
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 123);
+ }
+ }
+ {
+ QScriptValue fun = eng.newFunction(counter_hybrid);
+ QScriptValue cnt = fun.call(QScriptValue(), QScriptValueList() << 123);
+ QVERIFY(cnt.isFunction());
+ {
+ QScriptValue ret = cnt.call();
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 123);
+ }
+ }
+}
+
QTEST_MAIN(tst_QScriptEngine)
#include "tst_qscriptengine.moc"
diff --git a/tests/auto/qscriptqobject/qscriptqobject.pro b/tests/auto/qscriptqobject/qscriptqobject.pro
index 57eacfe..d28fbef 100644
--- a/tests/auto/qscriptqobject/qscriptqobject.pro
+++ b/tests/auto/qscriptqobject/qscriptqobject.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
-QT += script
+QT = core gui script
SOURCES += tst_qscriptqobject.cpp
symbian: {
diff --git a/tests/auto/qscriptvalue/qscriptvalue.pro b/tests/auto/qscriptvalue/qscriptvalue.pro
index 98fd63d..9efde80 100644
--- a/tests/auto/qscriptvalue/qscriptvalue.pro
+++ b/tests/auto/qscriptvalue/qscriptvalue.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
-QT += script
+QT = core gui script
SOURCES += tst_qscriptvalue.cpp
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index ff2df7a..7939b4c 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2148,6 +2148,14 @@ void tst_QScriptValue::getSetScope()
QCOMPARE(object2.scope().strictlyEquals(object), true);
+ object.setProperty("foo", 123);
+ QVERIFY(!object2.property("foo").isValid());
+ {
+ QScriptValue ret = object2.property("foo", QScriptValue::ResolveScope);
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 123);
+ }
+
QScriptValue inv;
inv.setScope(object);
QCOMPARE(inv.scope().isValid(), false);
diff --git a/tests/auto/qsharedpointer/qsharedpointer.pro b/tests/auto/qsharedpointer/qsharedpointer.pro
index 6814786..bbd31d7 100644
--- a/tests/auto/qsharedpointer/qsharedpointer.pro
+++ b/tests/auto/qsharedpointer/qsharedpointer.pro
@@ -1,9 +1,14 @@
load(qttest_p4)
+
SOURCES += tst_qsharedpointer.cpp \
forwarddeclaration.cpp \
- forwarddeclared.cpp
+ forwarddeclared.cpp \
+ wrapper.cpp
+
+HEADERS += forwarddeclared.h \
+ wrapper.h
+
QT = core
!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\"
-requires(contains(QT_CONFIG,private_tests))
+
include(externaltests.pri)
-HEADERS += forwarddeclared.h
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index 65be4fe..98fbeb5 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -41,8 +41,19 @@
#define QT_SHAREDPOINTER_TRACK_POINTERS
#include "qsharedpointer.h"
-#include "externaltests.h"
#include <QtTest/QtTest>
+#include <QtCore/QThread>
+#include <QtCore/QVector>
+
+#include "externaltests.h"
+#include "wrapper.h"
+
+#include <stdlib.h>
+#include <time.h>
+
+namespace QtSharedPointer {
+ Q_CORE_EXPORT void internalSafetyCheckCleanCheck();
+}
#ifdef Q_OS_SYMBIAN
#define SRCDIR "."
@@ -72,10 +83,34 @@ private slots:
void constCorrectness();
void customDeleter();
void creating();
+ void mixTrackingPointerCode();
+ void threadStressTest_data();
+ void threadStressTest();
void validConstructs();
void invalidConstructs_data();
void invalidConstructs();
+
+public slots:
+ void cleanup() { check(); }
+
+public:
+ inline void check()
+ {
+#ifdef QT_BUILD_INTERNAL
+ QtSharedPointer::internalSafetyCheckCleanCheck();
+#endif
+ }
+};
+
+template <typename Base>
+class RefCountHack: public Base
+{
+public:
+ using Base::d;
};
+template<typename Base> static inline
+QtSharedPointer::ExternalRefCountData *refCountData(const Base &b)
+{ return static_cast<const RefCountHack<Base> *>(&b)->d; }
class Data
{
@@ -160,8 +195,8 @@ void tst_QSharedPointer::basics()
QVERIFY(! (ptr == otherData));
QVERIFY(! (otherData == ptr));
}
- QVERIFY(!ptr.d || ptr.d->weakref == 1);
- QVERIFY(!ptr.d || ptr.d->strongref == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref == 1);
{
// create another object:
@@ -173,8 +208,8 @@ void tst_QSharedPointer::basics()
// otherData is deleted here
}
- QVERIFY(!ptr.d || ptr.d->weakref == 1);
- QVERIFY(!ptr.d || ptr.d->strongref == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref == 1);
{
// create a copy:
@@ -190,8 +225,8 @@ void tst_QSharedPointer::basics()
QCOMPARE(copy.data(), aData);
QVERIFY(copy == aData);
}
- QVERIFY(!ptr.d || ptr.d->weakref == 1);
- QVERIFY(!ptr.d || ptr.d->strongref == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref == 1);
{
// create a weak reference:
@@ -222,8 +257,8 @@ void tst_QSharedPointer::basics()
QVERIFY(strong == ptr);
QCOMPARE(strong.data(), aData);
}
- QVERIFY(!ptr.d || ptr.d->weakref == 1);
- QVERIFY(!ptr.d || ptr.d->strongref == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref == 1);
// aData is deleted here
}
@@ -439,15 +474,15 @@ void tst_QSharedPointer::upCast()
QVERIFY(baseptr == derivedptr);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
{
QWeakPointer<DerivedData> derivedptr = qWeakPointerCast<DerivedData>(baseptr);
QVERIFY(baseptr == derivedptr);
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
{
QWeakPointer<Data> weakptr = baseptr;
@@ -455,16 +490,16 @@ void tst_QSharedPointer::upCast()
QVERIFY(baseptr == derivedptr);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
{
QSharedPointer<DerivedData> derivedptr = baseptr.staticCast<DerivedData>();
QVERIFY(baseptr == derivedptr);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
}
class OtherObject: public QObject
@@ -500,6 +535,7 @@ void tst_QSharedPointer::objectCast()
QVERIFY(ptr == data);
#endif
}
+ check();
{
const OtherObject *data = new OtherObject;
@@ -527,6 +563,7 @@ void tst_QSharedPointer::objectCast()
QVERIFY(ptr == data);
#endif
}
+ check();
{
OtherObject *data = new OtherObject;
@@ -568,6 +605,7 @@ void tst_QSharedPointer::objectCast()
QVERIFY(otherptr.isNull());
#endif
}
+ check();
}
void tst_QSharedPointer::differentPointers()
@@ -587,6 +625,7 @@ void tst_QSharedPointer::differentPointers()
QVERIFY(baseptr == aData);
QVERIFY(baseptr == aBase);
}
+ check();
{
DiffPtrDerivedData *aData = new DiffPtrDerivedData;
@@ -601,6 +640,7 @@ void tst_QSharedPointer::differentPointers()
QVERIFY(ptr == aBase);
QVERIFY(baseptr == aData);
}
+ check();
{
DiffPtrDerivedData *aData = new DiffPtrDerivedData;
@@ -617,6 +657,7 @@ void tst_QSharedPointer::differentPointers()
QVERIFY(baseptr == aData);
QVERIFY(baseptr == aBase);
}
+ check();
}
void tst_QSharedPointer::virtualBaseDifferentPointers()
@@ -636,6 +677,7 @@ void tst_QSharedPointer::virtualBaseDifferentPointers()
QVERIFY(baseptr == aData);
QVERIFY(baseptr == aBase);
}
+ check();
{
VirtualDerived *aData = new VirtualDerived;
@@ -652,6 +694,7 @@ void tst_QSharedPointer::virtualBaseDifferentPointers()
QVERIFY(baseptr == aData);
QVERIFY(baseptr == aBase);
}
+ check();
}
#ifndef QTEST_NO_RTTI
@@ -666,8 +709,8 @@ void tst_QSharedPointer::dynamicCast()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
{
QWeakPointer<Data> weakptr = baseptr;
@@ -676,8 +719,8 @@ void tst_QSharedPointer::dynamicCast()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
{
QSharedPointer<DerivedData> derivedptr = baseptr.dynamicCast<DerivedData>();
@@ -685,8 +728,8 @@ void tst_QSharedPointer::dynamicCast()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
}
void tst_QSharedPointer::dynamicCastDifferentPointers()
@@ -701,8 +744,8 @@ void tst_QSharedPointer::dynamicCastDifferentPointers()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
{
QWeakPointer<Data> weakptr = baseptr;
@@ -711,8 +754,8 @@ void tst_QSharedPointer::dynamicCastDifferentPointers()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
{
QSharedPointer<DiffPtrDerivedData> derivedptr = baseptr.dynamicCast<DiffPtrDerivedData>();
@@ -720,8 +763,8 @@ void tst_QSharedPointer::dynamicCastDifferentPointers()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
{
Stuffing *nakedptr = dynamic_cast<Stuffing *>(baseptr.data());
@@ -746,8 +789,8 @@ void tst_QSharedPointer::dynamicCastVirtualBase()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
{
QWeakPointer<Data> weakptr = baseptr;
@@ -756,8 +799,8 @@ void tst_QSharedPointer::dynamicCastVirtualBase()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
{
QSharedPointer<VirtualDerived> derivedptr = baseptr.dynamicCast<VirtualDerived>();
@@ -765,8 +808,8 @@ void tst_QSharedPointer::dynamicCastVirtualBase()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
}
void tst_QSharedPointer::dynamicCastFailure()
@@ -778,15 +821,15 @@ void tst_QSharedPointer::dynamicCastFailure()
QSharedPointer<DerivedData> derivedptr = qSharedPointerDynamicCast<DerivedData>(baseptr);
QVERIFY(derivedptr.isNull());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
{
QSharedPointer<DerivedData> derivedptr = baseptr.dynamicCast<DerivedData>();
QVERIFY(derivedptr.isNull());
}
- QCOMPARE(int(baseptr.d->weakref), 1);
- QCOMPARE(int(baseptr.d->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref), 1);
}
#endif
@@ -818,6 +861,7 @@ void tst_QSharedPointer::constCorrectness()
ptr = cvptr.constCast<Data>();
#endif
}
+ check();
{
Data *aData = new Data;
@@ -831,6 +875,7 @@ void tst_QSharedPointer::constCorrectness()
QCOMPARE(cptr.data(), aData);
QCOMPARE(cptr.operator->(), aData);
}
+ check();
}
static int customDeleterFnCallCount;
@@ -840,9 +885,14 @@ void customDeleterFn(Data *ptr)
delete ptr;
}
+static int refcount;
+
template <typename T>
struct CustomDeleter
{
+ CustomDeleter() { ++refcount; }
+ CustomDeleter(const CustomDeleter &) { ++refcount; }
+ ~CustomDeleter() { --refcount; }
inline void operator()(T *ptr)
{
delete ptr;
@@ -859,11 +909,13 @@ void tst_QSharedPointer::customDeleter()
QSharedPointer<Data> ptr2(new Data, &Data::alsoDelete);
QSharedPointer<Data> ptr3(new Data, &Data::virtualDelete);
}
+ check();
{
QSharedPointer<DerivedData> ptr(new DerivedData, &Data::doDelete);
QSharedPointer<DerivedData> ptr2(new DerivedData, &Data::alsoDelete);
QSharedPointer<DerivedData> ptr3(new DerivedData, &Data::virtualDelete);
}
+ check();
customDeleterFnCallCount = 0;
{
@@ -872,6 +924,7 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(customDeleterFnCallCount, 0);
}
QCOMPARE(customDeleterFnCallCount, 1);
+ check();
customDeleterFnCallCount = 0;
{
@@ -881,6 +934,7 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(customDeleterFnCallCount, 1);
}
QCOMPARE(customDeleterFnCallCount, 1);
+ check();
customDeleterFnCallCount = 0;
{
@@ -890,6 +944,7 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(customDeleterFnCallCount, 1);
}
QCOMPARE(customDeleterFnCallCount, 1);
+ check();
customDeleterFnCallCount = 0;
{
@@ -898,6 +953,7 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(customDeleterFnCallCount, 0);
}
QCOMPARE(customDeleterFnCallCount, 1);
+ check();
customDeleterFnCallCount = 0;
{
@@ -906,6 +962,7 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(customDeleterFnCallCount, 0);
}
QCOMPARE(customDeleterFnCallCount, 1);
+ check();
customDeleterFnCallCount = 0;
{
@@ -918,6 +975,7 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(customDeleterFnCallCount, 0);
}
QCOMPARE(customDeleterFnCallCount, 1);
+ check();
customDeleterFnCallCount = 0;
{
@@ -930,7 +988,9 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(customDeleterFnCallCount, 0);
}
QCOMPARE(customDeleterFnCallCount, 1);
+ check();
+ refcount = 0;
CustomDeleter<Data> dataDeleter;
dataDeleter.callCount = 0;
{
@@ -939,6 +999,8 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(dataDeleter.callCount, 0);
}
QCOMPARE(dataDeleter.callCount, 1);
+ QCOMPARE(refcount, 1);
+ check();
dataDeleter.callCount = 0;
{
@@ -948,6 +1010,8 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(dataDeleter.callCount, 0);
}
QCOMPARE(dataDeleter.callCount, 1);
+ QCOMPARE(refcount, 1);
+ check();
dataDeleter.callCount = 0;
{
@@ -960,6 +1024,8 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(dataDeleter.callCount, 0);
}
QCOMPARE(dataDeleter.callCount, 1);
+ QCOMPARE(refcount, 1);
+ check();
dataDeleter.callCount = 0;
{
@@ -968,6 +1034,8 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(dataDeleter.callCount, 0);
}
QCOMPARE(dataDeleter.callCount, 1);
+ QCOMPARE(refcount, 1);
+ check();
CustomDeleter<DerivedData> derivedDataDeleter;
derivedDataDeleter.callCount = 0;
@@ -980,6 +1048,8 @@ void tst_QSharedPointer::customDeleter()
}
QCOMPARE(dataDeleter.callCount, 0);
QCOMPARE(derivedDataDeleter.callCount, 1);
+ QCOMPARE(refcount, 2);
+ check();
derivedDataDeleter.callCount = 0;
dataDeleter.callCount = 0;
@@ -996,6 +1066,8 @@ void tst_QSharedPointer::customDeleter()
}
QCOMPARE(dataDeleter.callCount, 1);
QCOMPARE(derivedDataDeleter.callCount, 0);
+ QCOMPARE(refcount, 2);
+ check();
derivedDataDeleter.callCount = 0;
dataDeleter.callCount = 0;
@@ -1012,6 +1084,7 @@ void tst_QSharedPointer::customDeleter()
}
QCOMPARE(dataDeleter.callCount, 0);
QCOMPARE(derivedDataDeleter.callCount, 1);
+ QCOMPARE(refcount, 2);
}
void tst_QSharedPointer::creating()
@@ -1029,12 +1102,13 @@ void tst_QSharedPointer::creating()
ptr.clear();
QCOMPARE(Data::destructorCounter, 1);
}
+ check();
Data::generationCounter = Data::destructorCounter = 0;
{
QSharedPointer<Data> ptr = QSharedPointer<Data>::create();
QWeakPointer<Data> weakptr = ptr;
- QtSharedPointer::ExternalRefCountData *d = ptr.d;
+ QtSharedPointer::ExternalRefCountData *d = refCountData(ptr);
ptr.clear();
QVERIFY(ptr.isNull());
@@ -1044,6 +1118,7 @@ void tst_QSharedPointer::creating()
QVERIFY(d->weakref == 1);
QVERIFY(d->strongref == 0);
}
+ check();
Data::generationCounter = Data::destructorCounter = 0;
DerivedData::derivedDestructorCounter = 0;
@@ -1056,6 +1131,7 @@ void tst_QSharedPointer::creating()
QCOMPARE(Data::destructorCounter, 1);
QCOMPARE(DerivedData::derivedDestructorCounter, 1);
}
+ check();
{
QSharedPointer<Data> ptr = QSharedPointer<DiffPtrDerivedData>::create();
@@ -1064,6 +1140,7 @@ void tst_QSharedPointer::creating()
QCOMPARE(ptr.staticCast<DiffPtrDerivedData>()->buffer[3]+0, 16-3);
QCOMPARE(ptr.staticCast<DiffPtrDerivedData>()->buffer[0]+0, 16);
}
+ check();
{
QSharedPointer<VirtualDerived> ptr = QSharedPointer<VirtualDerived>::create();
@@ -1073,6 +1150,7 @@ void tst_QSharedPointer::creating()
QSharedPointer<Data> baseptr = ptr;
QCOMPARE(baseptr->classLevel(), 4);
}
+ check();
{
QSharedPointer<QObject> ptr = QSharedPointer<QObject>::create();
@@ -1083,11 +1161,148 @@ void tst_QSharedPointer::creating()
QVERIFY(qptr.isNull());
}
+ check();
{
QSharedPointer<QObject> ptr = QSharedPointer<OtherObject>::create();
QCOMPARE(ptr->metaObject(), &OtherObject::staticMetaObject);
}
+ check();
+}
+
+void tst_QSharedPointer::mixTrackingPointerCode()
+{
+ {
+ // pointer created with tracking
+ // deleted in code without tracking
+ QSharedPointer<int> ptr = QSharedPointer<int>(new int(42));
+ Wrapper w(ptr);
+ ptr.clear();
+ }
+ check();
+
+ {
+ // pointer created without tracking
+ // deleted in code with tracking
+ Wrapper w = Wrapper::create();
+ w.ptr.clear();
+ }
+}
+
+class ThreadData
+{
+ QAtomicInt * volatile ptr;
+public:
+ ThreadData(QAtomicInt *p) : ptr(p) { }
+ ~ThreadData() { ++ptr; }
+ void ref()
+ {
+ // if we're called after the destructor, we'll crash
+ ptr->ref();
+ }
+};
+
+class StrongThread: public QThread
+{
+protected:
+ void run()
+ {
+ usleep(rand() % 2000);
+ ptr->ref();
+ ptr.clear();
+ }
+public:
+ QSharedPointer<ThreadData> ptr;
+};
+
+class WeakThread: public QThread
+{
+protected:
+ void run()
+ {
+ usleep(rand() % 2000);
+ QSharedPointer<ThreadData> ptr = weak;
+ if (ptr)
+ ptr->ref();
+ ptr.clear();
+ }
+public:
+ QWeakPointer<ThreadData> weak;
+};
+
+void tst_QSharedPointer::threadStressTest_data()
+{
+ QTest::addColumn<int>("strongThreadCount");
+ QTest::addColumn<int>("weakThreadCount");
+
+ QTest::newRow("0+0") << 0 << 0;
+ QTest::newRow("1+0") << 1 << 0;
+ QTest::newRow("2+0") << 2 << 0;
+ QTest::newRow("10+0") << 10 << 0;
+
+ QTest::newRow("0+1") << 0 << 1;
+ QTest::newRow("1+1") << 1 << 1;
+
+ QTest::newRow("2+10") << 2 << 10;
+ QTest::newRow("5+10") << 5 << 10;
+ QTest::newRow("5+30") << 5 << 30;
+
+ QTest::newRow("100+100") << 100 << 100;
+}
+
+void tst_QSharedPointer::threadStressTest()
+{
+ QFETCH(int, strongThreadCount);
+ QFETCH(int, weakThreadCount);
+
+ int guard1[128];
+ QAtomicInt counter;
+ int guard2[128];
+
+ memset(guard1, 0, sizeof guard1);
+ memset(guard2, 0, sizeof guard2);
+
+ for (int r = 0; r < 5; ++r) {
+ QVector<QThread*> allThreads(6 * qMax(strongThreadCount, weakThreadCount) + 3, 0);
+ QSharedPointer<ThreadData> base = QSharedPointer<ThreadData>(new ThreadData(&counter));
+ counter = 0;
+
+ // set the pointers
+ for (int i = 0; i < strongThreadCount; ++i) {
+ StrongThread *t = new StrongThread;
+ t->ptr = base;
+ allThreads[2 * i] = t;
+ }
+ for (int i = 0; i < weakThreadCount; ++i) {
+ WeakThread *t = new WeakThread;
+ t->weak = base;
+ allThreads[6 * i + 3] = t;
+ }
+
+ base.clear();
+
+ srand(time(NULL));
+ // start threads
+ for (int i = 0; i < allThreads.count(); ++i)
+ if (allThreads[i]) allThreads[i]->start();
+
+ // wait for them to finish
+ for (int i = 0; i < allThreads.count(); ++i)
+ if (allThreads[i]) allThreads[i]->wait();
+ qDeleteAll(allThreads);
+
+ // ensure the guards aren't touched
+ for (uint i = 0; i < sizeof guard1 / sizeof guard1[0]; ++i)
+ QVERIFY(!guard1[i]);
+ for (uint i = 0; i < sizeof guard2 / sizeof guard2[0]; ++i)
+ QVERIFY(!guard2[i]);
+
+ // verify that the count is the right range
+ int minValue = strongThreadCount;
+ int maxValue = strongThreadCount + weakThreadCount;
+ QVERIFY(counter >= minValue);
+ QVERIFY(counter <= maxValue);
+ }
}
void tst_QSharedPointer::validConstructs()
@@ -1199,6 +1414,7 @@ void tst_QSharedPointer::invalidConstructs_data()
"QSharedPointer<Data> b;\n"
"if (a + b) return;";
+#if QT_VERSION >= 0x040600
// two objects with the same pointer
QTest::newRow("same-pointer")
<< &QTest::QExternalTest::tryRunFail
@@ -1212,6 +1428,7 @@ void tst_QSharedPointer::invalidConstructs_data()
<< "Data *aData = new Data;\n"
"QSharedPointer<Data> ptr1 = QSharedPointer<Data>(aData);"
"ptr1 = QSharedPointer<Data>(aData);";
+#endif
// any type of cast for unrelated types:
// (we have no reinterpret_cast)
diff --git a/tests/auto/qsharedpointer/wrapper.cpp b/tests/auto/qsharedpointer/wrapper.cpp
new file mode 100644
index 0000000..7640e68
--- /dev/null
+++ b/tests/auto/qsharedpointer/wrapper.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
+# undef QT_SHAREDPOINTER_TRACK_POINTERS
+#endif
+#include <QtCore/qsharedpointer.h>
+#include "wrapper.h"
+
+Wrapper::Wrapper(const QSharedPointer<int> &value)
+ : ptr(value)
+{
+}
+
+Wrapper::~Wrapper()
+{
+}
+
+Wrapper Wrapper::create()
+{
+ return Wrapper(QSharedPointer<int>(new int(-47)));
+}
diff --git a/tests/auto/qsharedpointer/wrapper.h b/tests/auto/qsharedpointer/wrapper.h
new file mode 100644
index 0000000..a888063
--- /dev/null
+++ b/tests/auto/qsharedpointer/wrapper.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef WRAPPER_H
+#define WRAPPER_H
+
+template <class T> class QSharedPointer;
+class Wrapper
+{
+public:
+ QSharedPointer<int> ptr;
+ Wrapper(const QSharedPointer<int> &);
+ ~Wrapper();
+
+ static Wrapper create();
+};
+
+#endif // WRAPPER_H
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index e1f1d3c..4cf8d56 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -2028,8 +2028,8 @@ void tst_QSqlDatabase::mysql_multiselect()
QVERIFY_SQL(q, exec("select version()"));
QVERIFY_SQL(q, next());
QString version=tst_Databases::getMySqlVersion( db );
- int ver=version.section(QChar::fromLatin1('.'),0,1).toDouble();
- if (ver >= 4.1)
+ double ver=version.section(QChar::fromLatin1('.'),0,1).toDouble();
+ if (ver < 4.1)
QSKIP("Test requires MySQL >= 4.1", SkipSingle);
QVERIFY_SQL(q, exec("SELECT * FROM " + qTableName("qtest") + "; SELECT * FROM " + qTableName("qtest")));
diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
index 1e23d3d..d836486 100644
--- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
+++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
@@ -930,13 +930,15 @@ void tst_QSqlRelationalTableModel::casing()
QSqlQuery q(db);
QVERIFY_SQL( q, exec("create table " + qTableName("CASETEST1", db.driver()).toUpper() +
" (id int not null primary key, name varchar(20), title_key int, another_title_key int)"));
+
+ if( !q.exec("create table " + qTableName("casetest1", db.driver()) +
+ " (ident int not null primary key, name varchar(20), title_key int)"))
+ QSKIP("The casing test for this database is irrelevant since this database does not treat different cases as separate entities", SkipAll);
+
QVERIFY_SQL( q, exec("insert into " + qTableName("CASETEST1", db.driver()).toUpper() + " values(1, 'harry', 1, 2)"));
QVERIFY_SQL( q, exec("insert into " + qTableName("CASETEST1", db.driver()).toUpper() + " values(2, 'trond', 2, 1)"));
QVERIFY_SQL( q, exec("insert into " + qTableName("CASETEST1", db.driver()).toUpper() + " values(3, 'vohi', 1, 2)"));
QVERIFY_SQL( q, exec("insert into " + qTableName("CASETEST1", db.driver()).toUpper() + " values(4, 'boris', 2, 2)"));
-
- QVERIFY_SQL( q, exec("create table " + qTableName("casetest1", db.driver()) +
- " (ident int not null primary key, name varchar(20), title_key int)"));
QVERIFY_SQL( q, exec("insert into " + qTableName("casetest1", db.driver()) + " values(1, 'jerry', 1)"));
QVERIFY_SQL( q, exec("insert into " + qTableName("casetest1", db.driver()) + " values(2, 'george', 2)"));
QVERIFY_SQL( q, exec("insert into " + qTableName("casetest1", db.driver()) + " values(4, 'kramer', 2)"));
diff --git a/tests/auto/qstate/tst_qstate.cpp b/tests/auto/qstate/tst_qstate.cpp
index 78b9853..43ea7fe 100644
--- a/tests/auto/qstate/tst_qstate.cpp
+++ b/tests/auto/qstate/tst_qstate.cpp
@@ -250,8 +250,9 @@ class EventTestTransition: public QAbstractTransition
{
public:
EventTestTransition(QEvent::Type type, QState *targetState)
- : QAbstractTransition(QList<QAbstractState*>() << targetState), m_type(type)
- {
+ : QAbstractTransition(), m_type(type)
+ {
+ setTargetState(targetState);
}
protected:
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 7f4d9f5..97115bb 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -192,6 +192,7 @@ private slots:
// void overrideDefaultTargetAnimationWithSource();
void nestedStateMachines();
+ void goToState();
};
tst_QStateMachine::tst_QStateMachine()
@@ -225,7 +226,8 @@ class TestTransition : public QAbstractTransition
{
public:
TestTransition(QAbstractState *target)
- : QAbstractTransition(QList<QAbstractState*>() << target) {}
+ : QAbstractTransition()
+ { setTargetState(target); }
QList<int> triggers;
protected:
virtual bool eventTest(QEvent *) {
@@ -248,7 +250,8 @@ class EventTransition : public QAbstractTransition
{
public:
EventTransition(QEvent::Type type, QAbstractState *target, QState *parent = 0)
- : QAbstractTransition(QList<QAbstractState*>() << target, parent), m_type(type) {}
+ : QAbstractTransition(parent), m_type(type)
+ { setTargetState(target); }
protected:
virtual bool eventTest(QEvent *e) {
return (e->type() == m_type);
@@ -1513,7 +1516,8 @@ class StringTransition : public QAbstractTransition
{
public:
StringTransition(const QString &value, QAbstractState *target)
- : QAbstractTransition(QList<QAbstractState*>() << target), m_value(value) {}
+ : QAbstractTransition(), m_value(value)
+ { setTargetState(target); }
protected:
virtual bool eventTest(QEvent *e)
@@ -1736,7 +1740,8 @@ public:
: QSignalTransition(sourceState) {}
TestSignalTransition(QObject *sender, const char *signal,
QAbstractState *target)
- : QSignalTransition(sender, signal, QList<QAbstractState*>() << target) {}
+ : QSignalTransition(sender, signal)
+ { setTargetState(target); }
QVariantList argumentsReceived() const {
return m_args;
}
@@ -2021,20 +2026,15 @@ void tst_QStateMachine::signalTransitions()
void tst_QStateMachine::eventTransitions()
{
QPushButton button;
- for (int x = 0; x < 2; ++x) {
+ {
QStateMachine machine;
QState *s0 = new QState(&machine);
QFinalState *s1 = new QFinalState(&machine);
QMouseEventTransition *trans;
- if (x == 0) {
- trans = new QMouseEventTransition(&button, QEvent::MouseButtonPress, Qt::LeftButton);
- QCOMPARE(trans->targetState(), (QAbstractState*)0);
- trans->setTargetState(s1);
- } else {
- trans = new QMouseEventTransition(&button, QEvent::MouseButtonPress,
- Qt::LeftButton, QList<QAbstractState*>() << s1);
- }
+ trans = new QMouseEventTransition(&button, QEvent::MouseButtonPress, Qt::LeftButton);
+ QCOMPARE(trans->targetState(), (QAbstractState*)0);
+ trans->setTargetState(s1);
QCOMPARE(trans->eventType(), QEvent::MouseButtonPress);
QCOMPARE(trans->button(), Qt::LeftButton);
QCOMPARE(trans->targetState(), (QAbstractState*)s1);
@@ -2070,7 +2070,7 @@ void tst_QStateMachine::eventTransitions()
QTest::mousePress(&button2, Qt::LeftButton);
QTRY_COMPARE(finishedSpy.count(), 4);
}
- for (int x = 0; x < 3; ++x) {
+ for (int x = 0; x < 2; ++x) {
QStateMachine machine;
QState *s0 = new QState(&machine);
QFinalState *s1 = new QFinalState(&machine);
@@ -2086,9 +2086,6 @@ void tst_QStateMachine::eventTransitions()
} else if (x == 1) {
trans = new QEventTransition(&button, QEvent::MouseButtonPress);
trans->setTargetState(s1);
- } else {
- trans = new QEventTransition(&button, QEvent::MouseButtonPress,
- QList<QAbstractState*>() << s1);
}
QCOMPARE(trans->eventObject(), (QObject*)&button);
QCOMPARE(trans->eventType(), QEvent::MouseButtonPress);
@@ -3900,5 +3897,45 @@ void tst_QStateMachine::nestedStateMachines()
QTRY_COMPARE(finishedSpy.count(), 1);
}
+void tst_QStateMachine::goToState()
+{
+ QStateMachine machine;
+ QState *s1 = new QState(&machine);
+ QState *s2 = new QState(&machine);
+ machine.setInitialState(s1);
+ QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ machine.start();
+ QTRY_COMPARE(startedSpy.count(), 1);
+
+ QStateMachinePrivate::get(&machine)->goToState(s2);
+ QCoreApplication::processEvents();
+ QCOMPARE(machine.configuration().size(), 1);
+ QVERIFY(machine.configuration().contains(s2));
+
+ QStateMachinePrivate::get(&machine)->goToState(s2);
+ QCoreApplication::processEvents();
+ QCOMPARE(machine.configuration().size(), 1);
+ QVERIFY(machine.configuration().contains(s2));
+
+ QStateMachinePrivate::get(&machine)->goToState(s1);
+ QStateMachinePrivate::get(&machine)->goToState(s2);
+ QStateMachinePrivate::get(&machine)->goToState(s1);
+ QCOMPARE(machine.configuration().size(), 1);
+ QVERIFY(machine.configuration().contains(s2));
+
+ QCoreApplication::processEvents();
+ QCOMPARE(machine.configuration().size(), 1);
+ QVERIFY(machine.configuration().contains(s1));
+
+ // go to state in group
+ QState *s2_1 = new QState(s2);
+ s2->setInitialState(s2_1);
+ QStateMachinePrivate::get(&machine)->goToState(s2_1);
+ QCoreApplication::processEvents();
+ QCOMPARE(machine.configuration().size(), 2);
+ QVERIFY(machine.configuration().contains(s2));
+ QVERIFY(machine.configuration().contains(s2_1));
+}
+
QTEST_MAIN(tst_QStateMachine)
#include "tst_qstatemachine.moc"
diff --git a/tests/auto/qtcpsocket/qtcpsocket.pro b/tests/auto/qtcpsocket/qtcpsocket.pro
index f18b471..4bbec23 100644
--- a/tests/auto/qtcpsocket/qtcpsocket.pro
+++ b/tests/auto/qtcpsocket/qtcpsocket.pro
@@ -2,4 +2,4 @@ TEMPLATE = subdirs
!wince*: SUBDIRS = test stressTest
-wince* | symbian* : SUBDIRS = test
+wince*|symbian*|vxworks* : SUBDIRS = test
diff --git a/tests/auto/qtcpsocket/test/test.pro b/tests/auto/qtcpsocket/test/test.pro
index 5d6c3b1..0f93def 100644
--- a/tests/auto/qtcpsocket/test/test.pro
+++ b/tests/auto/qtcpsocket/test/test.pro
@@ -9,6 +9,7 @@ wince*: {
}
}
QT += network
+vxworks:QT -= gui
symbian: TARGET.EPOCHEAPSIZE="0x100 0x1000000"
diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
index ed84273..44e6550 100644
--- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
@@ -63,10 +63,12 @@
#include <QHostAddress>
#include <QHostInfo>
#include <QMap>
+#ifndef Q_OS_VXWORKS
#include <QMessageBox>
+#include <QPushButton>
+#endif
#include <QPointer>
#include <QProcess>
-#include <QPushButton>
#include <QStringList>
#include <QTcpServer>
#include <QTcpSocket>
@@ -174,9 +176,7 @@ private slots:
void connectToLocalHostNoService();
#endif
void waitForConnectedInHostLookupSlot();
-#ifndef Q_OS_WIN
void waitForConnectedInHostLookupSlot2();
-#endif
void readyReadSignalsAfterWaitForReadyRead();
#ifdef Q_OS_LINUX
void linuxKernelBugLocalSocket();
@@ -1599,6 +1599,7 @@ void tst_QTcpSocket::remoteCloseErrorSlot()
void tst_QTcpSocket::messageBoxSlot()
{
+#if !defined(Q_OS_VXWORKS) // no gui
QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender());
socket->deleteLater();
QMessageBox box;
@@ -1609,10 +1610,14 @@ void tst_QTcpSocket::messageBoxSlot()
// Fire a non-0 singleshot to leave time for the delete
QTimer::singleShot(250, this, SLOT(exitLoopSlot()));
+#endif
}
//----------------------------------------------------------------------------------
void tst_QTcpSocket::openMessageBoxInErrorSlot()
{
+#if defined(Q_OS_VXWORKS) // no gui
+ QSKIP("no default gui available on VxWorks", SkipAll);
+#else
QTcpSocket *socket = newSocket();
QPointer<QTcpSocket> p(socket);
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(messageBoxSlot()));
@@ -1620,6 +1625,7 @@ void tst_QTcpSocket::openMessageBoxInErrorSlot()
socket->connectToHost("hostnotfoundhostnotfound.troll.no", 9999); // Host not found, fyi
enterLoop(30);
QVERIFY(!p);
+#endif
}
//----------------------------------------------------------------------------------
@@ -1738,9 +1744,12 @@ public slots:
};
//----------------------------------------------------------------------------------
-#ifndef Q_OS_WIN
void tst_QTcpSocket::waitForConnectedInHostLookupSlot2()
{
+#if defined(Q_OS_WIN) || defined(Q_OS_VXWORKS)
+ QSKIP("waitForConnectedInHostLookupSlot2 is not run on Windows and VxWorks", SkipAll);
+#else
+
Foo foo;
QPushButton top("Go", 0);
top.show();
@@ -1754,9 +1763,9 @@ void tst_QTcpSocket::waitForConnectedInHostLookupSlot2()
QFAIL("Network timeout");
QVERIFY(foo.attemptedToConnect);
- QCOMPARE(foo.count, 1);
-}
+ QCOMPARE(foo.count, 1);
#endif
+}
//----------------------------------------------------------------------------------
void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead()
@@ -1999,7 +2008,7 @@ void tst_QTcpSocket::suddenRemoteDisconnect_data()
void tst_QTcpSocket::suddenRemoteDisconnect()
{
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS)
QSKIP("stressTest subprocess needs Qt3Support", SkipAll);
#elif defined( Q_OS_SYMBIAN )
QSKIP("Symbian: QProcess IO is not yet supported, fix when supported", SkipAll);
@@ -2058,6 +2067,9 @@ void tst_QTcpSocket::connectToMultiIP()
{
QSKIP("TODO: setup DNS in the new network", SkipAll);
+#if defined(Q_OS_VXWORKS)
+ QSKIP("VxSim in standard config doesn't even run a DNS resolver", SkipAll);
+#else
QFETCH_GLOBAL(bool, ssl);
if (ssl)
return;
@@ -2085,6 +2097,7 @@ void tst_QTcpSocket::connectToMultiIP()
QCOMPARE(socket->error(), QAbstractSocket::SocketTimeoutError);
delete socket;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/tests/auto/qthreadonce/tst_qthreadonce.cpp b/tests/auto/qthreadonce/tst_qthreadonce.cpp
index 590de0f..5d9062d 100644
--- a/tests/auto/qthreadonce/tst_qthreadonce.cpp
+++ b/tests/auto/qthreadonce/tst_qthreadonce.cpp
@@ -134,7 +134,7 @@ void tst_QThreadOnce::sameThread()
void tst_QThreadOnce::multipleThreads()
{
-#ifdef Q_OS_WINCE
+#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS)
const int NumberOfThreads = 20;
#else
const int NumberOfThreads = 100;
diff --git a/tests/auto/qthreadpool/tst_qthreadpool.cpp b/tests/auto/qthreadpool/tst_qthreadpool.cpp
index 1111ecc..d4c131d 100644
--- a/tests/auto/qthreadpool/tst_qthreadpool.cpp
+++ b/tests/auto/qthreadpool/tst_qthreadpool.cpp
@@ -205,7 +205,8 @@ void tst_QThreadPool::runTask()
ran = false;
manager.start(new TestTask());
// Hang if task is not runned.
- while (ran == false);
+ while (ran == false)
+ QTest::qSleep(100); // no busy loop - this doesn't work with FIFO schedulers
}
/*
@@ -215,7 +216,8 @@ void tst_QThreadPool::singleton()
{
ran = false;
QThreadPool::globalInstance()->start(new TestTask());
- while (ran == false);
+ while (ran == false)
+ QTest::qSleep(100); // no busy loop - this doesn't work with FIFO schedulers
}
int *value = 0;
diff --git a/tests/auto/qxmlsimplereader/parser/main.cpp b/tests/auto/qxmlsimplereader/parser/main.cpp
index 4834428..ffb2ecd 100644
--- a/tests/auto/qxmlsimplereader/parser/main.cpp
+++ b/tests/auto/qxmlsimplereader/parser/main.cpp
@@ -42,6 +42,7 @@
#include <string.h>
#include <errno.h>
+#include <stdlib.h>
#include <qfile.h>
#include <qstring.h>
diff --git a/tests/auto/selftests/expected_longstring.txt b/tests/auto/selftests/expected_longstring.txt
new file mode 100644
index 0000000..4abdb23
--- /dev/null
+++ b/tests/auto/selftests/expected_longstring.txt
@@ -0,0 +1,16 @@
+********* Start testing of tst_LongString *********
+Config: Using QTest library 4.6.0, Qt 4.6.0
+PASS : tst_LongString::initTestCase()
+FAIL! : tst_LongString::failWithLongString() Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui.
+
+Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia.
+
+Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi.
+
+Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent turpis.
+
+Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero. Phasellus dolor. Maecenas vestibulum mollis diam. Pellentesque ut neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
+ Loc: [/home/rmcgover/depot/qt/master/tests/auto/selftests/longstring/tst_longstring.cpp(67)]
+PASS : tst_LongString::cleanupTestCase()
+Totals: 2 passed, 1 failed, 0 skipped
+********* Finished testing of tst_LongString *********
diff --git a/tests/auto/selftests/longstring/longstring.pro b/tests/auto/selftests/longstring/longstring.pro
new file mode 100644
index 0000000..b917481
--- /dev/null
+++ b/tests/auto/selftests/longstring/longstring.pro
@@ -0,0 +1,10 @@
+load(qttest_p4)
+SOURCES += tst_longstring.cpp
+QT = core
+
+mac:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+
+
+TARGET = longstring
+
diff --git a/tests/auto/selftests/longstring/tst_longstring.cpp b/tests/auto/selftests/longstring/tst_longstring.cpp
new file mode 100644
index 0000000..a708fa7
--- /dev/null
+++ b/tests/auto/selftests/longstring/tst_longstring.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtCore>
+#include <QtTest/QtTest>
+
+char const lipsum[] =
+"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui.\n\n"
+"Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia.\n\n"
+"Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi.\n\n"
+"Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent turpis.\n\n"
+"Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero. Phasellus dolor. Maecenas vestibulum mollis diam. Pellentesque ut neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas."
+;
+
+/*!
+ \internal
+ */
+class tst_LongString: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void failWithLongString() const;
+};
+
+void tst_LongString::failWithLongString() const
+{
+ QFAIL(lipsum);
+}
+
+QTEST_MAIN(tst_LongString)
+
+#include "tst_longstring.moc"
diff --git a/tests/auto/selftests/selftests.pro b/tests/auto/selftests/selftests.pro
index 45de658..d854b5e 100644
--- a/tests/auto/selftests/selftests.pro
+++ b/tests/auto/selftests/selftests.pro
@@ -5,7 +5,7 @@ SUBDIRS = subtest test warnings maxwarnings cmptest globaldata skipglobal skip \
skipinit skipinitdata datetime singleskip assert waitwithoutgui differentexec \
exceptionthrow qexecstringlist datatable commandlinedata\
benchlibwalltime benchlibcallgrind benchlibeventcounter benchlibtickcounter \
- benchliboptions xunit badxml
+ benchliboptions xunit badxml longstring
INSTALLS =
diff --git a/tests/auto/selftests/selftests.qrc b/tests/auto/selftests/selftests.qrc
index 3d78bf5..4b75405 100644
--- a/tests/auto/selftests/selftests.qrc
+++ b/tests/auto/selftests/selftests.qrc
@@ -36,5 +36,6 @@
<file>expected_benchliboptions.txt</file>
<file>expected_benchlibtickcounter.txt</file>
<file>expected_xunit.txt</file>
+ <file>expected_longstring.txt</file>
</qresource>
</RCC>
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 8eb7fe1..76a005b 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -184,13 +184,15 @@ void tst_Selftests::runSubTest_data()
QTest::newRow("benchliboptions") << "benchliboptions" << QStringList("-eventcounter");
QTest::newRow("benchlibwalltime") << "benchlibwalltime" << QStringList();
- //### QWS tests are currently run on a virtual machine, where ticks are not
- //### monotonously increasing
-#if defined(HAVE_TICK_COUNTER) && !defined(Q_WS_QWS)
+ //### This test is affected by the speed of the CPU and whether the tick counter is
+ //### monotonically increasing. It won't work on some machines so leave it off by default.
+ //### Feel free to uncomment for your own testing.
+#if 0
QTest::newRow("benchlibtickcounter") << "benchlibtickcounter" << QStringList("-tickcounter");
#endif
QTest::newRow("xunit") << "xunit" << QStringList("-xunitxml");
+ QTest::newRow("longstring") << "longstring" << QStringList();
}
diff --git a/tests/auto/uic3/uic3.pro b/tests/auto/uic3/uic3.pro
index 520f95a..72a1304 100644
--- a/tests/auto/uic3/uic3.pro
+++ b/tests/auto/uic3/uic3.pro
@@ -6,3 +6,6 @@ TARGET = tst_uic3
# This test is not run on wince (I think)
DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+requires(contains(QT_CONFIG,qt3support))
+
diff --git a/tests/manual/qdesktopwidget/main.cpp b/tests/manual/qdesktopwidget/main.cpp
index 1afc82e..2cbdfb9 100644
--- a/tests/manual/qdesktopwidget/main.cpp
+++ b/tests/manual/qdesktopwidget/main.cpp
@@ -130,7 +130,7 @@ private slots:
screenNumber->setBrush(fillBrush);
screenNumber->setFont(QFont("Arial Black", 18));
screenNumber->setTransform(QTransform().scale(10, 10));
- screenNumber->setTransformOrigin(screenNumber->boundingRect().center());
+ screenNumber->setTransformOriginPoint(screenNumber->boundingRect().center());
QSizeF center = (workRect.size() - screenNumber->boundingRect().size()) / 2;
screenNumber->setPos(center.width(), center.height());
diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp
new file mode 100644
index 0000000..055ff40
--- /dev/null
+++ b/tests/manual/windowflags/controllerwindow.cpp
@@ -0,0 +1,263 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "controllerwindow.h"
+
+//! [0]
+ControllerWindow::ControllerWindow()
+{
+ parentWindow = new QMainWindow;
+ parentWindow->setWindowTitle(tr("Preview parent window"));
+ QLabel *label = new QLabel(tr("Parent window"));
+ parentWindow->setCentralWidget(label);
+
+ previewWindow = new PreviewWindow;
+ previewDialog = new PreviewDialog;
+
+ createTypeGroupBox();
+ createHintsGroupBox();
+
+ quitButton = new QPushButton(tr("&Quit"));
+ connect(quitButton, SIGNAL(clicked()), qApp, SLOT(quit()));
+
+ QHBoxLayout *bottomLayout = new QHBoxLayout;
+ bottomLayout->addStretch();
+ bottomLayout->addWidget(quitButton);
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(widgetTypeGroupBox);
+ mainLayout->addWidget(additionalOptionsGroupBox);
+ mainLayout->addWidget(typeGroupBox);
+ mainLayout->addWidget(hintsGroupBox);
+ mainLayout->addLayout(bottomLayout);
+ setLayout(mainLayout);
+
+ setWindowTitle(tr("Window Flags"));
+ updatePreview();
+}
+
+void ControllerWindow::updatePreview()
+{
+ Qt::WindowFlags flags = 0;
+
+ if (windowRadioButton->isChecked()) {
+ flags = Qt::Window;
+ } else if (dialogRadioButton->isChecked()) {
+ flags = Qt::Dialog;
+ } else if (sheetRadioButton->isChecked()) {
+ flags = Qt::Sheet;
+ } else if (drawerRadioButton->isChecked()) {
+ flags = Qt::Drawer;
+ } else if (popupRadioButton->isChecked()) {
+ flags = Qt::Popup;
+ } else if (toolRadioButton->isChecked()) {
+ flags = Qt::Tool;
+ } else if (toolTipRadioButton->isChecked()) {
+ flags = Qt::ToolTip;
+ } else if (splashScreenRadioButton->isChecked()) {
+ flags = Qt::SplashScreen;
+ }
+
+ if (msWindowsFixedSizeDialogCheckBox->isChecked())
+ flags |= Qt::MSWindowsFixedSizeDialogHint;
+ if (x11BypassWindowManagerCheckBox->isChecked())
+ flags |= Qt::X11BypassWindowManagerHint;
+ if (framelessWindowCheckBox->isChecked())
+ flags |= Qt::FramelessWindowHint;
+ if (windowTitleCheckBox->isChecked())
+ flags |= Qt::WindowTitleHint;
+ if (windowSystemMenuCheckBox->isChecked())
+ flags |= Qt::WindowSystemMenuHint;
+ if (windowMinimizeButtonCheckBox->isChecked())
+ flags |= Qt::WindowMinimizeButtonHint;
+ if (windowMaximizeButtonCheckBox->isChecked())
+ flags |= Qt::WindowMaximizeButtonHint;
+ if (windowCloseButtonCheckBox->isChecked())
+ flags |= Qt::WindowCloseButtonHint;
+ if (windowContextHelpButtonCheckBox->isChecked())
+ flags |= Qt::WindowContextHelpButtonHint;
+ if (windowShadeButtonCheckBox->isChecked())
+ flags |= Qt::WindowShadeButtonHint;
+ if (windowStaysOnTopCheckBox->isChecked())
+ flags |= Qt::WindowStaysOnTopHint;
+ if (windowStaysOnBottomCheckBox->isChecked())
+ flags |= Qt::WindowStaysOnBottomHint;
+ if (customizeWindowHintCheckBox->isChecked())
+ flags |= Qt::CustomizeWindowHint;
+
+ previewWindow->hide();
+ previewDialog->hide();
+ QWidget *widget = 0;
+ if (previewWidgetButton->isChecked())
+ widget = previewWindow;
+ else
+ widget = previewDialog;
+
+ if (modalWindowCheckBox->isChecked()) {
+ parentWindow->show();
+ widget->setWindowModality(Qt::WindowModal);
+ widget->setParent(parentWindow);
+ } else {
+ widget->setWindowModality(Qt::NonModal);
+ widget->setParent(0);
+ parentWindow->hide();
+ }
+
+ widget->setWindowFlags(flags);
+
+ if (fixedSizeWindowCheckBox->isChecked()) {
+ widget->setFixedSize(300, 300);
+ } else {
+ widget->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
+ }
+
+ QPoint pos = widget->pos();
+ if (pos.x() < 0)
+ pos.setX(0);
+ if (pos.y() < 0)
+ pos.setY(0);
+ widget->move(pos);
+ widget->show();
+}
+
+void ControllerWindow::createTypeGroupBox()
+{
+ widgetTypeGroupBox = new QGroupBox(tr("Widget Type"));
+ previewWidgetButton = createRadioButton(tr("QWidget"));
+ previewWidgetButton->setChecked(true);
+ previewDialogButton = createRadioButton(tr("QDialog"));
+ QHBoxLayout *l = new QHBoxLayout;
+ l->addWidget(previewWidgetButton);
+ l->addWidget(previewDialogButton);
+ widgetTypeGroupBox->setLayout(l);
+
+ additionalOptionsGroupBox = new QGroupBox(tr("Additional options"));
+ l = new QHBoxLayout;
+ modalWindowCheckBox = createCheckBox(tr("Modal window"));
+ fixedSizeWindowCheckBox = createCheckBox(tr("Fixed size window"));
+ l->addWidget(modalWindowCheckBox);
+ l->addWidget(fixedSizeWindowCheckBox);
+ additionalOptionsGroupBox->setLayout(l);
+
+ typeGroupBox = new QGroupBox(tr("Type"));
+
+ windowRadioButton = createRadioButton(tr("Window"));
+ dialogRadioButton = createRadioButton(tr("Dialog"));
+ sheetRadioButton = createRadioButton(tr("Sheet"));
+ drawerRadioButton = createRadioButton(tr("Drawer"));
+ popupRadioButton = createRadioButton(tr("Popup"));
+ toolRadioButton = createRadioButton(tr("Tool"));
+ toolTipRadioButton = createRadioButton(tr("Tooltip"));
+ splashScreenRadioButton = createRadioButton(tr("Splash screen"));
+ windowRadioButton->setChecked(true);
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(windowRadioButton, 0, 0);
+ layout->addWidget(dialogRadioButton, 1, 0);
+ layout->addWidget(sheetRadioButton, 2, 0);
+ layout->addWidget(drawerRadioButton, 3, 0);
+ layout->addWidget(popupRadioButton, 0, 1);
+ layout->addWidget(toolRadioButton, 1, 1);
+ layout->addWidget(toolTipRadioButton, 2, 1);
+ layout->addWidget(splashScreenRadioButton, 3, 1);
+ typeGroupBox->setLayout(layout);
+}
+//! [5]
+
+//! [6]
+void ControllerWindow::createHintsGroupBox()
+{
+ hintsGroupBox = new QGroupBox(tr("Hints"));
+
+ msWindowsFixedSizeDialogCheckBox =
+ createCheckBox(tr("MS Windows fixed size dialog"));
+ x11BypassWindowManagerCheckBox =
+ createCheckBox(tr("X11 bypass window manager"));
+ framelessWindowCheckBox = createCheckBox(tr("Frameless window"));
+ windowTitleCheckBox = createCheckBox(tr("Window title"));
+ windowSystemMenuCheckBox = createCheckBox(tr("Window system menu"));
+ windowMinimizeButtonCheckBox = createCheckBox(tr("Window minimize button"));
+ windowMaximizeButtonCheckBox = createCheckBox(tr("Window maximize button"));
+ windowCloseButtonCheckBox = createCheckBox(tr("Window close button"));
+ windowContextHelpButtonCheckBox =
+ createCheckBox(tr("Window context help button"));
+ windowShadeButtonCheckBox = createCheckBox(tr("Window shade button"));
+ windowStaysOnTopCheckBox = createCheckBox(tr("Window stays on top"));
+ windowStaysOnBottomCheckBox = createCheckBox(tr("Window stays on bottom"));
+ customizeWindowHintCheckBox= createCheckBox(tr("Customize window"));
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(msWindowsFixedSizeDialogCheckBox, 0, 0);
+ layout->addWidget(x11BypassWindowManagerCheckBox, 1, 0);
+ layout->addWidget(framelessWindowCheckBox, 2, 0);
+ layout->addWidget(windowTitleCheckBox, 3, 0);
+ layout->addWidget(windowSystemMenuCheckBox, 4, 0);
+ layout->addWidget(windowMinimizeButtonCheckBox, 0, 1);
+ layout->addWidget(windowMaximizeButtonCheckBox, 1, 1);
+ layout->addWidget(windowCloseButtonCheckBox, 2, 1);
+ layout->addWidget(windowContextHelpButtonCheckBox, 3, 1);
+ layout->addWidget(windowShadeButtonCheckBox, 4, 1);
+ layout->addWidget(windowStaysOnTopCheckBox, 5, 1);
+ layout->addWidget(windowStaysOnBottomCheckBox, 6, 1);
+ layout->addWidget(customizeWindowHintCheckBox, 5, 0);
+ hintsGroupBox->setLayout(layout);
+}
+//! [6]
+
+//! [7]
+QCheckBox *ControllerWindow::createCheckBox(const QString &text)
+{
+ QCheckBox *checkBox = new QCheckBox(text);
+ connect(checkBox, SIGNAL(clicked()), this, SLOT(updatePreview()));
+ return checkBox;
+}
+//! [7]
+
+//! [8]
+QRadioButton *ControllerWindow::createRadioButton(const QString &text)
+{
+ QRadioButton *button = new QRadioButton(text);
+ connect(button, SIGNAL(clicked()), this, SLOT(updatePreview()));
+ return button;
+}
+//! [8]
diff --git a/tests/manual/windowflags/controllerwindow.h b/tests/manual/windowflags/controllerwindow.h
new file mode 100644
index 0000000..3d315be
--- /dev/null
+++ b/tests/manual/windowflags/controllerwindow.h
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CONTROLLERWINDOW_H
+#define CONTROLLERWINDOW_H
+
+#include <QWidget>
+
+#include "previewwindow.h"
+
+QT_BEGIN_NAMESPACE
+class QCheckBox;
+class QGroupBox;
+class QLabel;
+class QPushButton;
+class QRadioButton;
+class QMainWindow;
+QT_END_NAMESPACE
+
+//! [0]
+class ControllerWindow : public QWidget
+{
+ Q_OBJECT
+
+public:
+ ControllerWindow();
+
+private slots:
+ void updatePreview();
+
+private:
+ void createTypeGroupBox();
+ void createHintsGroupBox();
+ QCheckBox *createCheckBox(const QString &text);
+ QRadioButton *createRadioButton(const QString &text);
+
+ QMainWindow *parentWindow;
+ PreviewWindow *previewWindow;
+ PreviewDialog *previewDialog;
+
+ QGroupBox *widgetTypeGroupBox;
+ QGroupBox *additionalOptionsGroupBox;
+ QGroupBox *typeGroupBox;
+ QGroupBox *hintsGroupBox;
+ QPushButton *quitButton;
+
+ QRadioButton *previewWidgetButton;
+ QRadioButton *previewDialogButton;
+ QCheckBox *modalWindowCheckBox;
+ QCheckBox *fixedSizeWindowCheckBox;
+
+ QRadioButton *windowRadioButton;
+ QRadioButton *dialogRadioButton;
+ QRadioButton *sheetRadioButton;
+ QRadioButton *drawerRadioButton;
+ QRadioButton *popupRadioButton;
+ QRadioButton *toolRadioButton;
+ QRadioButton *toolTipRadioButton;
+ QRadioButton *splashScreenRadioButton;
+
+ QCheckBox *msWindowsFixedSizeDialogCheckBox;
+ QCheckBox *x11BypassWindowManagerCheckBox;
+ QCheckBox *framelessWindowCheckBox;
+ QCheckBox *windowTitleCheckBox;
+ QCheckBox *windowSystemMenuCheckBox;
+ QCheckBox *windowMinimizeButtonCheckBox;
+ QCheckBox *windowMaximizeButtonCheckBox;
+ QCheckBox *windowCloseButtonCheckBox;
+ QCheckBox *windowContextHelpButtonCheckBox;
+ QCheckBox *windowShadeButtonCheckBox;
+ QCheckBox *windowStaysOnTopCheckBox;
+ QCheckBox *windowStaysOnBottomCheckBox;
+ QCheckBox *customizeWindowHintCheckBox;
+};
+//! [0]
+
+#endif
diff --git a/tests/manual/windowflags/main.cpp b/tests/manual/windowflags/main.cpp
new file mode 100644
index 0000000..011ca3f
--- /dev/null
+++ b/tests/manual/windowflags/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+
+#include "controllerwindow.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ ControllerWindow controller;
+ controller.show();
+ return app.exec();
+}
diff --git a/tests/manual/windowflags/previewwindow.cpp b/tests/manual/windowflags/previewwindow.cpp
new file mode 100644
index 0000000..796bdb9
--- /dev/null
+++ b/tests/manual/windowflags/previewwindow.cpp
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "previewwindow.h"
+
+static QString windowFlagsToString(Qt::WindowFlags flags)
+{
+ QString text;
+
+ Qt::WindowFlags type = (flags & Qt::WindowType_Mask);
+ if (type == Qt::Window) {
+ text = "Qt::Window";
+ } else if (type == Qt::Dialog) {
+ text = "Qt::Dialog";
+ } else if (type == Qt::Sheet) {
+ text = "Qt::Sheet";
+ } else if (type == Qt::Drawer) {
+ text = "Qt::Drawer";
+ } else if (type == Qt::Popup) {
+ text = "Qt::Popup";
+ } else if (type == Qt::Tool) {
+ text = "Qt::Tool";
+ } else if (type == Qt::ToolTip) {
+ text = "Qt::ToolTip";
+ } else if (type == Qt::SplashScreen) {
+ text = "Qt::SplashScreen";
+ }
+
+ if (flags & Qt::MSWindowsFixedSizeDialogHint)
+ text += "\n| Qt::MSWindowsFixedSizeDialogHint";
+ if (flags & Qt::X11BypassWindowManagerHint)
+ text += "\n| Qt::X11BypassWindowManagerHint";
+ if (flags & Qt::FramelessWindowHint)
+ text += "\n| Qt::FramelessWindowHint";
+ if (flags & Qt::WindowTitleHint)
+ text += "\n| Qt::WindowTitleHint";
+ if (flags & Qt::WindowSystemMenuHint)
+ text += "\n| Qt::WindowSystemMenuHint";
+ if (flags & Qt::WindowMinimizeButtonHint)
+ text += "\n| Qt::WindowMinimizeButtonHint";
+ if (flags & Qt::WindowMaximizeButtonHint)
+ text += "\n| Qt::WindowMaximizeButtonHint";
+ if (flags & Qt::WindowCloseButtonHint)
+ text += "\n| Qt::WindowCloseButtonHint";
+ if (flags & Qt::WindowContextHelpButtonHint)
+ text += "\n| Qt::WindowContextHelpButtonHint";
+ if (flags & Qt::WindowShadeButtonHint)
+ text += "\n| Qt::WindowShadeButtonHint";
+ if (flags & Qt::WindowStaysOnTopHint)
+ text += "\n| Qt::WindowStaysOnTopHint";
+ if (flags & Qt::CustomizeWindowHint)
+ text += "\n| Qt::CustomizeWindowHint";
+ return text;
+}
+
+PreviewWindow::PreviewWindow(QWidget *parent)
+ : QWidget(parent)
+{
+ textEdit = new QTextEdit;
+ textEdit->setReadOnly(true);
+ textEdit->setLineWrapMode(QTextEdit::NoWrap);
+
+ closeButton = new QPushButton(tr("&Close"));
+ connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(textEdit);
+ layout->addWidget(closeButton);
+ setLayout(layout);
+
+ setWindowTitle(tr("Preview <QWidget>"));
+}
+
+void PreviewWindow::setWindowFlags(Qt::WindowFlags flags)
+{
+ QWidget::setWindowFlags(flags);
+
+ QString text = windowFlagsToString(flags);
+ textEdit->setPlainText(text);
+}
+
+PreviewDialog::PreviewDialog(QWidget *parent)
+ : QDialog(parent)
+{
+ textEdit = new QTextEdit;
+ textEdit->setReadOnly(true);
+ textEdit->setLineWrapMode(QTextEdit::NoWrap);
+
+ closeButton = new QPushButton(tr("&Close"));
+ connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(textEdit);
+ layout->addWidget(closeButton);
+ setLayout(layout);
+
+ setWindowTitle(tr("Preview <QDialog>"));
+}
+
+void PreviewDialog::setWindowFlags(Qt::WindowFlags flags)
+{
+ QWidget::setWindowFlags(flags);
+
+ QString text = windowFlagsToString(flags);
+ textEdit->setPlainText(text);
+}
diff --git a/tests/manual/windowflags/previewwindow.h b/tests/manual/windowflags/previewwindow.h
new file mode 100644
index 0000000..90ed8ba
--- /dev/null
+++ b/tests/manual/windowflags/previewwindow.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PREVIEWWINDOW_H
+#define PREVIEWWINDOW_H
+
+#include <QWidget>
+#include <QDialog>
+
+QT_BEGIN_NAMESPACE
+class QPushButton;
+class QTextEdit;
+QT_END_NAMESPACE
+
+class PreviewWindow : public QWidget
+{
+ Q_OBJECT
+
+public:
+ PreviewWindow(QWidget *parent = 0);
+
+ void setWindowFlags(Qt::WindowFlags flags);
+
+private:
+ QTextEdit *textEdit;
+ QPushButton *closeButton;
+};
+
+class PreviewDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ PreviewDialog(QWidget *parent = 0);
+
+ void setWindowFlags(Qt::WindowFlags flags);
+
+private:
+ QTextEdit *textEdit;
+ QPushButton *closeButton;
+};
+
+#endif
diff --git a/tests/manual/windowflags/windowflags.pro b/tests/manual/windowflags/windowflags.pro
new file mode 100644
index 0000000..1b45d0d
--- /dev/null
+++ b/tests/manual/windowflags/windowflags.pro
@@ -0,0 +1,5 @@
+HEADERS = controllerwindow.h \
+ previewwindow.h
+SOURCES = controllerwindow.cpp \
+ previewwindow.cpp \
+ main.cpp