summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-05-12 12:11:55 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-05-12 12:11:55 (GMT)
commitf5ac9ac1387fb9aac7c74d686f0b247ac50746e1 (patch)
tree8efb9b6c1029f8b9c26b96fa5389b1b0623c5163 /tests
parentcb369071fa9b15e68f91d2883ee29f12c58fc803 (diff)
parentbc184432c49eb56254bc5db07c6af03718c6b0e7 (diff)
downloadQt-f5ac9ac1387fb9aac7c74d686f0b247ac50746e1.zip
Qt-f5ac9ac1387fb9aac7c74d686f0b247ac50746e1.tar.gz
Qt-f5ac9ac1387fb9aac7c74d686f0b247ac50746e1.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-animations
Diffstat (limited to 'tests')
-rw-r--r--tests/arthur/common/images.qrc1
-rw-r--r--tests/arthur/common/images/borderimage.pngbin0 -> 826 bytes
-rw-r--r--tests/arthur/data/qps/borderimage.qps164
-rw-r--r--tests/arthur/data/qps/borderimage_qps.pngbin0 -> 91838 bytes
-rw-r--r--tests/auto/q3accel/q3accel.pro1
-rw-r--r--tests/auto/q3action/q3action.pro1
-rw-r--r--tests/auto/q3actiongroup/q3actiongroup.pro1
-rw-r--r--tests/auto/q3buttongroup/clickLock/clickLock.pro3
-rw-r--r--tests/auto/q3buttongroup/tst_q3buttongroup.pro1
-rw-r--r--tests/auto/q3canvas/q3canvas.pro1
-rw-r--r--tests/auto/q3checklistitem/q3checklistitem.pro1
-rw-r--r--tests/auto/q3combobox/q3combobox.pro1
-rw-r--r--tests/auto/q3cstring/q3cstring.pro1
-rw-r--r--tests/auto/q3databrowser/q3databrowser.pro1
-rw-r--r--tests/auto/q3dateedit/q3dateedit.pro1
-rw-r--r--tests/auto/q3datetimeedit/q3datetimeedit.pro1
-rw-r--r--tests/auto/q3deepcopy/q3deepcopy.pro1
-rw-r--r--tests/auto/q3dict/q3dict.pro1
-rw-r--r--tests/auto/q3dns/q3dns.pro1
-rw-r--r--tests/auto/q3dockwindow/q3dockwindow.pro1
-rw-r--r--tests/auto/q3filedialog/q3filedialog.pro1
-rw-r--r--tests/auto/q3frame/q3frame.pro1
-rw-r--r--tests/auto/q3groupbox/q3groupbox.pro1
-rw-r--r--tests/auto/q3hbox/q3hbox.pro1
-rw-r--r--tests/auto/q3header/q3header.pro1
-rw-r--r--tests/auto/q3iconview/q3iconview.pro1
-rw-r--r--tests/auto/q3listbox/q3listbox.pro3
-rw-r--r--tests/auto/q3listview/q3listview.pro1
-rw-r--r--tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro1
-rw-r--r--tests/auto/q3mainwindow/q3mainwindow.pro1
-rw-r--r--tests/auto/q3popupmenu/q3popupmenu.pro1
-rw-r--r--tests/auto/q3process/q3process.pro1
-rw-r--r--tests/auto/q3process/tst/tst.pro3
-rw-r--r--tests/auto/q3progressbar/q3progressbar.pro1
-rw-r--r--tests/auto/q3progressdialog/q3progressdialog.pro1
-rw-r--r--tests/auto/q3ptrlist/q3ptrlist.pro1
-rw-r--r--tests/auto/q3richtext/q3richtext.pro1
-rw-r--r--tests/auto/q3scrollview/q3scrollview.pro3
-rw-r--r--tests/auto/q3semaphore/q3semaphore.pro1
-rw-r--r--tests/auto/q3serversocket/q3serversocket.pro1
-rw-r--r--tests/auto/q3socket/q3socket.pro1
-rw-r--r--tests/auto/q3socketdevice/q3socketdevice.pro1
-rw-r--r--tests/auto/q3sqlcursor/q3sqlcursor.pro1
-rw-r--r--tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro1
-rw-r--r--tests/auto/q3stylesheet/q3stylesheet.pro1
-rw-r--r--tests/auto/q3tabdialog/q3tabdialog.pro1
-rw-r--r--tests/auto/q3table/q3table.pro1
-rw-r--r--tests/auto/q3textbrowser/q3textbrowser.pro1
-rw-r--r--tests/auto/q3textedit/q3textedit.pro1
-rw-r--r--tests/auto/q3textstream/q3textstream.pro1
-rw-r--r--tests/auto/q3timeedit/q3timeedit.pro1
-rw-r--r--tests/auto/q3toolbar/q3toolbar.pro1
-rw-r--r--tests/auto/q3uridrag/q3uridrag.pro3
-rw-r--r--tests/auto/q3urloperator/q3urloperator.pro3
-rw-r--r--tests/auto/q3valuelist/q3valuelist.pro3
-rw-r--r--tests/auto/q3valuevector/q3valuevector.pro3
-rw-r--r--tests/auto/q3widgetstack/q3widgetstack.pro3
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp6
-rw-r--r--tests/auto/qbytearraymatcher/qbytearraymatcher.pro4
-rw-r--r--tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp124
-rw-r--r--tests/auto/qcompleter/tst_qcompleter.cpp46
-rw-r--r--tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp73
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp129
-rw-r--r--tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp41
-rw-r--r--tests/auto/qgl/tst_qgl.cpp65
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp166
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp85
-rw-r--r--tests/auto/qheaderview/tst_qheaderview.cpp24
-rw-r--r--tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp46
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp28
-rw-r--r--tests/auto/qlocalsocket/test/test.pro14
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp22
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp2
-rw-r--r--tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp8
-rw-r--r--tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp11
-rw-r--r--tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp33
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp21
-rw-r--r--tests/auto/qpixmapcache/tst_qpixmapcache.cpp10
-rw-r--r--tests/auto/qprinter/tst_qprinter.cpp18
-rw-r--r--tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp33
-rw-r--r--tests/auto/qsidebar/tst_qsidebar.cpp26
-rw-r--r--tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp18
-rw-r--r--tests/auto/qsqldatabase/tst_databases.h43
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp19
-rw-r--r--tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp3
-rw-r--r--tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp44
-rw-r--r--tests/auto/qtabbar/tst_qtabbar.cpp32
-rw-r--r--tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp31
-rw-r--r--tests/auto/qtemporaryfile/qtemporaryfile.pro3
-rw-r--r--tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp45
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp12
-rw-r--r--tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp2
-rw-r--r--tests/auto/qtransform/tst_qtransform.cpp10
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp211
-rw-r--r--tests/auto/qxmlstream/XML-Test-Suite-LICENSE.txt59
-rw-r--r--tests/auto/utf8/tst_utf8.cpp309
-rw-r--r--tests/auto/utf8/utf8.pro3
-rw-r--r--tests/auto/windowsmobile/test/ddhelper.cpp121
-rw-r--r--tests/auto/windowsmobile/test/ddhelper.h21
-rw-r--r--tests/auto/windowsmobile/test/test.pro24
-rw-r--r--tests/auto/windowsmobile/test/testQMenuBar_current.pngbin0 -> 23702 bytes
-rw-r--r--tests/auto/windowsmobile/test/testSimpleWidget_current.pngbin0 -> 21940 bytes
-rw-r--r--tests/auto/windowsmobile/test/tst_windowsmobile.cpp191
-rw-r--r--tests/auto/windowsmobile/test/windowsmobile.qrc6
-rw-r--r--tests/auto/windowsmobile/testQMenuBar/main.cpp72
-rw-r--r--tests/auto/windowsmobile/testQMenuBar/testQMenuBar.pro2
-rw-r--r--tests/auto/windowsmobile/windowsmobile.pro9
107 files changed, 2506 insertions, 55 deletions
diff --git a/tests/arthur/common/images.qrc b/tests/arthur/common/images.qrc
index 8e94760..060b52c 100644
--- a/tests/arthur/common/images.qrc
+++ b/tests/arthur/common/images.qrc
@@ -3,6 +3,7 @@
<qresource>
<file>images/alpha.png</file>
<file>images/border.png</file>
+ <file>images/borderimage.png</file>
<file>images/dome_argb32.png</file>
<file>images/dome_indexed.png</file>
<file>images/dome_mono_palette.png</file>
diff --git a/tests/arthur/common/images/borderimage.png b/tests/arthur/common/images/borderimage.png
new file mode 100644
index 0000000..f7f6b66
--- /dev/null
+++ b/tests/arthur/common/images/borderimage.png
Binary files differ
diff --git a/tests/arthur/data/qps/borderimage.qps b/tests/arthur/data/qps/borderimage.qps
new file mode 100644
index 0000000..8d2e54b
--- /dev/null
+++ b/tests/arthur/data/qps/borderimage.qps
@@ -0,0 +1,164 @@
+image_load borderimage.png borderimage
+
+translate -128 -128
+begin_block draw_border
+
+# top
+drawImage borderimage 0 0 16 16 0 0 16 16
+drawImage borderimage 16 0 36 16 16 0 32 16
+drawImage borderimage 52 0 16 16 48 0 16 16
+
+# sides
+drawImage borderimage 0 16 16 16 0 16 16 32
+drawImage borderimage 52 16 16 16 48 16 16 32
+
+#bottom
+drawImage borderimage 0 32 16 16 0 48 16 16
+drawImage borderimage 16 32 36 16 16 48 32 16
+drawImage borderimage 52 32 16 16 48 48 16 16
+
+end_block draw_border
+
+resetMatrix
+
+begin_block draw_column
+
+translate 1 1
+repeat_block draw_border
+translate 0.1 64.1
+repeat_block draw_border
+translate 0.1 64.1
+repeat_block draw_border
+translate 0.1 64.1
+repeat_block draw_border
+translate 0.1 64.1
+repeat_block draw_border
+translate 0.1 64.1
+repeat_block draw_border
+translate 0.1 64.1
+repeat_block draw_border
+translate 0.1 64.1
+repeat_block draw_border
+translate 0.1 64.1
+repeat_block draw_border
+translate 0.1 64.1
+repeat_block draw_border
+
+end_block draw_column
+
+setRenderHint Antialiasing
+
+resetMatrix
+translate 72 0
+
+repeat_block draw_column
+
+resetMatrix
+scale 1.25 1.25
+translate 144 0
+
+repeat_block draw_border
+
+resetMatrix
+scale 1.25 1.25
+translate 246 0
+rotate 30
+
+repeat_block draw_border
+
+setRenderHint SmoothPixmapTransform
+
+resetMatrix
+scale 1.25 1.25
+translate 144 120
+
+repeat_block draw_border
+
+resetMatrix
+scale 1.25 1.25
+translate 246 120
+rotate 30
+
+repeat_block draw_border
+
+resetMatrix
+translate 215 260
+scale 3.55 3.55
+rotate 30
+
+repeat_block draw_border
+
+resetMatrix
+setRenderHint SmoothPixmapTransform off
+setRenderHint Antialiasing off
+
+translate 480 627
+rotate 180
+repeat_block draw_column
+
+resetMatrix
+setRenderHint Antialiasing
+
+translate 552 627
+rotate 180
+repeat_block draw_column
+
+resetMatrix
+setRenderHint Antialiasing off
+
+translate 200.1 520.1
+
+begin_block one_pixel_border
+drawImage borderimage 0 0 16 16 0 0 16 16
+drawImage borderimage 16 0 64 16 16 0 1 1
+drawImage borderimage 80 0 16 16 48 0 16 16
+
+drawImage borderimage 0 16 16 64 16 0 1 1
+drawImage borderimage 80 16 16 64 16 0 1 1
+
+drawImage borderimage 0 80 16 16 0 48 16 16
+drawImage borderimage 16 80 64 16 16 0 1 1
+drawImage borderimage 80 80 16 16 48 48 16 16
+end_block one_pixel_border
+
+resetMatrix
+
+translate 205.1 626.1
+scale 0.4 0.4
+
+repeat_block one_pixel_border
+
+resetMatrix
+
+translate 255.1 624.1
+scale 0.4 0.4
+rotate 10
+
+repeat_block one_pixel_border
+
+resetMatrix
+
+setPen red
+
+drawRect 0 0 70 680
+drawText 10 670 "aa off"
+
+drawRect 72 0 70 680
+drawText 80 670 "aa on"
+
+drawRect 409 0 70 680
+drawText 419 650 "rot 180"
+drawText 419 670 "aa off"
+
+drawRect 481 0 70 680
+drawText 491 650 "rot 180"
+drawText 491 670 "aa on"
+
+drawRect 164 0 224 124
+drawText 174 114 "smoothpixmaptransform off"
+
+drawRect 164 128 224 134
+drawText 174 252 "smoothpixmaptransform on"
+
+drawRect 200 520 97 188
+drawText 210 698 "1x1 edges"
diff --git a/tests/arthur/data/qps/borderimage_qps.png b/tests/arthur/data/qps/borderimage_qps.png
new file mode 100644
index 0000000..ed51d5f
--- /dev/null
+++ b/tests/arthur/data/qps/borderimage_qps.png
Binary files differ
diff --git a/tests/auto/q3accel/q3accel.pro b/tests/auto/q3accel/q3accel.pro
index 002033f..61d4f38 100644
--- a/tests/auto/q3accel/q3accel.pro
+++ b/tests/auto/q3accel/q3accel.pro
@@ -3,6 +3,7 @@ HEADERS +=
SOURCES += tst_q3accel.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3action/q3action.pro b/tests/auto/q3action/q3action.pro
index ee5d780..c85a158 100644
--- a/tests/auto/q3action/q3action.pro
+++ b/tests/auto/q3action/q3action.pro
@@ -1,3 +1,4 @@
load(qttest_p4)
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
SOURCES += tst_q3action.cpp
diff --git a/tests/auto/q3actiongroup/q3actiongroup.pro b/tests/auto/q3actiongroup/q3actiongroup.pro
index bfe1f68..139e48c 100644
--- a/tests/auto/q3actiongroup/q3actiongroup.pro
+++ b/tests/auto/q3actiongroup/q3actiongroup.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
SOURCES += tst_q3actiongroup.cpp
diff --git a/tests/auto/q3buttongroup/clickLock/clickLock.pro b/tests/auto/q3buttongroup/clickLock/clickLock.pro
index 68f5ed2..a1aa105 100644
--- a/tests/auto/q3buttongroup/clickLock/clickLock.pro
+++ b/tests/auto/q3buttongroup/clickLock/clickLock.pro
@@ -3,7 +3,8 @@ TEMPLATE = app
win32:TARGET = ../clickLock
!win32:TARGET = clickLock
-contains(QT_CONFIG, qt3support): QT += qt3support
+QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
DEPENDPATH += .
INCLUDEPATH += .
CONFIG -= app_bundle
diff --git a/tests/auto/q3buttongroup/tst_q3buttongroup.pro b/tests/auto/q3buttongroup/tst_q3buttongroup.pro
index 8ec25d0..9f1f090 100644
--- a/tests/auto/q3buttongroup/tst_q3buttongroup.pro
+++ b/tests/auto/q3buttongroup/tst_q3buttongroup.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
# Input
SOURCES += tst_q3buttongroup.cpp
diff --git a/tests/auto/q3canvas/q3canvas.pro b/tests/auto/q3canvas/q3canvas.pro
index cac538d..70e9b88 100644
--- a/tests/auto/q3canvas/q3canvas.pro
+++ b/tests/auto/q3canvas/q3canvas.pro
@@ -3,5 +3,6 @@ SOURCES += tst_q3canvas.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3checklistitem/q3checklistitem.pro b/tests/auto/q3checklistitem/q3checklistitem.pro
index 77d96e8..9ae9c55 100644
--- a/tests/auto/q3checklistitem/q3checklistitem.pro
+++ b/tests/auto/q3checklistitem/q3checklistitem.pro
@@ -3,5 +3,6 @@ SOURCES += tst_q3checklistitem.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3combobox/q3combobox.pro b/tests/auto/q3combobox/q3combobox.pro
index 2391f6c..7dcde2b 100644
--- a/tests/auto/q3combobox/q3combobox.pro
+++ b/tests/auto/q3combobox/q3combobox.pro
@@ -1,3 +1,4 @@
load(qttest_p4)
SOURCES += tst_q3combobox.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3cstring/q3cstring.pro b/tests/auto/q3cstring/q3cstring.pro
index 78077b8..1171093 100644
--- a/tests/auto/q3cstring/q3cstring.pro
+++ b/tests/auto/q3cstring/q3cstring.pro
@@ -3,5 +3,6 @@ SOURCES += tst_q3cstring.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3databrowser/q3databrowser.pro b/tests/auto/q3databrowser/q3databrowser.pro
index 09c16b7..d65a5ef 100644
--- a/tests/auto/q3databrowser/q3databrowser.pro
+++ b/tests/auto/q3databrowser/q3databrowser.pro
@@ -2,5 +2,6 @@ load(qttest_p4)
SOURCES += tst_q3databrowser.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3dateedit/q3dateedit.pro b/tests/auto/q3dateedit/q3dateedit.pro
index ba585ce..85e0ebf 100644
--- a/tests/auto/q3dateedit/q3dateedit.pro
+++ b/tests/auto/q3dateedit/q3dateedit.pro
@@ -1,6 +1,7 @@
load(qttest_p4)
SOURCES += tst_q3dateedit.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3datetimeedit/q3datetimeedit.pro b/tests/auto/q3datetimeedit/q3datetimeedit.pro
index f2c0097..9c980be 100644
--- a/tests/auto/q3datetimeedit/q3datetimeedit.pro
+++ b/tests/auto/q3datetimeedit/q3datetimeedit.pro
@@ -4,6 +4,7 @@
load(qttest_p4)
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
SOURCES += tst_q3datetimeedit.cpp
diff --git a/tests/auto/q3deepcopy/q3deepcopy.pro b/tests/auto/q3deepcopy/q3deepcopy.pro
index 04e0690..9ac1a10 100644
--- a/tests/auto/q3deepcopy/q3deepcopy.pro
+++ b/tests/auto/q3deepcopy/q3deepcopy.pro
@@ -3,5 +3,6 @@ SOURCES += tst_q3deepcopy.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3dict/q3dict.pro b/tests/auto/q3dict/q3dict.pro
index 5ccd875..7bbea61 100644
--- a/tests/auto/q3dict/q3dict.pro
+++ b/tests/auto/q3dict/q3dict.pro
@@ -3,5 +3,6 @@ SOURCES += tst_q3dict.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3dns/q3dns.pro b/tests/auto/q3dns/q3dns.pro
index 10c24e5..7fd2e4c 100644
--- a/tests/auto/q3dns/q3dns.pro
+++ b/tests/auto/q3dns/q3dns.pro
@@ -3,5 +3,6 @@ SOURCES += tst_q3dns.cpp
QT += network qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3dockwindow/q3dockwindow.pro b/tests/auto/q3dockwindow/q3dockwindow.pro
index 5f23c40..1352123 100644
--- a/tests/auto/q3dockwindow/q3dockwindow.pro
+++ b/tests/auto/q3dockwindow/q3dockwindow.pro
@@ -3,6 +3,7 @@ HEADERS +=
SOURCES += tst_q3dockwindow.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3filedialog/q3filedialog.pro b/tests/auto/q3filedialog/q3filedialog.pro
index 2394111..f57f9c0 100644
--- a/tests/auto/q3filedialog/q3filedialog.pro
+++ b/tests/auto/q3filedialog/q3filedialog.pro
@@ -4,6 +4,7 @@
load(qttest_p4)
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
SOURCES += tst_q3filedialog.cpp
diff --git a/tests/auto/q3frame/q3frame.pro b/tests/auto/q3frame/q3frame.pro
index 7f0d24f..1d1f5a7 100644
--- a/tests/auto/q3frame/q3frame.pro
+++ b/tests/auto/q3frame/q3frame.pro
@@ -1,4 +1,5 @@
load(qttest_p4)
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
SOURCES += tst_q3frame.cpp
diff --git a/tests/auto/q3groupbox/q3groupbox.pro b/tests/auto/q3groupbox/q3groupbox.pro
index 5153a25..fd4cced 100644
--- a/tests/auto/q3groupbox/q3groupbox.pro
+++ b/tests/auto/q3groupbox/q3groupbox.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
# Input
SOURCES += tst_q3groupbox.cpp
diff --git a/tests/auto/q3hbox/q3hbox.pro b/tests/auto/q3hbox/q3hbox.pro
index d5b7c65..bbd7f5b 100644
--- a/tests/auto/q3hbox/q3hbox.pro
+++ b/tests/auto/q3hbox/q3hbox.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_q3hbox.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3header/q3header.pro b/tests/auto/q3header/q3header.pro
index 64ffb0f..d1a913a 100644
--- a/tests/auto/q3header/q3header.pro
+++ b/tests/auto/q3header/q3header.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_q3header.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3iconview/q3iconview.pro b/tests/auto/q3iconview/q3iconview.pro
index 37a138b..9416c08 100644
--- a/tests/auto/q3iconview/q3iconview.pro
+++ b/tests/auto/q3iconview/q3iconview.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_q3iconview.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3listbox/q3listbox.pro b/tests/auto/q3listbox/q3listbox.pro
index d193ace..dc2d197 100644
--- a/tests/auto/q3listbox/q3listbox.pro
+++ b/tests/auto/q3listbox/q3listbox.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_qlistbox.cpp
-contains(QT_CONFIG, qt3support): QT += qt3support
+QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3listview/q3listview.pro b/tests/auto/q3listview/q3listview.pro
index 56c62d1..5d72ea6 100644
--- a/tests/auto/q3listview/q3listview.pro
+++ b/tests/auto/q3listview/q3listview.pro
@@ -2,4 +2,5 @@ load(qttest_p4)
SOURCES += tst_q3listview.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro b/tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro
index 143e0c0..b50d012 100644
--- a/tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro
+++ b/tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_q3listviewitemiterator.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3mainwindow/q3mainwindow.pro b/tests/auto/q3mainwindow/q3mainwindow.pro
index 7a198d1..c4cb7c4 100644
--- a/tests/auto/q3mainwindow/q3mainwindow.pro
+++ b/tests/auto/q3mainwindow/q3mainwindow.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_q3mainwindow.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
CONFIG += console
diff --git a/tests/auto/q3popupmenu/q3popupmenu.pro b/tests/auto/q3popupmenu/q3popupmenu.pro
index c9c0dd5..216722b 100644
--- a/tests/auto/q3popupmenu/q3popupmenu.pro
+++ b/tests/auto/q3popupmenu/q3popupmenu.pro
@@ -4,5 +4,6 @@
load(qttest_p4)
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
SOURCES += tst_q3popupmenu.cpp
diff --git a/tests/auto/q3process/q3process.pro b/tests/auto/q3process/q3process.pro
index 8dc3541..a665c2b 100644
--- a/tests/auto/q3process/q3process.pro
+++ b/tests/auto/q3process/q3process.pro
@@ -5,6 +5,7 @@ SUBDIRS = cat \
tst
TARGET = tst_q3process
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
#no install rule for subdir
INSTALLS =
diff --git a/tests/auto/q3process/tst/tst.pro b/tests/auto/q3process/tst/tst.pro
index 090d76b..359148b 100644
--- a/tests/auto/q3process/tst/tst.pro
+++ b/tests/auto/q3process/tst/tst.pro
@@ -11,6 +11,7 @@ win32 {
}
}
-contains(QT_CONFIG, qt3support): QT += qt3support
+QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3progressbar/q3progressbar.pro b/tests/auto/q3progressbar/q3progressbar.pro
index b3c8864..582c39e 100644
--- a/tests/auto/q3progressbar/q3progressbar.pro
+++ b/tests/auto/q3progressbar/q3progressbar.pro
@@ -4,6 +4,7 @@
load(qttest_p4)
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
SOURCES += tst_q3progressbar.cpp
diff --git a/tests/auto/q3progressdialog/q3progressdialog.pro b/tests/auto/q3progressdialog/q3progressdialog.pro
index 65e24ed..08528db 100644
--- a/tests/auto/q3progressdialog/q3progressdialog.pro
+++ b/tests/auto/q3progressdialog/q3progressdialog.pro
@@ -4,6 +4,7 @@
load(qttest_p4)
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
SOURCES += tst_q3progressdialog.cpp
diff --git a/tests/auto/q3ptrlist/q3ptrlist.pro b/tests/auto/q3ptrlist/q3ptrlist.pro
index 186a707..d7431f4 100644
--- a/tests/auto/q3ptrlist/q3ptrlist.pro
+++ b/tests/auto/q3ptrlist/q3ptrlist.pro
@@ -2,5 +2,6 @@ load(qttest_p4)
SOURCES += tst_q3ptrlist.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3richtext/q3richtext.pro b/tests/auto/q3richtext/q3richtext.pro
index 2d4fc5a..e22fa37 100644
--- a/tests/auto/q3richtext/q3richtext.pro
+++ b/tests/auto/q3richtext/q3richtext.pro
@@ -3,6 +3,7 @@ HEADERS +=
SOURCES += tst_q3richtext.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3scrollview/q3scrollview.pro b/tests/auto/q3scrollview/q3scrollview.pro
index 1750e8b..d98d234 100644
--- a/tests/auto/q3scrollview/q3scrollview.pro
+++ b/tests/auto/q3scrollview/q3scrollview.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_qscrollview.cpp
-contains(QT_CONFIG, qt3support): QT += qt3support
+QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3semaphore/q3semaphore.pro b/tests/auto/q3semaphore/q3semaphore.pro
index ad8c154..935917d 100644
--- a/tests/auto/q3semaphore/q3semaphore.pro
+++ b/tests/auto/q3semaphore/q3semaphore.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
SOURCES += tst_q3semaphore.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3serversocket/q3serversocket.pro b/tests/auto/q3serversocket/q3serversocket.pro
index 4fa9dce..4e5e364 100644
--- a/tests/auto/q3serversocket/q3serversocket.pro
+++ b/tests/auto/q3serversocket/q3serversocket.pro
@@ -3,5 +3,6 @@ SOURCES += tst_q3serversocket.cpp
QT += network qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3socket/q3socket.pro b/tests/auto/q3socket/q3socket.pro
index a9bf0c0..a8324e9 100644
--- a/tests/auto/q3socket/q3socket.pro
+++ b/tests/auto/q3socket/q3socket.pro
@@ -2,5 +2,6 @@ load(qttest_p4)
SOURCES += tst_qsocket.cpp
QT += network qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3socketdevice/q3socketdevice.pro b/tests/auto/q3socketdevice/q3socketdevice.pro
index c6e9e93..d2cbfb2 100644
--- a/tests/auto/q3socketdevice/q3socketdevice.pro
+++ b/tests/auto/q3socketdevice/q3socketdevice.pro
@@ -2,5 +2,6 @@ load(qttest_p4)
SOURCES += tst_q3socketdevice.cpp
QT += network qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3sqlcursor/q3sqlcursor.pro b/tests/auto/q3sqlcursor/q3sqlcursor.pro
index 2844540..2d316fb 100644
--- a/tests/auto/q3sqlcursor/q3sqlcursor.pro
+++ b/tests/auto/q3sqlcursor/q3sqlcursor.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_q3sqlcursor.cpp
QT += sql qt3support
+requires(contains(QT_CONFIG,qt3support))
win32:LIBS += -lws2_32
diff --git a/tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro b/tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro
index 21e311f..59448eb 100644
--- a/tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro
+++ b/tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_q3sqlselectcursor.cpp
QT += sql qt3support
+requires(contains(QT_CONFIG,qt3support))
win32:LIBS += -lws2_32
diff --git a/tests/auto/q3stylesheet/q3stylesheet.pro b/tests/auto/q3stylesheet/q3stylesheet.pro
index a5e8438..f0fcd8b 100644
--- a/tests/auto/q3stylesheet/q3stylesheet.pro
+++ b/tests/auto/q3stylesheet/q3stylesheet.pro
@@ -4,6 +4,7 @@
load(qttest_p4)
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
SOURCES += tst_q3stylesheet.cpp
diff --git a/tests/auto/q3tabdialog/q3tabdialog.pro b/tests/auto/q3tabdialog/q3tabdialog.pro
index 1ba72f9..815510d 100644
--- a/tests/auto/q3tabdialog/q3tabdialog.pro
+++ b/tests/auto/q3tabdialog/q3tabdialog.pro
@@ -4,6 +4,7 @@
load(qttest_p4)
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
SOURCES += tst_q3tabdialog.cpp
diff --git a/tests/auto/q3table/q3table.pro b/tests/auto/q3table/q3table.pro
index 6d96a4e..bdda8ba 100644
--- a/tests/auto/q3table/q3table.pro
+++ b/tests/auto/q3table/q3table.pro
@@ -2,5 +2,6 @@ load(qttest_p4)
SOURCES += tst_q3table.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3textbrowser/q3textbrowser.pro b/tests/auto/q3textbrowser/q3textbrowser.pro
index 8ddeaba..4dfd12e 100644
--- a/tests/auto/q3textbrowser/q3textbrowser.pro
+++ b/tests/auto/q3textbrowser/q3textbrowser.pro
@@ -3,6 +3,7 @@ HEADERS +=
SOURCES += tst_q3textbrowser.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3textedit/q3textedit.pro b/tests/auto/q3textedit/q3textedit.pro
index a4b24a9..ff90c4a 100644
--- a/tests/auto/q3textedit/q3textedit.pro
+++ b/tests/auto/q3textedit/q3textedit.pro
@@ -4,5 +4,6 @@ SOURCES += tst_q3textedit.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3textstream/q3textstream.pro b/tests/auto/q3textstream/q3textstream.pro
index 7c80af7..bf2584a 100644
--- a/tests/auto/q3textstream/q3textstream.pro
+++ b/tests/auto/q3textstream/q3textstream.pro
@@ -1,6 +1,7 @@
load(qttest_p4)
SOURCES += tst_q3textstream.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
MOC_DIR=tmp
diff --git a/tests/auto/q3timeedit/q3timeedit.pro b/tests/auto/q3timeedit/q3timeedit.pro
index 17b4a84..0f231df 100644
--- a/tests/auto/q3timeedit/q3timeedit.pro
+++ b/tests/auto/q3timeedit/q3timeedit.pro
@@ -1,6 +1,7 @@
load(qttest_p4)
SOURCES += tst_q3timeedit.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3toolbar/q3toolbar.pro b/tests/auto/q3toolbar/q3toolbar.pro
index 8fcab99..974f14f 100644
--- a/tests/auto/q3toolbar/q3toolbar.pro
+++ b/tests/auto/q3toolbar/q3toolbar.pro
@@ -1,6 +1,7 @@
load(qttest_p4)
SOURCES += tst_q3toolbar.cpp
QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3uridrag/q3uridrag.pro b/tests/auto/q3uridrag/q3uridrag.pro
index 526623e..b6e77fc 100644
--- a/tests/auto/q3uridrag/q3uridrag.pro
+++ b/tests/auto/q3uridrag/q3uridrag.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_q3uridrag.cpp
-contains(QT_CONFIG, qt3support): QT += qt3support
+QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3urloperator/q3urloperator.pro b/tests/auto/q3urloperator/q3urloperator.pro
index 3364dac..29282eb 100644
--- a/tests/auto/q3urloperator/q3urloperator.pro
+++ b/tests/auto/q3urloperator/q3urloperator.pro
@@ -2,7 +2,8 @@ load(qttest_p4)
SOURCES += tst_q3urloperator.cpp
-contains(QT_CONFIG, qt3support): QT += qt3support
+QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
QT += network
diff --git a/tests/auto/q3valuelist/q3valuelist.pro b/tests/auto/q3valuelist/q3valuelist.pro
index ab82d31..d359779 100644
--- a/tests/auto/q3valuelist/q3valuelist.pro
+++ b/tests/auto/q3valuelist/q3valuelist.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_q3valuelist.cpp
-contains(QT_CONFIG, qt3support): QT += qt3support
+QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3valuevector/q3valuevector.pro b/tests/auto/q3valuevector/q3valuevector.pro
index 883fda2..55956cb 100644
--- a/tests/auto/q3valuevector/q3valuevector.pro
+++ b/tests/auto/q3valuevector/q3valuevector.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_q3valuevector.cpp
-contains(QT_CONFIG, qt3support): QT += qt3support
+QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/q3widgetstack/q3widgetstack.pro b/tests/auto/q3widgetstack/q3widgetstack.pro
index 9783f58..1bd6a89 100644
--- a/tests/auto/q3widgetstack/q3widgetstack.pro
+++ b/tests/auto/q3widgetstack/q3widgetstack.pro
@@ -2,6 +2,7 @@ load(qttest_p4)
SOURCES += tst_q3widgetstack.cpp
-contains(QT_CONFIG, qt3support): QT += qt3support
+QT += qt3support
+requires(contains(QT_CONFIG,qt3support))
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index dc52416..df770b3 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -4046,7 +4046,7 @@ void tst_QAccessibility::accelerators()
window->show();
QAccessibleInterface *accLineEdit = QAccessible::queryAccessibleInterface(le);
- QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString(QKeySequence(Qt::ALT) + QLatin1String("L")));
+ QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString() + QLatin1String("L"));
label->setText(tr("Q &"));
QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString());
label->setText(tr("Q &&"));
@@ -4054,11 +4054,11 @@ void tst_QAccessibility::accelerators()
label->setText(tr("Q && A"));
QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString());
label->setText(tr("Q &&&A"));
- QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString(QKeySequence(Qt::ALT) + QLatin1String("A")));
+ QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString() + QLatin1String("A"));
label->setText(tr("Q &&A"));
QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString());
label->setText(tr("Q &A&B"));
- QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString(QKeySequence(Qt::ALT) + QLatin1String("A")));
+ QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString() + QLatin1String("A"));
#if defined(Q_WS_X11)
qt_x11_wait_for_window_manager(window);
diff --git a/tests/auto/qbytearraymatcher/qbytearraymatcher.pro b/tests/auto/qbytearraymatcher/qbytearraymatcher.pro
new file mode 100644
index 0000000..1618c3e
--- /dev/null
+++ b/tests/auto/qbytearraymatcher/qbytearraymatcher.pro
@@ -0,0 +1,4 @@
+load(qttest_p4)
+SOURCES += tst_qbytearraymatcher.cpp
+
+QT = core
diff --git a/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp b/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp
new file mode 100644
index 0000000..c3f2fd9
--- /dev/null
+++ b/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <qbytearraymatcher.h>
+
+class tst_QByteArrayMatcher : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void interface();
+ void task251958();
+};
+
+static QByteArrayMatcher matcher1;
+
+void tst_QByteArrayMatcher::interface()
+{
+ const char needle[] = "abc123";
+ QByteArray haystack(500, 'a');
+ haystack.insert(6, "123");
+ haystack.insert(31, "abc");
+ haystack.insert(42, "abc123");
+ haystack.insert(84, "abc123");
+
+ matcher1 = QByteArrayMatcher(QByteArray(needle));
+ QByteArrayMatcher matcher2;
+ matcher2.setPattern(QByteArray(needle));
+
+ QByteArrayMatcher matcher3 = QByteArrayMatcher(QByteArray(needle));
+ QByteArrayMatcher matcher4(needle, sizeof(needle - 1));
+ QByteArrayMatcher matcher5(matcher2);
+ QByteArrayMatcher matcher6;
+ matcher6 = matcher3;
+
+ QCOMPARE(matcher1.indexIn(haystack), 42);
+ QCOMPARE(matcher2.indexIn(haystack), 42);
+ QCOMPARE(matcher3.indexIn(haystack), 42);
+ QCOMPARE(matcher4.indexIn(haystack), 42);
+ QCOMPARE(matcher5.indexIn(haystack), 42);
+ QCOMPARE(matcher6.indexIn(haystack), 42);
+
+ QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.length()), 42);
+
+ QCOMPARE(matcher1.indexIn(haystack, 43), 84);
+ QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.length(), 43), 84);
+ QCOMPARE(matcher1.indexIn(haystack, 85), -1);
+ QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.length(), 85), -1);
+
+ QByteArrayMatcher matcher7(QByteArray("123"));
+ QCOMPARE(matcher7.indexIn(haystack), 6);
+
+ matcher7 = QByteArrayMatcher(QByteArray("abc"));
+ QCOMPARE(matcher7.indexIn(haystack), 31);
+
+ matcher7.setPattern(matcher4.pattern());
+ QCOMPARE(matcher7.indexIn(haystack), 42);
+}
+
+
+static QByteArrayMatcher matcher;
+
+void tst_QByteArrayMatcher::task251958()
+{
+ const char p_data[] = { 0x0, 0x0, 0x1 };
+ QByteArray pattern(p_data, sizeof(p_data));
+
+ QByteArray haystack(8, '\0');
+ haystack[7] = 0x1;
+
+ matcher = QByteArrayMatcher(pattern);
+ QCOMPARE(matcher.indexIn(haystack, 0), 5);
+ QCOMPARE(matcher.indexIn(haystack, 1), 5);
+ QCOMPARE(matcher.indexIn(haystack, 2), 5);
+
+ matcher.setPattern(pattern);
+ QCOMPARE(matcher.indexIn(haystack, 0), 5);
+ QCOMPARE(matcher.indexIn(haystack, 1), 5);
+ QCOMPARE(matcher.indexIn(haystack, 2), 5);
+}
+
+QTEST_APPLESS_MAIN(tst_QByteArrayMatcher)
+#include "tst_qbytearraymatcher.moc"
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp
index 656995a..b71cdc6 100644
--- a/tests/auto/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/qcompleter/tst_qcompleter.cpp
@@ -143,6 +143,9 @@ private slots:
void task246056_setCompletionPrefix();
void task250064_lostFocus();
+ void task253125_lineEditCompletion_data();
+ void task253125_lineEditCompletion();
+
private:
void filter();
void testRowCount();
@@ -1184,5 +1187,48 @@ void tst_QCompleter::task250064_lostFocus()
QCOMPARE(textEdit->focusPolicy(), origPolicy);
}
+void tst_QCompleter::task253125_lineEditCompletion_data()
+{
+ QTest::addColumn<QStringList>("list");
+ QTest::addColumn<int>("completionMode");
+
+ QStringList list = QStringList()
+ << "alpha" << "beta" << "gamma" << "delta" << "epsilon" << "zeta"
+ << "eta" << "theta" << "iota" << "kappa" << "lambda" << "mu"
+ << "nu" << "xi" << "omicron" << "pi" << "rho" << "sigma"
+ << "tau" << "upsilon" << "phi" << "chi" << "psi" << "omega";
+
+ QTest::newRow("Inline") << list << (int)QCompleter::InlineCompletion;
+ QTest::newRow("Filtered") << list << (int)QCompleter::PopupCompletion;
+ QTest::newRow("Unfiltered") << list << (int)QCompleter::UnfilteredPopupCompletion;
+}
+
+void tst_QCompleter::task253125_lineEditCompletion()
+{
+ QFETCH(QStringList, list);
+ QFETCH(int, completionMode);
+
+ QStringListModel *model = new QStringListModel;
+ model->setStringList(list);
+
+ QCompleter *completer = new QCompleter(list);
+ completer->setModel(model);
+ completer->setCompletionMode((QCompleter::CompletionMode)completionMode);
+
+ QLineEdit edit;
+ edit.setCompleter(completer);
+ edit.show();
+ edit.setFocus();
+
+ QTest::qWait(100);
+
+ QTest::keyClick(&edit, 'i');
+ QCOMPARE(edit.completer()->currentCompletion(), QString("iota"));
+ QTest::keyClick(edit.completer()->popup(), Qt::Key_Down);
+ QTest::keyClick(edit.completer()->popup(), Qt::Key_Enter);
+
+ QCOMPARE(edit.text(), QString("iota"));
+}
+
QTEST_MAIN(tst_QCompleter)
#include "tst_qcompleter.moc"
diff --git a/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp b/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp
index 58707f1..947e8d6 100644
--- a/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp
+++ b/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp
@@ -90,6 +90,8 @@ private Q_SLOTS:
void watcher();
void watcher_error();
void watcher_waitForFinished();
+ void watcher_waitForFinished_alreadyFinished();
+ void watcher_waitForFinished_alreadyFinished_eventLoop();
void watcher_waitForFinished_error();
void callInsideWaitForFinished();
@@ -375,6 +377,77 @@ void tst_QDBusPendingCall::watcher_waitForFinished()
QVERIFY(args2.at(0).toStringList().contains(conn.baseService()));
}
+void tst_QDBusPendingCall::watcher_waitForFinished_alreadyFinished()
+{
+ QDBusPendingCall ac = sendMessage();
+ QVERIFY(!ac.isFinished());
+ QVERIFY(!ac.isError());
+ QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage);
+
+ ac.waitForFinished();
+ QVERIFY(ac.isFinished());
+ QVERIFY(!ac.isError());
+
+ callCount = 0;
+ watchArgument = 0;
+
+ // create a watcher on an already-finished reply
+ QDBusPendingCallWatcher watch(ac);
+ connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(finished(QDBusPendingCallWatcher*)));
+
+ watch.waitForFinished();
+
+ QVERIFY(ac.isFinished());
+ QVERIFY(!ac.isError());
+
+ QCOMPARE(callCount, 1);
+ QCOMPARE(slotCalled, (int)FinishCalled);
+ QCOMPARE(watchArgument, &watch);
+ QVERIFY(!watch.isError());
+
+ const QVariantList args2 = ac.reply().arguments();
+ QVERIFY(!args2.isEmpty());
+ QVERIFY(args2.at(0).toStringList().contains(conn.baseService()));
+}
+
+void tst_QDBusPendingCall::watcher_waitForFinished_alreadyFinished_eventLoop()
+{
+ QDBusPendingCall ac = sendMessage();
+ QVERIFY(!ac.isFinished());
+ QVERIFY(!ac.isError());
+ QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage);
+
+ ac.waitForFinished();
+ QVERIFY(ac.isFinished());
+ QVERIFY(!ac.isError());
+
+ callCount = 0;
+ watchArgument = 0;
+
+ // create a watcher on an already-finished reply
+ QDBusPendingCallWatcher watch(ac);
+ connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(finished(QDBusPendingCallWatcher*)));
+ connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ &QTestEventLoop::instance(), SLOT(exitLoop()));
+
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QVERIFY(ac.isFinished());
+ QVERIFY(!ac.isError());
+
+ QCOMPARE(callCount, 1);
+ QCOMPARE(slotCalled, (int)FinishCalled);
+ QCOMPARE(watchArgument, &watch);
+ QVERIFY(!watch.isError());
+
+ const QVariantList args2 = ac.reply().arguments();
+ QVERIFY(!args2.isEmpty());
+ QVERIFY(args2.at(0).toStringList().contains(conn.baseService()));
+}
+
void tst_QDBusPendingCall::watcher_waitForFinished_error()
{
QDBusPendingCall ac = sendError();
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index 695bfe7..689f73d 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -157,6 +157,8 @@ private slots:
void task228844_ensurePreviousSorting();
void task239706_editableFilterCombo();
void task218353_relativePaths();
+ void task251321_sideBarHiddenEntries();
+ void task251341_sideBarRemoveEntries();
private:
QByteArray userSettings;
@@ -1600,6 +1602,19 @@ void tst_QFiledialog::task227304_proxyOnFileDialog()
QTest::keyClick(list, Qt::Key_Return);
QTest::qWait(200);
+ dialog->close();
+ fd.close();
+
+ QNonNativeFileDialog fd2(0, "I should not crash with a proxy", QDir::tempPath(), 0);
+ QSortFilterProxyModel *pm = new QSortFilterProxyModel;
+ fd2.setProxyModel(pm);
+ fd2.show();
+ QSidebar *sidebar = qFindChild<QSidebar*>(&fd2, "sidebar");
+ sidebar->setFocus();
+ sidebar->selectUrl(QUrl::fromLocalFile(QDir::homePath()));
+ QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
+ QTest::qWait(250);
+ //We shouldn't crash
}
void tst_QFiledialog::task227930_correctNavigationKeyboardBehavior()
@@ -1852,5 +1867,119 @@ void tst_QFiledialog::task218353_relativePaths()
appDir.rmdir("test");
}
+void tst_QFiledialog::task251321_sideBarHiddenEntries()
+{
+ QNonNativeFileDialog fd;
+
+ QDir current = QDir::currentPath();
+ current.mkdir(".hidden");
+ QDir hiddenDir = QDir(".hidden");
+ hiddenDir.mkdir("subdir");
+ QDir hiddenSubDir = QDir(".hidden/subdir");
+ hiddenSubDir.mkdir("happy");
+ hiddenSubDir.mkdir("happy2");
+
+ QList<QUrl> urls;
+ urls << QUrl::fromLocalFile(hiddenSubDir.absolutePath());
+ fd.setSidebarUrls(urls);
+ fd.show();
+ QTest::qWait(250);
+
+ QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
+ sidebar->setFocus();
+ sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath()));
+ QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
+ QTest::qWait(250);
+
+ QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
+ QCOMPARE(model->rowCount(model->index(hiddenSubDir.absolutePath())), 2);
+
+ hiddenSubDir.rmdir("happy2");
+ hiddenSubDir.rmdir("happy");
+ hiddenDir.rmdir("subdir");
+ current.rmdir(".hidden");
+}
+
+class MyQSideBar : public QSidebar
+{
+public :
+ MyQSideBar(QWidget *parent = 0) : QSidebar(parent)
+ {}
+
+ void removeSelection() {
+ QList<QModelIndex> idxs = selectionModel()->selectedIndexes();
+ QList<QPersistentModelIndex> indexes;
+ for (int i = 0; i < idxs.count(); i++)
+ indexes.append(idxs.at(i));
+
+ for (int i = 0; i < indexes.count(); ++i)
+ if (!indexes.at(i).data(Qt::UserRole + 1).toUrl().path().isEmpty())
+ model()->removeRow(indexes.at(i).row());
+ }
+};
+
+void tst_QFiledialog::task251341_sideBarRemoveEntries()
+{
+ QNonNativeFileDialog fd;
+
+ QDir current = QDir::currentPath();
+ current.mkdir("testDir");
+ QDir testSubDir = QDir("testDir");
+
+ QList<QUrl> urls;
+ urls << QUrl::fromLocalFile(testSubDir.absolutePath());
+ urls << QUrl::fromLocalFile("NotFound");
+ fd.setSidebarUrls(urls);
+ fd.show();
+ QTest::qWait(250);
+
+ QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
+ sidebar->setFocus();
+ //We enter in the first bookmark
+ sidebar->selectUrl(QUrl::fromLocalFile(testSubDir.absolutePath()));
+ QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
+ QTest::qWait(250);
+
+ QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
+ //There is no file
+ QCOMPARE(model->rowCount(model->index(testSubDir.absolutePath())), 0);
+ //Icon is not enabled QUrlModel::EnabledRole
+ QVariant value = sidebar->model()->index(0, 0).data(Qt::UserRole + 2);
+ QCOMPARE(qvariant_cast<bool>(value), true);
+
+ sidebar->setFocus();
+ //We enter in the second bookmark which is invalid
+ sidebar->selectUrl(QUrl::fromLocalFile("NotFound"));
+ QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
+ QTest::qWait(250);
+
+ //We fallback to root because the entry in the bookmark is invalid
+ QCOMPARE(model->rowCount(model->index("NotFound")), model->rowCount(model->index(model->rootPath())));
+ //Icon is not enabled QUrlModel::EnabledRole
+ value = sidebar->model()->index(1, 0).data(Qt::UserRole + 2);
+ QCOMPARE(qvariant_cast<bool>(value), false);
+
+ MyQSideBar mySideBar;
+ mySideBar.init(model, urls);
+ mySideBar.show();
+ mySideBar.selectUrl(QUrl::fromLocalFile(testSubDir.absolutePath()));
+ QTest::qWait(1000);
+ mySideBar.removeSelection();
+
+ //We remove the first entry
+ QList<QUrl> expected;
+ expected << QUrl::fromLocalFile("NotFound");
+ QCOMPARE(mySideBar.urls(), expected);
+
+ mySideBar.selectUrl(QUrl::fromLocalFile("NotFound"));
+ mySideBar.removeSelection();
+
+ //We remove the second entry
+ expected.clear();
+ QCOMPARE(mySideBar.urls(), expected);
+
+ current.rmdir("testDir");
+}
+
QTEST_MAIN(tst_QFiledialog)
#include "tst_qfiledialog.moc"
diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 826d278..59d57ce 100644
--- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -45,6 +45,7 @@
#include <QFileIconProvider>
#include "../../shared/util.h"
#include <QTime>
+#include <QStyle>
#include <QtGlobal>
//TESTED_CLASS=
@@ -284,6 +285,33 @@ void tst_QFileSystemModel::readOnly()
QVERIFY(model->flags(model->index(file.fileName())) & Qt::ItemIsEditable);
}
+class CustomFileIconProvider : public QFileIconProvider
+{
+public:
+ CustomFileIconProvider() : QFileIconProvider() {
+ mb = qApp->style()->standardIcon(QStyle::SP_MessageBoxCritical);
+ dvd = qApp->style()->standardIcon(QStyle::SP_DriveDVDIcon);
+ }
+
+ virtual QIcon icon(const QFileInfo &info) const
+ {
+ if (info.isDir())
+ return mb;
+
+ return QFileIconProvider::icon(info);
+ }
+ virtual QIcon icon(IconType type) const
+ {
+ if (type == QFileIconProvider::Folder)
+ return dvd;
+
+ return QFileIconProvider::icon(type);
+ }
+private:
+ QIcon mb;
+ QIcon dvd;
+};
+
void tst_QFileSystemModel::iconProvider()
{
QVERIFY(model->iconProvider());
@@ -292,6 +320,19 @@ void tst_QFileSystemModel::iconProvider()
QCOMPARE(model->iconProvider(), p);
model->setIconProvider(0);
delete p;
+
+ QFileSystemModel *myModel = new QFileSystemModel();
+ myModel->setRootPath(QDir::homePath());
+ //Let's wait to populate the model
+ QTest::qWait(250);
+ //We change the provider, icons must me updated
+ CustomFileIconProvider *custom = new CustomFileIconProvider();
+ myModel->setIconProvider(custom);
+
+ QPixmap mb = qApp->style()->standardIcon(QStyle::SP_MessageBoxCritical).pixmap(50, 50);
+ QCOMPARE(myModel->fileIcon(myModel->index(QDir::homePath())).pixmap(50, 50), mb);
+ delete myModel;
+ delete custom;
}
bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount, const QStringList &initial_dirs, const QString &dir)
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index a64dfc4..69141f3 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -66,6 +66,8 @@ private slots:
void getSetCheck();
void openGLVersionCheck();
void graphicsViewClipping();
+ void partialGLWidgetUpdates_data();
+ void partialGLWidgetUpdates();
};
tst_QGL::tst_QGL()
@@ -404,5 +406,68 @@ void tst_QGL::graphicsViewClipping()
#endif
}
+void tst_QGL::partialGLWidgetUpdates_data()
+{
+ QTest::addColumn<bool>("doubleBufferedContext");
+ QTest::addColumn<bool>("autoFillBackground");
+ QTest::addColumn<bool>("supportsPartialUpdates");
+
+ QTest::newRow("Double buffered context") << true << true << false;
+ QTest::newRow("Double buffered context without auto-fill background") << true << false << false;
+ QTest::newRow("Single buffered context") << false << true << false;
+ QTest::newRow("Single buffered context without auto-fill background") << false << false << true;
+}
+
+void tst_QGL::partialGLWidgetUpdates()
+{
+#ifdef QT_NO_OPENGL
+ QSKIP("QGL not yet supported", SkipAll);
+#else
+ if (!QGLFormat::hasOpenGL())
+ QSKIP("QGL not supported on this platform", SkipAll);
+
+ QFETCH(bool, doubleBufferedContext);
+ QFETCH(bool, autoFillBackground);
+ QFETCH(bool, supportsPartialUpdates);
+
+ class MyGLWidget : public QGLWidget
+ {
+ public:
+ QRegion paintEventRegion;
+ void paintEvent(QPaintEvent *e)
+ {
+ paintEventRegion = e->region();
+ }
+ };
+
+ QGLFormat format = QGLFormat::defaultFormat();
+ format.setDoubleBuffer(doubleBufferedContext);
+ QGLFormat::setDefaultFormat(format);
+
+ MyGLWidget widget;
+ widget.setFixedSize(150, 150);
+ widget.setAutoFillBackground(autoFillBackground);
+ widget.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&widget);
+#endif
+ QTest::qWait(200);
+
+ if (widget.format().doubleBuffer() != doubleBufferedContext)
+ QSKIP("Platform does not support requested format", SkipAll);
+
+ widget.paintEventRegion = QRegion();
+ widget.repaint(50, 50, 50, 50);
+#ifdef Q_WS_MAC
+ // repaint() is not immediate on the Mac; it has to go through the event loop.
+ QTest::qWait(200);
+#endif
+ if (supportsPartialUpdates)
+ QCOMPARE(widget.paintEventRegion, QRegion(50, 50, 50, 50));
+ else
+ QCOMPARE(widget.paintEventRegion, QRegion(widget.rect()));
+#endif
+}
+
QTEST_MAIN(tst_QGL)
#include "tst_qgl.moc"
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 5565aa6..6d150cb 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -78,8 +78,7 @@ Q_DECLARE_METATYPE(QRectF)
class EventTester : public QGraphicsItem
{
public:
- EventTester()
- : repaints(0)
+ EventTester(QGraphicsItem *parent = 0) : QGraphicsItem(parent), repaints(0)
{ br = QRectF(-10, -10, 20, 20); }
void setGeometry(const QRectF &rect)
@@ -207,6 +206,7 @@ private slots:
void itemTransform_unrelated();
void opacity_data();
void opacity();
+ void opacity2();
void itemStacksBehindParent();
void nestedClipping();
void nestedClippingTransforms();
@@ -214,6 +214,7 @@ private slots:
void tabChangesFocus();
void tabChangesFocus_data();
void cacheMode();
+ void updateCachedItemAfterMove();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -3654,6 +3655,8 @@ void tst_QGraphicsItem::defaultItemTest_QGraphicsEllipseItem()
class ItemChangeTester : public QGraphicsRectItem
{
public:
+ ItemChangeTester(){}
+ ItemChangeTester(QGraphicsItem *parent) : QGraphicsRectItem(parent) {}
QVariant itemChangeReturnValue;
QGraphicsScene *itemSceneChangeTargetScene;
@@ -3928,6 +3931,39 @@ void tst_QGraphicsItem::itemChange()
QCOMPARE(tester.changes.size(), ++changeCount);
QCOMPARE(tester.changes.last(), QGraphicsItem::ItemChildRemovedChange);
QCOMPARE(qVariantValue<QGraphicsItem *>(tester.values.last()), (QGraphicsItem *)&testerHelper);
+
+ // ItemChildRemovedChange 1
+ ItemChangeTester *test = new ItemChangeTester;
+ test->itemSceneChangeTargetScene = 0;
+ int count = 0;
+ QGraphicsScene *scene = new QGraphicsScene;
+ scene->addItem(test);
+ count = test->changes.size();
+ //We test here the fact that when a child is deleted the parent receive only one ItemChildRemovedChange
+ QGraphicsRectItem *child = new QGraphicsRectItem(test);
+ //We received ItemChildAddedChange
+ QCOMPARE(test->changes.size(), ++count);
+ QCOMPARE(test->changes.last(), QGraphicsItem::ItemChildAddedChange);
+ delete child;
+ child = 0;
+ QCOMPARE(test->changes.size(), ++count);
+ QCOMPARE(test->changes.last(), QGraphicsItem::ItemChildRemovedChange);
+
+ ItemChangeTester *childTester = new ItemChangeTester(test);
+ //Changes contains all sceneHasChanged and so on, we don't want to test that
+ int childCount = childTester->changes.size();
+ //We received ItemChildAddedChange
+ QCOMPARE(test->changes.size(), ++count);
+ child = new QGraphicsRectItem(childTester);
+ //We received ItemChildAddedChange
+ QCOMPARE(childTester->changes.size(), ++childCount);
+ QCOMPARE(childTester->changes.last(), QGraphicsItem::ItemChildAddedChange);
+ //Delete the child of the top level with all its children
+ delete childTester;
+ //Only one removal
+ QCOMPARE(test->changes.size(), ++count);
+ QCOMPARE(test->changes.last(), QGraphicsItem::ItemChildRemovedChange);
+ delete scene;
}
{
// ItemChildRemovedChange 2
@@ -5534,6 +5570,91 @@ void tst_QGraphicsItem::opacity()
QCOMPARE(c3->effectiveOpacity(), c3_effectiveOpacity);
}
+void tst_QGraphicsItem::opacity2()
+{
+ EventTester *parent = new EventTester;
+ EventTester *child = new EventTester(parent);
+ EventTester *grandChild = new EventTester(child);
+
+ QGraphicsScene scene;
+ scene.addItem(parent);
+
+ class MyGraphicsView : public QGraphicsView
+ { public:
+ int repaints;
+ MyGraphicsView(QGraphicsScene *scene) : QGraphicsView(scene), repaints(0) {}
+ void paintEvent(QPaintEvent *e) { ++repaints; QGraphicsView::paintEvent(e); }
+ };
+
+ MyGraphicsView view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(250);
+
+#define RESET_REPAINT_COUNTERS \
+ parent->repaints = 0; \
+ child->repaints = 0; \
+ grandChild->repaints = 0; \
+ view.repaints = 0;
+
+ RESET_REPAINT_COUNTERS
+
+ child->setOpacity(0.0);
+ QTest::qWait(100);
+ QCOMPARE(view.repaints, 1);
+ QCOMPARE(parent->repaints, 1);
+ QCOMPARE(child->repaints, 0);
+ QCOMPARE(grandChild->repaints, 0);
+
+ RESET_REPAINT_COUNTERS
+
+ child->setOpacity(1.0);
+ QTest::qWait(100);
+ QCOMPARE(view.repaints, 1);
+ QCOMPARE(parent->repaints, 1);
+ QCOMPARE(child->repaints, 1);
+ QCOMPARE(grandChild->repaints, 1);
+
+ RESET_REPAINT_COUNTERS
+
+ parent->setOpacity(0.0);
+ QTest::qWait(100);
+ QCOMPARE(view.repaints, 1);
+ QCOMPARE(parent->repaints, 0);
+ QCOMPARE(child->repaints, 0);
+ QCOMPARE(grandChild->repaints, 0);
+
+ RESET_REPAINT_COUNTERS
+
+ parent->setOpacity(1.0);
+ QTest::qWait(100);
+ QCOMPARE(view.repaints, 1);
+ QCOMPARE(parent->repaints, 1);
+ QCOMPARE(child->repaints, 1);
+ QCOMPARE(grandChild->repaints, 1);
+
+ grandChild->setFlag(QGraphicsItem::ItemIgnoresParentOpacity);
+ RESET_REPAINT_COUNTERS
+
+ child->setOpacity(0.0);
+ QTest::qWait(100);
+ QCOMPARE(view.repaints, 1);
+ QCOMPARE(parent->repaints, 1);
+ QCOMPARE(child->repaints, 0);
+ QCOMPARE(grandChild->repaints, 1);
+
+ RESET_REPAINT_COUNTERS
+
+ child->setOpacity(0.0); // Already 0.0; no change.
+ QTest::qWait(100);
+ QCOMPARE(view.repaints, 0);
+ QCOMPARE(parent->repaints, 0);
+ QCOMPARE(child->repaints, 0);
+ QCOMPARE(grandChild->repaints, 0);
+}
+
void tst_QGraphicsItem::itemStacksBehindParent()
{
QGraphicsRectItem *parent1 = new QGraphicsRectItem(QRectF(0, 0, 100, 50));
@@ -6038,5 +6159,46 @@ void tst_QGraphicsItem::cacheMode()
QCOMPARE(testerChild2->repaints, 6);
}
+void tst_QGraphicsItem::updateCachedItemAfterMove()
+{
+ // A simple item that uses ItemCoordinateCache
+ EventTester *tester = new EventTester;
+ tester->setCacheMode(QGraphicsItem::ItemCoordinateCache);
+
+ // Add to a scene, show in a view, ensure it's painted and reset its
+ // repaint counter.
+ QGraphicsScene scene;
+ scene.addItem(tester);
+ QGraphicsView view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(125);
+ tester->repaints = 0;
+
+ // Move the item, should not cause repaints
+ tester->setPos(10, 0);
+ QTest::qWait(125);
+ QCOMPARE(tester->repaints, 0);
+
+ // Move then update, should cause one repaint
+ tester->setPos(20, 0);
+ tester->update();
+ QTest::qWait(125);
+ QCOMPARE(tester->repaints, 1);
+
+ // Hiding the item doesn't cause a repaint
+ tester->hide();
+ QTest::qWait(125);
+ QCOMPARE(tester->repaints, 1);
+
+ // Moving a hidden item doesn't cause a repaint
+ tester->setPos(30, 0);
+ tester->update();
+ QTest::qWait(125);
+ QCOMPARE(tester->repaints, 1);
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index f25a079..b85abd3 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -50,6 +50,7 @@
#include <qcleanlooksstyle.h>
#include <qlineedit.h>
#include <qboxlayout.h>
+#include <qaction.h>
#include "../../shared/util.h"
@@ -150,6 +151,7 @@ private slots:
// Task fixes
void task236127_bspTreeIndexFails();
void task243004_setStyleCrash();
+ void task250119_shortcutContext();
};
@@ -1827,6 +1829,89 @@ void tst_QGraphicsWidget::task243004_setStyleCrash()
delete item2;
}
+class GraphicsWidget_task250119 : public QGraphicsWidget
+{
+public:
+ GraphicsWidget_task250119()
+ : shortcutEvents(0)
+ {
+ setFocusPolicy(Qt::StrongFocus);
+ resize(100, 100);
+ }
+
+ int shortcutEvents;
+
+private:
+ bool event(QEvent *event)
+ {
+ if (event->type() == QEvent::Shortcut)
+ shortcutEvents++;
+ return QGraphicsWidget::event(event);
+ }
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+ {
+ if (hasFocus()) {
+ painter->setPen(QPen(Qt::black, 0, Qt::DashLine));
+ painter->drawRect(rect());
+ }
+ painter->setPen(QPen(Qt::black, 0, Qt::SolidLine));
+ painter->fillRect(rect().adjusted(2, 2, -2, -2), Qt::yellow);
+ painter->drawRect(rect().adjusted(2, 2, -2, -2));
+ }
+};
+
+void tst_QGraphicsWidget::task250119_shortcutContext()
+{
+ QGraphicsScene scene;
+ QGraphicsView view;
+ view.setScene(&scene);
+ view.show();
+ QTest::qWait(100);
+
+
+ // *** Event: ***
+
+ GraphicsWidget_task250119 w_event;
+ scene.addItem(&w_event);
+
+ const int id = w_event.grabShortcut(Qt::Key_A, Qt::WidgetWithChildrenShortcut);
+ w_event.setShortcutEnabled(id, true);
+
+ w_event.setFocus();
+ QTest::keyPress(&view, Qt::Key_A);
+ QCOMPARE(w_event.shortcutEvents, 1);
+
+ w_event.clearFocus();
+ QTest::keyPress(&view, Qt::Key_A);
+ QCOMPARE(w_event.shortcutEvents, 1);
+
+ scene.removeItem(&w_event);
+
+
+ // *** Signal: ***
+
+ GraphicsWidget_task250119 w_signal;
+ scene.addItem(&w_signal);
+
+ QAction action(0);
+ action.setShortcut(Qt::Key_B);
+ action.setShortcutContext(Qt::WidgetWithChildrenShortcut);
+ QSignalSpy spy(&action, SIGNAL(triggered()));
+
+ w_signal.addAction(&action);
+
+ w_signal.setFocus();
+ QTest::keyPress(&view, Qt::Key_B);
+ QCOMPARE(spy.count(), 1);
+
+ w_signal.clearFocus();
+ QTest::keyPress(&view, Qt::Key_B);
+ QCOMPARE(spy.count(), 1);
+
+ scene.removeItem(&w_signal);
+}
+
QTEST_MAIN(tst_QGraphicsWidget)
#include "tst_qgraphicswidget.moc"
diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp
index 0867e48..6478854 100644
--- a/tests/auto/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/qheaderview/tst_qheaderview.cpp
@@ -187,6 +187,7 @@ private slots:
void emptySectionSpan();
void task236450_hidden_data();
void task236450_hidden();
+ void task248050_hideRow();
protected:
QHeaderView *view;
@@ -1919,5 +1920,28 @@ void tst_QHeaderView::task236450_hidden()
}
+void tst_QHeaderView::task248050_hideRow()
+{
+ //this is the sequence of events that make the task fail
+ protected_QHeaderView header(Qt::Vertical);
+ QStandardItemModel model(0, 1);
+ header.setStretchLastSection(false);
+ header.setDefaultSectionSize(17);
+ header.setModel(&model);
+ header.doItemsLayout();
+
+ model.setRowCount(3);
+
+ QCOMPARE(header.sectionPosition(2), 17*2);
+
+ header.hideSection(1);
+ QCOMPARE(header.sectionPosition(2), 17);
+
+ QTest::qWait(100);
+ //the size of the section shouldn't have changed
+ QCOMPARE(header.sectionPosition(2), 17);
+}
+
+
QTEST_MAIN(tst_QHeaderView)
#include "tst_qheaderview.moc"
diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
index 15b36b8..9bd1ce3 100644
--- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -89,6 +89,7 @@ private slots:
void merge_data();
void merge();
void task119433_isRowSelected();
+ void task252069_rowIntersectsSelection();
private:
QAbstractItemModel *model;
@@ -2140,6 +2141,51 @@ void tst_QItemSelectionModel::task119433_isRowSelected()
QVERIFY(sel.isRowSelected(0, QModelIndex()));
}
+void tst_QItemSelectionModel::task252069_rowIntersectsSelection()
+{
+ QStandardItemModel m;
+ for (int i=0; i<8; ++i) {
+ for (int j=0; j<8; ++j) {
+ QStandardItem *item = new QStandardItem(QString("Item number %1").arg(i));
+ if ((i % 2 == 0 && j == 0) ||
+ (j % 2 == 0 && i == 0) ||
+ j == 5 || i == 5 ) {
+ item->setEnabled(false);
+ //item->setSelectable(false);
+ }
+ m.setItem(i, j, item);
+ }
+ }
+
+ QItemSelectionModel selected(&m);
+ //nothing is selected
+ QVERIFY(!selected.rowIntersectsSelection(0, QModelIndex()));
+ QVERIFY(!selected.rowIntersectsSelection(2, QModelIndex()));
+ QVERIFY(!selected.rowIntersectsSelection(3, QModelIndex()));
+ QVERIFY(!selected.rowIntersectsSelection(5, QModelIndex()));
+ QVERIFY(!selected.columnIntersectsSelection(0, QModelIndex()));
+ QVERIFY(!selected.columnIntersectsSelection(2, QModelIndex()));
+ QVERIFY(!selected.columnIntersectsSelection(3, QModelIndex()));
+ QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex()));
+ selected.select(m.index(2, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
+ QVERIFY(!selected.rowIntersectsSelection(0, QModelIndex()));
+ QVERIFY( selected.rowIntersectsSelection(2, QModelIndex()));
+ QVERIFY(!selected.rowIntersectsSelection(3, QModelIndex()));
+ QVERIFY(!selected.rowIntersectsSelection(5, QModelIndex()));
+ QVERIFY(!selected.columnIntersectsSelection(0, QModelIndex()));
+ QVERIFY( selected.columnIntersectsSelection(2, QModelIndex()));
+ QVERIFY( selected.columnIntersectsSelection(3, QModelIndex()));
+ QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex()));
+ selected.select(m.index(0, 5), QItemSelectionModel::Select | QItemSelectionModel::Columns);
+ QVERIFY(!selected.rowIntersectsSelection(0, QModelIndex()));
+ QVERIFY( selected.rowIntersectsSelection(2, QModelIndex()));
+ QVERIFY(!selected.rowIntersectsSelection(3, QModelIndex()));
+ QVERIFY(!selected.rowIntersectsSelection(5, QModelIndex()));
+ QVERIFY(!selected.columnIntersectsSelection(0, QModelIndex()));
+ QVERIFY( selected.columnIntersectsSelection(2, QModelIndex()));
+ QVERIFY( selected.columnIntersectsSelection(3, QModelIndex()));
+ QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex()));
+}
QTEST_MAIN(tst_QItemSelectionModel)
#include "tst_qitemselectionmodel.moc"
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index 2e7f412..c372475 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -105,6 +105,7 @@ private slots:
void task203585_selectAll();
void task228566_infiniteRelayout();
void task248430_crashWith0SizedItem();
+ void task250446_scrollChanged();
};
// Testing get/set functions
@@ -1528,5 +1529,32 @@ void tst_QListView::task248430_crashWith0SizedItem()
QTest::qWait(100);
}
+void tst_QListView::task250446_scrollChanged()
+{
+ QStandardItemModel model(200, 1);
+ QListView view;
+ view.setModel(&model);
+ QModelIndex index = model.index(0, 0);
+ QVERIFY(index.isValid());
+ view.setCurrentIndex(index);
+ view.show();
+ QTest::qWait(100);
+ const int scrollValue = view.verticalScrollBar()->maximum();
+ view.verticalScrollBar()->setValue(scrollValue);
+ QCOMPARE(view.verticalScrollBar()->value(), scrollValue);
+ QCOMPARE(view.currentIndex(), index);
+
+ view.showMinimized();
+ QTest::qWait(100);
+ QCOMPARE(view.verticalScrollBar()->value(), scrollValue);
+ QCOMPARE(view.currentIndex(), index);
+
+ view.showNormal();
+ QTest::qWait(100);
+ QCOMPARE(view.verticalScrollBar()->value(), scrollValue);
+ QCOMPARE(view.currentIndex(), index);
+}
+
+
QTEST_MAIN(tst_QListView)
#include "tst_qlistview.moc"
diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/qlocalsocket/test/test.pro
index 8ce7c50..7befdf9 100644
--- a/tests/auto/qlocalsocket/test/test.pro
+++ b/tests/auto/qlocalsocket/test/test.pro
@@ -1,7 +1,5 @@
load(qttest_p4)
-include(../src/src.pri)
-
DEFINES += QLOCALSERVER_DEBUG
DEFINES += QLOCALSOCKET_DEBUG
!wince*: {
@@ -14,14 +12,16 @@ DEFINES += QLOCALSOCKET_DEBUG
QT = core network
SOURCES += ../tst_qlocalsocket.cpp
-TARGET = ../tst_qlocalsocket
-win32 {
+TARGET = tst_qlocalsocket
+CONFIG(debug_and_release) {
CONFIG(debug, debug|release) {
- TARGET = ../../debug/tst_qlocalsocket
-} else {
- TARGET = ../../release/tst_qlocalsocket
+ DESTDIR = ../debug
+ } else {
+ DESTDIR = ../release
}
+} else {
+ DESTDIR = ..
}
wince* {
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
index f741b96..deabda6 100644
--- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
@@ -95,6 +95,7 @@ private slots:
void longPath();
void waitForDisconnect();
+ void waitForDisconnectByServer();
void removeServer();
@@ -112,6 +113,8 @@ tst_QLocalSocket::tst_QLocalSocket()
#endif
))
qWarning() << "lackey executable doesn't exists!";
+
+ QLocalServer::removeServer("tst_localsocket");
}
tst_QLocalSocket::~tst_QLocalSocket()
@@ -783,6 +786,25 @@ void tst_QLocalSocket::waitForDisconnect()
QVERIFY(timer.elapsed() < 2000);
}
+void tst_QLocalSocket::waitForDisconnectByServer()
+{
+ QString name = "tst_localsocket";
+ LocalServer server;
+ QVERIFY(server.listen(name));
+ LocalSocket socket;
+ QSignalSpy spy(&socket, SIGNAL(disconnected()));
+ QVERIFY(spy.isValid());
+ socket.connectToServer(name);
+ QVERIFY(socket.waitForConnected(3000));
+ QVERIFY(server.waitForNewConnection(3000));
+ QLocalSocket *serverSocket = server.nextPendingConnection();
+ QVERIFY(serverSocket);
+ serverSocket->close();
+ QVERIFY(serverSocket->state() == QLocalSocket::UnconnectedState);
+ QVERIFY(socket.waitForDisconnected(3000));
+ QCOMPARE(spy.count(), 1);
+}
+
void tst_QLocalSocket::removeServer()
{
// this is a hostile takeover, but recovering from a crash results in the same
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp
index a86b754..5b6e54c 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -684,7 +684,7 @@ void tst_QMenu::task250673_activeMutliColumnSubMenuPosition()
class MyMenu : public QMenu
{
public:
- friend class tst_QMenu;
+ int columnCount() const { return QMenu::columnCount(); }
};
QMenu sub;
diff --git a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp
index 36a4b45..4ee5b9f 100644
--- a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp
+++ b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp
@@ -234,7 +234,7 @@ void tst_QNetworkCookie::parseSingleCookie_data()
QTest::newRow("path-with-utf8-2") << "a=b;path=/R%C3%A9sum%C3%A9" << cookie;
cookie.setPath(QString());
- cookie.setDomain("trolltech.com");
+ cookie.setDomain(".trolltech.com");
QTest::newRow("plain-domain1") << "a=b;domain=trolltech.com" << cookie;
QTest::newRow("plain-domain2") << "a=b; domain=trolltech.com " << cookie;
QTest::newRow("plain-domain3") << "a=b;domain=TROLLTECH.COM" << cookie;
@@ -246,7 +246,7 @@ void tst_QNetworkCookie::parseSingleCookie_data()
QTest::newRow("dot-domain3") << "a=b; domain=.TROLLTECH.COM" << cookie;
QTest::newRow("dot-domain4") << "a=b; Domain = .TROLLTECH.COM" << cookie;
- cookie.setDomain(QString::fromUtf8("d\303\270gn\303\245pent.troll.no"));
+ cookie.setDomain(QString::fromUtf8(".d\303\270gn\303\245pent.troll.no"));
QTest::newRow("idn-domain1") << "a=b;domain=xn--dgnpent-gxa2o.troll.no" << cookie;
QTest::newRow("idn-domain2") << "a=b;domain=d\303\270gn\303\245pent.troll.no" << cookie;
QTest::newRow("idn-domain3") << "a=b;domain=XN--DGNPENT-GXA2O.TROLL.NO" << cookie;
@@ -259,7 +259,7 @@ void tst_QNetworkCookie::parseSingleCookie_data()
QTest::newRow("dot-idn-domain3") << "a=b;domain=.XN--DGNPENT-GXA2O.TROLL.NO" << cookie;
QTest::newRow("dot-idn-domain4") << "a=b;domain=.D\303\230GN\303\205PENT.troll.NO" << cookie;
- cookie.setDomain("trolltech.com");
+ cookie.setDomain(".trolltech.com");
cookie.setPath("/");
QTest::newRow("two-fields") << "a=b;domain=trolltech.com;path=/" << cookie;
QTest::newRow("two-fields2") << "a=b; domain=trolltech.com; path=/" << cookie;
@@ -662,7 +662,7 @@ void tst_QNetworkCookie::parseMultipleCookies_data()
QTest::newRow("complex-1") << "c=d, a=, foo=bar; path=/" << list;
cookie.setName("baz");
- cookie.setDomain("trolltech.com");
+ cookie.setDomain(".trolltech.com");
list.prepend(cookie);
QTest::newRow("complex-2") << "baz=bar; path=/; domain=trolltech.com, c=d,a=,foo=bar; path=/" << list;
diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
index e87a3bf..7aa1d24 100644
--- a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
+++ b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
@@ -171,6 +171,17 @@ void tst_QNetworkCookieJar::setCookiesFromUrl_data()
result.clear();
result += finalCookie;
QTest::newRow("defaults-2") << preset << cookie << "http://www.foo.tld" << result << true;
+
+ // security test: do not accept cookie domains like ".com" nor ".com." (see RFC 2109 section 4.3.2)
+ result.clear();
+ preset.clear();
+ cookie.setDomain(".com");
+ QTest::newRow("rfc2109-4.3.2-ex3") << preset << cookie << "http://x.foo.com" << result << false;
+
+ result.clear();
+ preset.clear();
+ cookie.setDomain(".com.");
+ QTest::newRow("rfc2109-4.3.2-ex3-2") << preset << cookie << "http://x.foo.com" << result << false;
}
void tst_QNetworkCookieJar::setCookiesFromUrl()
diff --git a/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp b/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp
index 31a5391..0760ce8 100644
--- a/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp
+++ b/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp
@@ -59,6 +59,7 @@ public:
private slots:
void getSetCheck();
+ void capabilitiesPerType();
};
tst_QNetworkProxy::tst_QNetworkProxy()
@@ -79,6 +80,38 @@ void tst_QNetworkProxy::getSetCheck()
QCOMPARE(quint16(0), obj1.port());
obj1.setPort(quint16(0xffff));
QCOMPARE(quint16(0xffff), obj1.port());
+
+ obj1.setType(QNetworkProxy::DefaultProxy);
+ QCOMPARE(obj1.type(), QNetworkProxy::DefaultProxy);
+ obj1.setType(QNetworkProxy::HttpProxy);
+ QCOMPARE(obj1.type(), QNetworkProxy::HttpProxy);
+ obj1.setType(QNetworkProxy::Socks5Proxy);
+ QCOMPARE(obj1.type(), QNetworkProxy::Socks5Proxy);
+}
+
+void tst_QNetworkProxy::capabilitiesPerType()
+{
+ QNetworkProxy proxy(QNetworkProxy::Socks5Proxy);
+ QVERIFY(proxy.capabilities() & QNetworkProxy::TunnelingCapability);
+ QVERIFY(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability);
+ QVERIFY(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability);
+
+ proxy.setType(QNetworkProxy::NoProxy);
+ // verify that the capabilities changed
+ QVERIFY(!(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability));
+ QVERIFY(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability);
+
+ proxy.setType(QNetworkProxy::HttpProxy);
+ QVERIFY(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability);
+ QVERIFY(!(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability));
+
+ // now set the capabilities on stone:
+ proxy.setCapabilities(QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability);
+ QCOMPARE(proxy.capabilities(), QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability);
+
+ // changing the type shouldn't change the capabilities any more
+ proxy.setType(QNetworkProxy::Socks5Proxy);
+ QCOMPARE(proxy.capabilities(), QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability);
}
QTEST_MAIN(tst_QNetworkProxy)
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 8b43f9b..87f9c13 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -225,6 +225,8 @@ private slots:
void extendedBlendModes();
+ void zeroOpacity();
+
private:
void fillData();
QColor baseColor( int k, int intensity=255 );
@@ -3792,8 +3794,11 @@ void tst_QPainter::imageBlending()
void tst_QPainter::paintOnNullPixmap()
{
+ QPixmap pix(16, 16);
+
QPixmap textPixmap;
QPainter p(&textPixmap);
+ p.drawPixmap(10, 10, pix);
p.end();
QPixmap textPixmap2(16,16);
@@ -4147,5 +4152,21 @@ void tst_QPainter::extendedBlendModes()
QVERIFY(testCompositionMode(191, 191, 96, QPainter::CompositionMode_Exclusion));
}
+void tst_QPainter::zeroOpacity()
+{
+ QImage source(1, 1, QImage::Format_ARGB32_Premultiplied);
+ source.fill(0xffffffff);
+
+ QImage target(1, 1, QImage::Format_RGB32);
+ target.fill(0xff000000);
+
+ QPainter p(&target);
+ p.setOpacity(0.0);
+ p.drawImage(0, 0, source);
+ p.end();
+
+ QCOMPARE(target.pixel(0, 0), 0xff000000);
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"
diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
index c163b52..1f515ff 100644
--- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
@@ -166,6 +166,16 @@ void tst_QPixmapCache::insert()
QVERIFY(estimatedNum - 1 <= num <= estimatedNum + 1);
QPixmap p3;
QPixmapCache::insert("null", p3);
+
+ QPixmap c1(10, 10);
+ c1.fill(Qt::yellow);
+ QPixmapCache::insert("custom", c1);
+ QVERIFY(!c1.isDetached());
+ QPixmap c2(10, 10);
+ c2.fill(Qt::red);
+ QPixmapCache::insert("custom", c2);
+ //We have deleted the old pixmap in the cache for the same key
+ QVERIFY(c1.isDetached());
}
void tst_QPixmapCache::remove()
diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp
index a598bfc..cde4ae5 100644
--- a/tests/auto/qprinter/tst_qprinter.cpp
+++ b/tests/auto/qprinter/tst_qprinter.cpp
@@ -103,6 +103,7 @@ private slots:
void valuePreservation();
void errorReporting();
void testCustomPageSizes();
+ void printDialogCompleter();
private:
};
@@ -940,5 +941,22 @@ void tst_QPrinter::testCustomPageSizes()
QCOMPARE(paperSize, customSize);
}
+void tst_QPrinter::printDialogCompleter()
+{
+#if defined(QT_NO_COMPLETER) || defined(QT_NO_FILEDIALOG)
+ QSKIP("QT_NO_COMPLETER || QT_NO_FILEDIALOG: Auto-complete turned off in QPrinterDialog.", QTest::SkipAll);
+#else
+ QPrintDialog dialog;
+ dialog.printer()->setOutputFileName("file.pdf");
+ dialog.setEnabledOptions(QAbstractPrintDialog::PrintToFile);
+ dialog.show();
+
+ QTest::qWait(100);
+
+ QTest::keyClick(0, Qt::Key_Tab);
+ QTest::keyClick(0, 'P');
+#endif
+}
+
QTEST_MAIN(tst_QPrinter)
#include "tst_qprinter.moc"
diff --git a/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp b/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
index 1413b0d..257ec0b 100644
--- a/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
+++ b/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
@@ -68,6 +68,7 @@ private slots:
void iterateString();
void iterateGetterSetter();
void iterateArgumentsObject();
+ void assignObjectToIterator();
void undefinedBehavior();
};
@@ -562,5 +563,37 @@ void tst_QScriptValueIterator::undefinedBehavior()
QVERIFY(it.value().isNumber());
}
+void tst_QScriptValueIterator::assignObjectToIterator()
+{
+ QScriptEngine eng;
+ QScriptValue obj1 = eng.newObject();
+ obj1.setProperty("foo", 123);
+ QScriptValue obj2 = eng.newObject();
+ obj2.setProperty("bar", 456);
+
+ QScriptValueIterator it(obj1);
+ QVERIFY(it.hasNext());
+ it.next();
+ it = obj2;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+
+ it = obj1;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("foo"));
+
+ it = obj2;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+
+ it = obj2;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+}
+
QTEST_MAIN(tst_QScriptValueIterator)
#include "tst_qscriptvalueiterator.moc"
diff --git a/tests/auto/qsidebar/tst_qsidebar.cpp b/tests/auto/qsidebar/tst_qsidebar.cpp
index 7a262e6..705e222 100644
--- a/tests/auto/qsidebar/tst_qsidebar.cpp
+++ b/tests/auto/qsidebar/tst_qsidebar.cpp
@@ -176,6 +176,32 @@ void tst_QSidebar::addUrls()
qsidebar.addUrls(urls, -1);
qsidebar.addUrls(moreUrls, -1);
QCOMPARE(qsidebar.urls()[0], urls[0]);
+
+ QList<QUrl> doubleUrls;
+ //tow exact same paths, we have only one entry
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath());
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath());
+ qsidebar.setUrls(emptyUrls);
+ qsidebar.addUrls(doubleUrls, 1);
+ QCOMPARE(qsidebar.urls().size(), 1);
+
+#if defined(Q_OS_WIN)
+ //Windows is case insensitive so no duplicate entries in that case
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath());
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath().toUpper());
+ qsidebar.setUrls(emptyUrls);
+ qsidebar.addUrls(doubleUrls, 1);
+ QCOMPARE(qsidebar.urls().size(), 1);
+#else
+ //Two different paths we should have two entries
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath());
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath().toUpper());
+ qsidebar.setUrls(emptyUrls);
+ qsidebar.addUrls(doubleUrls, 1);
+ QCOMPARE(qsidebar.urls().size(), 2);
+#endif
+
+
}
void tst_QSidebar::goToUrl()
diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 18aa5fc..bd66fdf 100644
--- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -133,6 +133,7 @@ private slots:
void task248868_dynamicSorting();
void task250023_fetchMore();
void task251296_hiddenChildren();
+ void task252507_mapFromToSource();
protected:
void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
@@ -2612,6 +2613,7 @@ class QtTestModel: public QAbstractItemModel
return fetched.contains(parent) ? rows : 0;
}
int columnCount(const QModelIndex& parent = QModelIndex()) const {
+ Q_UNUSED(parent);
return cols;
}
@@ -2717,6 +2719,22 @@ void tst_QSortFilterProxyModel::task251296_hiddenChildren()
QCOMPARE(proxy.data(indexC).toString(), QString::fromLatin1("C VISIBLE"));
}
+void tst_QSortFilterProxyModel::task252507_mapFromToSource()
+{
+ QtTestModel source(10,10);
+ source.fetchMore(QModelIndex());
+ QSortFilterProxyModel proxy;
+ proxy.setSourceModel(&source);
+ QCOMPARE(proxy.mapFromSource(source.index(5, 4)), proxy.index(5, 4));
+ QCOMPARE(proxy.mapToSource(proxy.index(3, 2)), source.index(3, 2));
+ QCOMPARE(proxy.mapFromSource(QModelIndex()), QModelIndex());
+ QCOMPARE(proxy.mapToSource(QModelIndex()), QModelIndex());
+
+ QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapToSource ");
+ QCOMPARE(proxy.mapToSource(source.index(2, 3)), QModelIndex());
+ QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapFromSource ");
+ QCOMPARE(proxy.mapFromSource(proxy.index(6, 2)), QModelIndex());
+}
QTEST_MAIN(tst_QSortFilterProxyModel)
#include "tst_qsortfilterproxymodel.moc"
diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h
index 611077f..ef51285 100644
--- a/tests/auto/qsqldatabase/tst_databases.h
+++ b/tests/auto/qsqldatabase/tst_databases.h
@@ -217,7 +217,7 @@ public:
// addDb( "QMYSQL3", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 3309, "CLIENT_COMPRESS=1;CLIENT_SSL=1" ); // MySQL 5.0.18 Linux
// addDb( "QMYSQL3", "testdb", "troll", "trond", "iceblink.nokia.troll.no" ); // MySQL 5.0.13 Windows
// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql4-nokia.trolltech.com.au" ); // MySQL 4.1.22-2.el4 linux
-// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql5-nokia.trolltech.com.au" ); // MySQL 5.0.45-7.el5 linux
+// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql5-nokia.trolltech.com.au" ); // MySQL 5.0.45-7.el5 linux
// addDb( "QPSQL7", "testdb", "troll", "trond", "horsehead.nokia.troll.no" ); // V7.2 NOT SUPPORTED!
// addDb( "QPSQL7", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 5434 ); // V7.2 NOT SUPPORTED! Multi-byte
@@ -238,14 +238,15 @@ public:
// addDb( "QIBASE", "/opt/firebird/databases/testdb.fdb", "testuser", "Ee4Gabf6_", "firebird2-nokia.trolltech.com.au" ); // Firebird 2.1.1
// use in-memory database to prevent local files
- addDb("QSQLITE", ":memory:");
-// addDb( "QSQLITE", QDir::toNativeSeparators(QDir::tempPath()+"/foo.db") );
+// addDb("QSQLITE", ":memory:");
+ addDb( "QSQLITE", QDir::toNativeSeparators(QDir::tempPath()+"/foo.db") );
// addDb( "QSQLITE2", QDir::toNativeSeparators(QDir::tempPath()+"/foo2.db") );
// addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=iceblink.nokia.troll.no\\ICEBLINK", "troll", "trond", "" );
// addDb( "QODBC3", "DRIVER={SQL Native Client};SERVER=silence.nokia.troll.no\\SQLEXPRESS", "troll", "trond", "" );
-// addDb( "QODBC", "DRIVER={MySQL ODBC 3.51 Driver};SERVER=mysql5-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" );
-// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=horsehead.nokia.troll.no;DATABASE=testdb;PORT=4101;UID=troll;PWD=trondk", "troll", "trondk", "" );
+// addDb( "QODBC", "DRIVER={MySQL ODBC 3.51 Driver};SERVER=mysql5-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" );
+// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=horsehead.nokia.troll.no;DATABASE=testdb;PORT=4101;UID=troll;PWD=trondk", "troll", "trondk", "" );
+// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=silence.nokia.troll.no;DATABASE=testdb;PORT=2392;UID=troll;PWD=trond", "troll", "trond", "" );
}
@@ -312,17 +313,21 @@ public:
QSqlQuery q( db );
QStringList dbtables=db.tables();
- foreach(QString tableName, tableNames)
+ foreach(const QString &tableName, tableNames)
{
wasDropped = true;
QString table=tableName;
if ( db.driver()->isIdentifierEscaped(table, QSqlDriver::TableName))
table = db.driver()->stripDelimiters(table, QSqlDriver::TableName);
- if ( dbtables.contains( table, Qt::CaseSensitive ) )
- wasDropped = q.exec( "drop table " + tableName);
- else if ( dbtables.contains( table, Qt::CaseInsensitive ) )
- wasDropped = q.exec( "drop table " + tableName);
+ foreach(const QString dbtablesName, dbtables) {
+ if(dbtablesName.toUpper() == table.toUpper()) {
+ dbtables.removeAll(dbtablesName);
+ wasDropped = q.exec("drop table " + db.driver()->escapeIdentifier( dbtablesName, QSqlDriver::TableName ));
+ if(!wasDropped)
+ wasDropped = q.exec("drop table " + dbtablesName);
+ }
+ }
if ( !wasDropped )
qWarning() << dbToString(db) << "unable to drop table" << tableName << ':' << q.lastError().text() << "tables:" << dbtables;
@@ -396,12 +401,26 @@ public:
static QByteArray printError( const QSqlError& err )
{
- return QString( "'" + err.driverText() + "' || '" + err.databaseText() + "'" ).toLocal8Bit();
+ QString result;
+ if(err.number() > 0)
+ result += '(' + QString::number(err.number()) + ") ";
+ result += '\'';
+ if(!err.driverText().isEmpty())
+ result += err.driverText() + "' || '";
+ result += err.databaseText() + "'";
+ return result.toLocal8Bit();
}
static QByteArray printError( const QSqlError& err, const QSqlDatabase& db )
{
- return QString( dbToString(db) + ": '" + err.driverText() + "' || '" + err.databaseText() + "'" ).toLocal8Bit();
+ QString result(dbToString(db) + ": ");
+ if(err.number() > 0)
+ result += '(' + QString::number(err.number()) + ") ";
+ result += '\'';
+ if(!err.driverText().isEmpty())
+ result += err.driverText() + "' || '";
+ result += err.databaseText() + "'";
+ return result.toLocal8Bit();
}
static bool isSqlServer( QSqlDatabase db )
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index 8dede12..4fa3dc4 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -517,6 +517,8 @@ void tst_QSqlDatabase::tables()
// MySQL doesn't give back anything when calling QSqlDatabase::tables() with QSql::Views
// May be fixable by doing a select on informational_schema.views instead of using the client library api
QEXPECT_FAIL("", "MySQL driver thinks that views are tables", Continue);
+ if(!tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive))
+ qDebug() << "failed to find" << qTableName("qtest_view") << "in" << tables;
QVERIFY(tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive));
}
if (tempTables)
@@ -1880,17 +1882,26 @@ void tst_QSqlDatabase::ibase_procWithReturnValues()
"\nRESULT INTEGER)"
"\nAS"
"\nbegin"
- "\nRESULT = 10;"
+ "\nRESULT = 10 * ABC;"
"\nsuspend;"
"\nend"));
// Interbase procedures can be executed in two ways: EXECUTE PROCEDURE or SELECT
QVERIFY_SQL(q, exec(QString("execute procedure %1(123)").arg(procName)));
QVERIFY_SQL(q, next());
- QCOMPARE(q.value(0).toInt(), 10);
+ QCOMPARE(q.value(0).toInt(), 1230);
QVERIFY_SQL(q, exec(QString("select result from %1(456)").arg(procName)));
QVERIFY_SQL(q, next());
- QCOMPARE(q.value(0).toInt(), 10);
+ QCOMPARE(q.value(0).toInt(), 4560);
+ QVERIFY_SQL(q, prepare(QLatin1String("execute procedure ")+procName+QLatin1String("(?)")));
+ q.bindValue(0, 123);
+ QVERIFY_SQL(q, exec());
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 1230);
+ q.bindValue(0, 456);
+ QVERIFY_SQL(q, exec());
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 4560);
q.exec(QString("drop procedure %1").arg(procName));
}
@@ -2276,7 +2287,7 @@ void tst_QSqlDatabase::db2_valueCacheUpdate()
void tst_QSqlDatabase::sqlStatementUseIsNull_189093()
{
- // NULL = NULL is unknow, the sqlStatment must use IS NULL
+ // NULL = NULL is unknown, the sqlStatment must use IS NULL
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
index aa63753..24ccecf 100644
--- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -605,8 +605,9 @@ void tst_QStyleSheetStyle::palettePropagation()
QVERIFY(COLOR(gb) == Qt::red);
QVERIFY(COLOR(pb) == APPCOLOR(pb)); // palette shouldn't propagate
gb.setStyleSheet("QGroupBox * { color: red }");
+
QVERIFY(COLOR(pb) == Qt::red);
- QVERIFY(COLOR(gb) == APPCOLOR(pb));
+ QVERIFY(COLOR(gb) == APPCOLOR(gb));
QWidget window;
window.setStyleSheet("* { color: white; }");
diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
index 4a17031..4da99da 100644
--- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
+++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
@@ -534,16 +534,42 @@ void tst_QSvgRenderer::gradientStops() const
QCOMPARE(image, refImage);
}
+ const char *svgs[] = {
+ "<svg>"
+ "<defs>"
+ "<linearGradient id=\"gradient\">"
+ "<stop offset=\"0\" stop-color=\"red\" stop-opacity=\"0\"/>"
+ "<stop offset=\"1\" stop-color=\"blue\"/>"
+ "</linearGradient>"
+ "</defs>"
+ "<rect fill=\"url(#gradient)\" height=\"8\" width=\"256\" x=\"0\" y=\"0\"/>"
+ "</svg>",
+ "<svg>"
+ "<defs>"
+ "<linearGradient id=\"gradient\" xlink:href=\"#gradient0\">"
+ "</linearGradient>"
+ "<linearGradient id=\"gradient0\">"
+ "<stop offset=\"0\" stop-color=\"red\" stop-opacity=\"0\"/>"
+ "<stop offset=\"1\" stop-color=\"blue\"/>"
+ "</linearGradient>"
+ "</defs>"
+ "<rect fill=\"url(#gradient)\" height=\"8\" width=\"256\" x=\"0\" y=\"0\"/>"
+ "</svg>",
+ "<svg>"
+ "<defs>"
+ "<linearGradient id=\"gradient0\">"
+ "<stop offset=\"0\" stop-color=\"red\" stop-opacity=\"0\"/>"
+ "<stop offset=\"1\" stop-color=\"blue\"/>"
+ "</linearGradient>"
+ "<linearGradient id=\"gradient\" xlink:href=\"#gradient0\">"
+ "</linearGradient>"
+ "</defs>"
+ "<rect fill=\"url(#gradient)\" height=\"8\" width=\"256\" x=\"0\" y=\"0\"/>"
+ "</svg>"
+ };
+ for (int i = 0 ; i < sizeof(svgs) / sizeof(svgs[0]) ; ++i)
{
- QByteArray data("<svg>"
- "<defs>"
- "<linearGradient id=\"gradient\">"
- "<stop offset=\"0\" stop-color=\"red\" stop-opacity=\"0\"/>"
- "<stop offset=\"1\" stop-color=\"blue\"/>"
- "</linearGradient>"
- "</defs>"
- "<rect fill=\"url(#gradient)\" height=\"8\" width=\"256\" x=\"0\" y=\"0\"/>"
- "</svg>");
+ QByteArray data = svgs[i];
QSvgRenderer renderer(data);
QImage image(256, 8, QImage::Format_ARGB32_Premultiplied);
diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp
index 433eb86..31722de 100644
--- a/tests/auto/qtabbar/tst_qtabbar.cpp
+++ b/tests/auto/qtabbar/tst_qtabbar.cpp
@@ -92,6 +92,8 @@ private slots:
void moveTab_data();
void moveTab();
+
+ void task251184_removeTab();
};
// Testing get/set functions
@@ -503,5 +505,35 @@ void tst_QTabBar::moveTab()
bar.callMoveTab(from, to);
}
+
+class MyTabBar : public QTabBar
+{
+ Q_OBJECT
+public slots:
+ void onCurrentChanged()
+ {
+ //we just want this to be done once
+ disconnect(this, SIGNAL(currentChanged(int)), this, SLOT(onCurrentChanged()));
+ removeTab(0);
+ }
+};
+
+void tst_QTabBar::task251184_removeTab()
+{
+ MyTabBar bar;
+ bar.addTab("bar1");
+ bar.addTab("bar2");
+ QCOMPARE(bar.count(), 2);
+ QCOMPARE(bar.currentIndex(), 0);
+
+ bar.connect(&bar, SIGNAL(currentChanged(int)), SLOT(onCurrentChanged()));
+ bar.setCurrentIndex(1);
+
+ QCOMPARE(bar.count(), 1);
+ QCOMPARE(bar.currentIndex(), 0);
+ QCOMPARE(bar.tabText(bar.currentIndex()), QString("bar2"));
+}
+
+
QTEST_MAIN(tst_QTabBar)
#include "tst_qtabbar.moc"
diff --git a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp
index 139eb6e..116f46e 100644
--- a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp
+++ b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp
@@ -74,6 +74,7 @@ private slots:
void incrementalResults();
void noDetatch();
void stlContainers();
+ void qFutureAssignmentLeak();
void stressTest();
public slots:
void throttling();
@@ -2323,6 +2324,36 @@ void tst_map::stlContainers()
#endif
}
+InstanceCounter ic_fn(const InstanceCounter & ic)
+{
+ return InstanceCounter(ic);
+};
+
+// Verify that held results are deleted when a future is
+// assigned over with operator ==
+void tst_map::qFutureAssignmentLeak()
+{
+ currentInstanceCount = 0;
+ peakInstanceCount = 0;
+ QFuture<InstanceCounter> future;
+ {
+ QList<InstanceCounter> list;
+ for (int i=0;i<1000;++i)
+ list += InstanceCounter();
+ future = QtConcurrent::mapped(list, ic_fn);
+ future.waitForFinished();
+
+ future = QtConcurrent::mapped(list, ic_fn);
+ future.waitForFinished();
+
+ future = QtConcurrent::mapped(list, ic_fn);
+ future.waitForFinished();
+ }
+
+ QCOMPARE(int(currentInstanceCount), 1000);
+ future = QFuture<InstanceCounter>();
+ QCOMPARE(int(currentInstanceCount), 0);
+}
inline void increment(int &num)
{
diff --git a/tests/auto/qtemporaryfile/qtemporaryfile.pro b/tests/auto/qtemporaryfile/qtemporaryfile.pro
index 0c90994..bde990a 100644
--- a/tests/auto/qtemporaryfile/qtemporaryfile.pro
+++ b/tests/auto/qtemporaryfile/qtemporaryfile.pro
@@ -2,5 +2,4 @@ load(qttest_p4)
SOURCES += tst_qtemporaryfile.cpp
QT = core
-
-
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
index f5155ae..2daa0f6 100644
--- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -51,6 +51,13 @@
#if defined(Q_OS_WIN)
# include <windows.h>
#endif
+#if defined(Q_OS_UNIX)
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <errno.h>
+# include <fcntl.h> // open(2)
+# include <unistd.h> // close(2)
+#endif
//TESTED_CLASS=
//TESTED_FILES=
@@ -78,6 +85,7 @@ private slots:
void openOnRootDrives();
void stressTest();
void rename();
+ void renameFdLeak();
public:
};
@@ -356,5 +364,42 @@ void tst_QTemporaryFile::rename()
QVERIFY(!dir.exists("temporary-file.txt"));
}
+void tst_QTemporaryFile::renameFdLeak()
+{
+#ifdef Q_OS_UNIX
+ // Test this on Unix only
+
+ // Open a bunch of files to force the fd count to go up
+ static const int count = 10;
+ int bunch_of_files[count];
+ for (int i = 0; i < count; ++i) {
+ bunch_of_files[i] = ::open(SRCDIR "tst_qtemporaryfile.cpp", O_RDONLY);
+ QVERIFY(bunch_of_files[i] != -1);
+ }
+
+ int fd;
+ {
+ QTemporaryFile file;
+ file.setAutoRemove(false);
+ QVERIFY(file.open());
+
+ // close the bunch of files
+ for (int i = 0; i < count; ++i)
+ ::close(bunch_of_files[i]);
+
+ // save the file descriptor for later
+ fd = file.handle();
+
+ // rename the file to something
+ QString newPath = QDir::tempPath() + "/tst_qtemporaryfile-renameFdLeak-" + QString::number(getpid());
+ file.rename(newPath);
+ QFile::remove(newPath);
+ }
+
+ // check if QTemporaryFile closed the file
+ QVERIFY(::close(fd) == -1 && errno == EBADF);
+#endif
+}
+
QTEST_MAIN(tst_QTemporaryFile)
#include "tst_qtemporaryfile.moc"
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index b1bfb86..cf4135b 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -68,6 +68,8 @@ private slots:
void flagEFBFBF() const;
void decode0D() const;
void codecForIndex() const;
+ void aliasForUTF16() const;
+ void mibForTSCII() const;
void utf8Codec_data();
void utf8Codec();
@@ -453,6 +455,16 @@ void tst_QTextCodec::codecForIndex() const
{
}
+void tst_QTextCodec::aliasForUTF16() const
+{
+ QVERIFY(QTextCodec::codecForName("UTF-16")->aliases().isEmpty());
+}
+
+void tst_QTextCodec::mibForTSCII() const
+{
+ QCOMPARE(QTextCodec::codecForName("TSCII")->mibEnum(), 2107);
+}
+
static QString fromInvalidUtf8Sequence(const QByteArray &ba)
{
return QString().fill(QChar::ReplacementCharacter, ba.size());
diff --git a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
index 6edaee3..46f5f0c 100644
--- a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
+++ b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
@@ -2309,7 +2309,7 @@ void tst_QTextDocumentFragment::html_tbody()
QVERIFY(table);
QCOMPARE(table->columns(), 1);
QCOMPARE(table->rows(), 2);
- QVERIFY(table->format().headerRowCount(), 1);
+ QCOMPARE(table->format().headerRowCount(), 1);
QCOMPARE(table->cellAt(0, 0).firstCursorPosition().block().text(), QString("First Cell"));
QCOMPARE(table->cellAt(1, 0).firstCursorPosition().block().text(), QString("Second Cell"));
}
diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/qtransform/tst_qtransform.cpp
index 8516ddb..74c405e 100644
--- a/tests/auto/qtransform/tst_qtransform.cpp
+++ b/tests/auto/qtransform/tst_qtransform.cpp
@@ -593,6 +593,16 @@ void tst_QTransform::types()
m3.translate(5.0f, 5.0f);
QCOMPARE(m3.type(), QTransform::TxScale);
QCOMPARE(m3.inverted().type(), QTransform::TxScale);
+
+ m3.setMatrix(1.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 2.0f);
+ QCOMPARE(m3.type(), QTransform::TxProject);
+
+ m3.setMatrix(0.0f, 2.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 2.0f);
+ QCOMPARE(m3.type(), QTransform::TxProject);
}
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index a052034..5896df9 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -283,6 +283,11 @@ private slots:
void render_task217815();
void render_windowOpacity();
void render_systemClip();
+ void render_systemClip2_data();
+ void render_systemClip2();
+ void render_systemClip3_data();
+ void render_systemClip3();
+ void render_task252837();
void setContentsMargins();
@@ -6897,6 +6902,212 @@ void tst_QWidget::render_systemClip()
#endif
}
+void tst_QWidget::render_systemClip2_data()
+{
+ QTest::addColumn<bool>("autoFillBackground");
+ QTest::addColumn<bool>("usePaintEvent");
+ QTest::addColumn<QColor>("expectedColor");
+
+ QTest::newRow("Only auto-fill background") << true << false << QColor(Qt::blue);
+ QTest::newRow("Only draw in paintEvent") << false << true << QColor(Qt::green);
+ QTest::newRow("Auto-fill background and draw in paintEvent") << true << true << QColor(Qt::green);
+}
+
+void tst_QWidget::render_systemClip2()
+{
+ QFETCH(bool, autoFillBackground);
+ QFETCH(bool, usePaintEvent);
+ QFETCH(QColor, expectedColor);
+
+ Q_ASSERT_X(expectedColor != QColor(Qt::red), Q_FUNC_INFO,
+ "Qt::red is the reference color for the image, pick another color");
+
+ class MyWidget : public QWidget
+ {
+ public:
+ bool usePaintEvent;
+ void paintEvent(QPaintEvent *)
+ {
+ if (usePaintEvent)
+ QPainter(this).fillRect(rect(), Qt::green);
+ }
+ };
+
+ MyWidget widget;
+ widget.usePaintEvent = usePaintEvent;
+ widget.setPalette(Qt::blue);
+ // NB! widget.setAutoFillBackground(autoFillBackground) won't do the
+ // trick here since the widget is a top-level. The background is filled
+ // regardless, unless Qt::WA_OpaquePaintEvent or Qt::WA_NoSystemBackground
+ // is set. We therefore use the opaque attribute to turn off auto-fill.
+ if (!autoFillBackground)
+ widget.setAttribute(Qt::WA_OpaquePaintEvent);
+ widget.resize(100, 100);
+
+ QImage image(widget.size(), QImage::Format_RGB32);
+ image.fill(QColor(Qt::red).rgb());
+
+ QPaintEngine *paintEngine = image.paintEngine();
+ QVERIFY(paintEngine);
+
+ QRegion systemClip(QRegion(50, 0, 50, 10));
+ systemClip += QRegion(90, 10, 10, 40);
+ paintEngine->setSystemClip(systemClip);
+
+ // Render entire widget directly onto device.
+ widget.render(&image);
+
+#ifdef RENDER_DEBUG
+ image.save("systemclip_with_device.png");
+#endif
+ // All pixels within the system clip should now be
+ // the expectedColor, and the rest should be red.
+ for (int i = 0; i < image.height(); ++i) {
+ for (int j = 0; j < image.width(); ++j) {
+ if (systemClip.contains(QPoint(j, i)))
+ QCOMPARE(image.pixel(j, i), expectedColor.rgb());
+ else
+ QCOMPARE(image.pixel(j, i), QColor(Qt::red).rgb());
+ }
+ }
+
+ // Refill image with red.
+ image.fill(QColor(Qt::red).rgb());
+ paintEngine->setSystemClip(systemClip);
+
+ // Do the same with an untransformed painter.
+ QPainter painter(&image);
+ //Make sure we're using the same paint engine and has the right clip set.
+ QCOMPARE(painter.paintEngine(), paintEngine);
+ QCOMPARE(paintEngine->systemClip(), systemClip);
+
+ widget.render(&painter);
+
+#ifdef RENDER_DEBUG
+ image.save("systemclip_with_untransformed_painter.png");
+#endif
+ // All pixels within the system clip should now be
+ // the expectedColor, and the rest should be red.
+ for (int i = 0; i < image.height(); ++i) {
+ for (int j = 0; j < image.width(); ++j) {
+ if (systemClip.contains(QPoint(j, i)))
+ QCOMPARE(image.pixel(j, i), expectedColor.rgb());
+ else
+ QCOMPARE(image.pixel(j, i), QColor(Qt::red).rgb());
+ }
+ }
+}
+
+void tst_QWidget::render_systemClip3_data()
+{
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<bool>("useSystemClip");
+
+ // Reference: http://en.wikipedia.org/wiki/Flag_of_Norway
+ QTest::newRow("Norwegian Civil Flag") << QSize(220, 160) << false;
+ QTest::newRow("Norwegian War Flag") << QSize(270, 160) << true;
+}
+
+// This test ensures that the current engine clip (systemClip + painter clip)
+// is preserved after QPainter::setClipRegion(..., Qt::ReplaceClip);
+void tst_QWidget::render_systemClip3()
+{
+ QFETCH(QSize, size);
+ QFETCH(bool, useSystemClip);
+
+ // Calculate the inner/outer cross of the flag.
+ QRegion outerCross(0, 0, size.width(), size.height());
+ outerCross -= QRect(0, 0, 60, 60);
+ outerCross -= QRect(100, 0, size.width() - 100, 60);
+ outerCross -= QRect(0, 100, 60, 60);
+ outerCross -= QRect(100, 100, size.width() - 100, 60);
+
+ QRegion innerCross(0, 0, size.width(), size.height());
+ innerCross -= QRect(0, 0, 70, 70);
+ innerCross -= QRect(90, 0, size.width() - 90, 70);
+ innerCross -= QRect(0, 90, 70, 70);
+ innerCross -= QRect(90, 90, size.width() - 90, 70);
+
+ const QRegion redArea(QRegion(0, 0, size.width(), size.height()) - outerCross);
+ const QRegion whiteArea(outerCross - innerCross);
+ const QRegion blueArea(innerCross);
+ QRegion systemClip;
+
+ // Okay, here's the image that should look like a Norwegian civil/war flag in the end.
+ QImage flag(size, QImage::Format_ARGB32);
+ flag.fill(QColor(Qt::transparent).rgba());
+
+ if (useSystemClip) {
+ QPainterPath warClip(QPoint(size.width(), 0));
+ warClip.lineTo(size.width() - 110, 60);
+ warClip.lineTo(size.width(), 80);
+ warClip.lineTo(size.width() - 110, 100);
+ warClip.lineTo(size.width(), 160);
+ warClip.closeSubpath();
+ systemClip = QRegion(0, 0, size.width(), size.height()) - QRegion(warClip.toFillPolygon().toPolygon());
+ flag.paintEngine()->setSystemClip(systemClip);
+ }
+
+ QPainter painter(&flag);
+ painter.fillRect(QRect(QPoint(), size), Qt::red); // Fill image background with red.
+ painter.setClipRegion(outerCross); // Limit widget painting to inside the outer cross.
+
+ // Here's the widget that's supposed to draw the inner/outer cross of the flag.
+ // The outer cross (white) should be drawn when the background is auto-filled, and
+ // the inner cross (blue) should be drawn in the paintEvent.
+ class MyWidget : public QWidget
+ { public:
+ void paintEvent(QPaintEvent *)
+ {
+ QPainter painter(this);
+ // Be evil and try to paint outside the outer cross. This should not be
+ // possible since the shared painter is clipped to the outer cross.
+ painter.setClipRect(0, 0, 60, 60, Qt::ReplaceClip);
+ painter.fillRect(rect(), Qt::green);
+ painter.setClipRegion(clip, Qt::ReplaceClip);
+ painter.fillRect(rect(), Qt::blue);
+ }
+ QRegion clip;
+ };
+
+ MyWidget widget;
+ widget.clip = innerCross;
+ widget.setFixedSize(size);
+ widget.setPalette(Qt::white);
+ widget.setAutoFillBackground(true);
+ widget.render(&painter);
+
+#ifdef RENDER_DEBUG
+ flag.save("flag.png");
+#endif
+
+ // Let's make sure we got a Norwegian flag.
+ for (int i = 0; i < flag.height(); ++i) {
+ for (int j = 0; j < flag.width(); ++j) {
+ const QPoint pixel(j, i);
+ const QRgb pixelValue = flag.pixel(pixel);
+ if (useSystemClip && !systemClip.contains(pixel))
+ QCOMPARE(pixelValue, QColor(Qt::transparent).rgba());
+ else if (redArea.contains(pixel))
+ QCOMPARE(pixelValue, QColor(Qt::red).rgba());
+ else if (whiteArea.contains(pixel))
+ QCOMPARE(pixelValue, QColor(Qt::white).rgba());
+ else
+ QCOMPARE(pixelValue, QColor(Qt::blue).rgba());
+ }
+ }
+}
+
+void tst_QWidget::render_task252837()
+{
+ QWidget widget;
+ widget.resize(200, 200);
+
+ QPixmap pixmap(widget.size());
+ QPainter painter(&pixmap);
+ // Please do not crash.
+ widget.render(&painter);
+}
void tst_QWidget::setContentsMargins()
{
QLabel label("why does it always rain on me?");
diff --git a/tests/auto/qxmlstream/XML-Test-Suite-LICENSE.txt b/tests/auto/qxmlstream/XML-Test-Suite-LICENSE.txt
new file mode 100644
index 0000000..bd84fae
--- /dev/null
+++ b/tests/auto/qxmlstream/XML-Test-Suite-LICENSE.txt
@@ -0,0 +1,59 @@
+The XML testsuite available here is a copy of the Extensible Markup
+Language (XML) Conformance Test Suites provided by W3C. Please see
+http://www.w3.org/XML/Test/ for updates and other information.
+
+These files are licensed under the W3C Software License (19980720),
+reproduced below:
+
+---
+W3C® SOFTWARE NOTICE AND LICENSE
+
+Copyright © 1994-2002 World Wide Web Consortium, (Massachusetts
+Institute of Technology, Institut National de Recherche en
+Informatique et en Automatique, Keio University). All Rights
+Reserved. http://www.w3.org/Consortium/Legal/
+
+This W3C work (including software, documents, or other related items)
+is being provided by the copyright holders under the following
+license. By obtaining, using and/or copying this work, you (the
+licensee) agree that you have read, understood, and will comply with
+the following terms and conditions:
+
+Permission to use, copy, modify, and distribute this software and its
+documentation, with or without modification, for any purpose and
+without fee or royalty is hereby granted, provided that you include
+the following on ALL copies of the software and documentation or
+portions thereof, including modifications, that you make:
+
+ 1. The full text of this NOTICE in a location viewable to users of
+ the redistributed or derivative work.
+
+ 2. Any pre-existing intellectual property disclaimers, notices, or
+ terms and conditions. If none exist, a short notice of the
+ following form (hypertext is preferred, text is permitted) should
+ be used within the body of any redistributed or derivative code:
+ "Copyright © [$date-of-software] World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. http://www.w3.org/Consortium/Legal/"
+
+ 3. Notice of any changes or modifications to the W3C files, including
+ the date changes were made. (We recommend you provide URIs to the
+ location from which the code is derived.)
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
+HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
+INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR
+DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
+TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL
+OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+DOCUMENTATION.
+
+The name and trademarks of copyright holders may NOT be used in
+advertising or publicity pertaining to the software without specific,
+written prior permission. Title to copyright in this software and any
+associated documentation will at all times remain with copyright
+holders.
diff --git a/tests/auto/utf8/tst_utf8.cpp b/tests/auto/utf8/tst_utf8.cpp
new file mode 100644
index 0000000..3aef69f
--- /dev/null
+++ b/tests/auto/utf8/tst_utf8.cpp
@@ -0,0 +1,309 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+
+#include <qtextcodec.h>
+#include <qsharedpointer.h>
+
+//TESTED_CLASS=
+//TESTED_FILES=
+
+static const char utf8bom[] = "\xEF\xBB\xBF";
+
+class tst_Utf8 : public QObject
+{
+ Q_OBJECT
+
+public:
+ // test data:
+ QTextCodec *codec;
+ QString (*from8BitPtr)(const char *, int);
+ QByteArray (QString:: *to8Bit)() const;
+
+ inline QString from8Bit(const QByteArray &ba)
+ { return from8BitPtr(ba.constData(), ba.length()); }
+public slots:
+ void initTestCase();
+ void init();
+
+private slots:
+ void roundTrip_data();
+ void roundTrip();
+
+ void charByChar_data();
+ void charByChar();
+
+ void invalidUtf8_data();
+ void invalidUtf8();
+};
+
+void tst_Utf8::initTestCase()
+{
+ QTest::addColumn<bool>("useLocale");
+ QTest::newRow("utf8codec") << false;
+
+ // is the locale UTF-8?
+ if (QString(QChar(QChar::ReplacementCharacter)).toLocal8Bit() == "\xEF\xBF\xBD") {
+ QTest::newRow("localecodec") << true;
+ qDebug() << "locale is utf8";
+ }
+}
+
+void tst_Utf8::init()
+{
+ QFETCH_GLOBAL(bool, useLocale);
+ if (useLocale) {
+ codec = QTextCodec::codecForLocale();
+ from8BitPtr = &QString::fromLocal8Bit;
+ to8Bit = &QString::toLocal8Bit;
+ } else {
+ codec = QTextCodec::codecForMib(106);
+ from8BitPtr = &QString::fromUtf8;
+ to8Bit = &QString::toUtf8;
+ }
+}
+
+void tst_Utf8::roundTrip_data()
+{
+ QTest::addColumn<QByteArray>("utf8");
+ QTest::addColumn<QString>("utf16");
+
+ QTest::newRow("empty") << QByteArray() << QString();
+ QTest::newRow("nul") << QByteArray("", 1) << QString(QChar(QChar::Null));
+
+ static const char ascii[] = "This is a standard US-ASCII message";
+ QTest::newRow("ascii") << QByteArray(ascii) << ascii;
+
+ static const char ascii2[] = "\1This\2is\3an\4US-ASCII\020 message interspersed with control chars";
+ QTest::newRow("ascii2") << QByteArray(ascii2) << ascii2;
+
+ static const char utf8_1[] = "\302\240"; // NBSP
+ QTest::newRow("utf8_1") << QByteArray(utf8_1) << QString(QChar(QChar::Nbsp));
+
+ static const char utf8_2[] = "\342\202\254"; // Euro symbol
+ QTest::newRow("utf8_2") << QByteArray(utf8_2) << QString(QChar(0x20AC));
+
+#if 0
+ // Can't test this because QString::fromUtf8 consumes it
+ static const char utf8_3[] = "\357\273\277"; // byte order mark
+ QTest::newRow("utf8_3") << QByteArray(utf8_3) << QString(QChar(QChar::ByteOrderMark));
+#endif
+
+ static const char utf8_4[] = "\357\277\275"; // replacement char
+ QTest::newRow("utf8_4") << QByteArray(utf8_4) << QString(QChar(QChar::ReplacementCharacter));
+
+ static const char utf8_5[] = "\360\220\210\203"; // U+010203
+ static const uint utf32_5[] = { 0x010203 };
+ QTest::newRow("utf8_5") << QByteArray(utf8_5) << QString::fromUcs4(utf32_5, 1);
+
+ static const char utf8_6[] = "\364\217\277\277"; // U+10FFFF
+ static const uint utf32_6[] = { 0x10FFFF };
+ QTest::newRow("utf8_6") << QByteArray(utf8_6) << QString::fromUcs4(utf32_6, 1);
+
+ static const char utf8_7[] = "abc\302\240\303\241\303\251\307\275 \342\202\254def";
+ static const ushort utf16_7[] = { 'a', 'b', 'c', 0x00A0,
+ 0x00E1, 0x00E9, 0x01FD,
+ ' ', 0x20AC, 'd', 'e', 'f', 0 };
+ QTest::newRow("utf8_7") << QByteArray(utf8_7) << QString::fromUtf16(utf16_7);
+
+ static const char utf8_8[] = "abc\302\240\303\241\303\251\307\275 \364\217\277\277 \342\202\254def";
+ static const uint utf32_8[] = { 'a', 'b', 'c', 0x00A0,
+ 0x00E1, 0x00E9, 0x01FD,
+ ' ', 0x10FFFF, ' ',
+ 0x20AC, 'd', 'e', 'f', 0 };
+ QTest::newRow("utf8_8") << QByteArray(utf8_8) << QString::fromUcs4(utf32_8);
+}
+
+void tst_Utf8::roundTrip()
+{
+ QFETCH(QByteArray, utf8);
+ QFETCH(QString, utf16);
+
+ QCOMPARE((utf16.*to8Bit)(), utf8);
+ QCOMPARE(from8Bit(utf8), utf16);
+
+ QCOMPARE((from8Bit(utf8).*to8Bit)(), utf8);
+ QCOMPARE(from8Bit((utf16.*to8Bit)()), utf16);
+}
+
+void tst_Utf8::charByChar_data()
+{
+ roundTrip_data();
+}
+
+void tst_Utf8::charByChar()
+{
+ QFETCH(QByteArray, utf8);
+ QFETCH(QString, utf16);
+
+ {
+ // from utf16 to utf8 char by char:
+ QSharedPointer<QTextEncoder> encoder = QSharedPointer<QTextEncoder>(codec->makeEncoder());
+ QByteArray encoded;
+
+ for (int i = 0; i < utf16.length(); ++i) {
+ encoded += encoder->fromUnicode(utf16.constData() + i, 1);
+ QVERIFY(!encoder->hasFailure());
+ }
+
+ if (encoded.startsWith(utf8bom))
+ encoded = encoded.mid(strlen(utf8bom));
+ QCOMPARE(encoded, utf8);
+ }
+ {
+ // from utf8 to utf16 char by char:
+ QSharedPointer<QTextDecoder> decoder = QSharedPointer<QTextDecoder>(codec->makeDecoder());
+ QString decoded;
+
+ for (int i = 0; i < utf8.length(); ++i) {
+ decoded += decoder->toUnicode(utf8.constData() + i, 1);
+ QVERIFY(!decoder->hasFailure());
+ }
+
+ QCOMPARE(decoded, utf16);
+ }
+}
+
+void tst_Utf8::invalidUtf8_data()
+{
+ QTest::addColumn<QByteArray>("utf8");
+
+ QTest::newRow("1char") << QByteArray("\x80");
+ QTest::newRow("2chars") << QByteArray("\xC2\xC0");
+ QTest::newRow("3chars-1") << QByteArray("\xE0\xA0\xC0");
+ QTest::newRow("3chars-2") << QByteArray("\xE0\xC0\xA0");
+ QTest::newRow("4chars-1") << QByteArray("\xF0\x90\x80\xC0");
+ QTest::newRow("4chars-2") << QByteArray("\xF0\x90\xC0\x80");
+ QTest::newRow("4chars-3") << QByteArray("\xF0\xC0\x80\x80");
+
+ // U+FFFE and U+FFFF are non-characters and must not be present
+ // U+FFFE: 1111 11 1111 11 1110
+ // encoding: xxxz:1111 xz11:1111 xz11:1110
+ QTest::newRow("fffe") << QByteArray("\xEF\xBF\xBE");
+ // U+FFFF: 1111 11 1111 11 1111
+ // encoding: xxxz:1111 xz11:1111 xz11:1111
+ QTest::newRow("ffff") << QByteArray("\xEF\xBF\xBF");
+
+ // Surrogate pairs must now be present either
+ // U+D800: 1101 10 0000 00 0000
+ // encoding: xxxz:1101 xz10:0000 xz00:0000
+ QTest::newRow("hi-surrogate") << QByteArray("\xED\xA0\x80");
+ // U+DC00: 1101 11 0000 00 0000
+ // encoding: xxxz:1101 xz11:0000 xz00:0000
+ QTest::newRow("lo-surrogate") << QByteArray("\xED\xB0\x80");
+
+ // not even in pair:
+ QTest::newRow("surrogate-pair") << QByteArray("\xED\xA0\x80\xED\xB0\x80");
+
+ // Characters outside the Unicode range:
+ // 0x110000: 00 0100 01 0000 00 0000 00 0000
+ // encoding: xxxx:z100 xz01:0000 xz00:0000 xz00:0000
+ QTest::newRow("non-unicode-1") << QByteArray("\xF4\x90\x80\x80");
+ // 0x200000: 00 1000 00 0000 00 0000 00 0000
+ // encoding: xxxx:xz00 xz00:1000 xz00:0000 xz00:0000 xz00:0000
+ QTest::newRow("non-unicode-2") << QByteArray("\xF8\x88\x80\x80\x80");
+ // 0x04000000: 0100 00 0000 00 0000 00 0000 00 0000
+ // encoding: xxxx:xxz0 xz00:0100 xz00:0000 xz00:0000 xz00:0001 xz00:0001
+ QTest::newRow("non-unicode-3") << QByteArray("\xFC\x84\x80\x80\x80\x80");
+ // 0x7fffffff: 1 11 1111 11 1111 11 1111 11 1111 11 1111
+ // encoding: xxxx:xxz0 xz00:0100 xz00:0000 xz00:0000 xz00:0001 xz00:0001
+ QTest::newRow("non-unicode-3") << QByteArray("\xFD\xBF\xBF\xBF\xBF\xBF");
+
+ // As seen above, 0xFE and 0xFF never appear:
+ QTest::newRow("fe") << QByteArray("\xFE");
+ QTest::newRow("fe-bis") << QByteArray("\xFE\xBF\xBF\xBF\xBF\xBF\xBF");
+ QTest::newRow("ff") << QByteArray("\xFF");
+ QTest::newRow("ff-bis") << QByteArray("\xFF\xBF\xBF\xBF\xBF\xBF\xBF\xBF");
+
+ // some combinations in UTF-8 are invalid even though they have the proper bits set
+ // these are known as overlong sequences
+
+ // "A": U+0041: 01 00 0001
+ // overlong 2: xxz0:0001 xz00:0001
+ QTest::newRow("overlong-1-2") << QByteArray("\xC1\x81");
+ // overlong 3: xxxz:0000 xz00:0001 xz00:0001
+ QTest::newRow("overlong-1-3") << QByteArray("\xE0\x81\x81");
+ // overlong 4: xxxx:z000 xz00:0000 xz00:0001 xz00:0001
+ QTest::newRow("overlong-1-4") << QByteArray("\xF0\x80\x81\x81");
+ // overlong 5: xxxx:xz00 xz00:0000 xz00:0000 xz00:0001 xz00:0001
+ QTest::newRow("overlong-1-5") << QByteArray("\xF8\x80\x80\x81\x81");
+ // overlong 6: xxxx:xxz0 xz00:0000 xz00:0000 xz00:0000 xz00:0001 xz00:0001
+ QTest::newRow("overlong-1-6") << QByteArray("\xFC\x80\x80\x80\x81\x81");
+
+ // NBSP: U+00A0: 10 00 0000
+ // proper encoding: xxz0:0010 xz00:0000
+ // overlong 3: xxxz:0000 xz00:0010 xz00:0000
+ QTest::newRow("overlong-2-3") << QByteArray("\xC0\x82\x80");
+ // overlong 4: xxxx:z000 xz00:0000 xz00:0010 xz00:0000
+ QTest::newRow("overlong-2-4") << QByteArray("\xF0\x80\x82\x80");
+ // overlong 5: xxxx:xz00 xz00:0000 xz00:0000 xz00:0010 xz00:0000
+ QTest::newRow("overlong-2-4") << QByteArray("\xF8\x80\x80\x82\x80");
+ // overlong 6: xxxx:xxz0 xz00:0000 xz00:0000 xz00:0000 xz00:0010 xz00:0000
+ QTest::newRow("overlong-2-4") << QByteArray("\xFC\x80\x80\x80\x82\x80");
+
+ // U+0800: 10 0000 00 0000
+ // proper encoding: xxxz:0000 xz10:0000 xz00:0000
+ // overlong 4: xxxx:z000 xz00:0000 xz10:0000 xz00:0000
+ QTest::newRow("overlong-3-4") << QByteArray("\xF0\x80\xA0\x80");
+ // overlong 5: xxxx:xz00 xz00:0000 xz00:0000 xz10:0000 xz00:0000
+ QTest::newRow("overlong-3-5") << QByteArray("\xF8\x80\x80\xA0\x80");
+ // overlong 6: xxxx:xxz0 xz00:0000 xz00:0000 xz00:0000 xz10:0000 xz00:0000
+ QTest::newRow("overlong-3-6") << QByteArray("\xFC\x80\x80\x80\xA0\x80");
+
+ // U+010000: 00 0100 00 0000 00 0000
+ // proper encoding: xxxx:z000 xz00:0100 xz00:0000 xz00:0000
+ // overlong 5: xxxx:xz00 xz00:0000 xz00:0100 xz00:0000 xz00:0000
+ QTest::newRow("overlong-4-5") << QByteArray("\xF8\x80\x84\x80\x80");
+ // overlong 6: xxxx:xxz0 xz00:0000 xz00:0000 xz00:0100 xz00:0000 xz00:0000
+ QTest::newRow("overlong-4-6") << QByteArray("\xFC\x80\x80\x84\x80\x80");
+}
+
+void tst_Utf8::invalidUtf8()
+{
+ QFETCH(QByteArray, utf8);
+
+ QSharedPointer<QTextDecoder> decoder = QSharedPointer<QTextDecoder>(codec->makeDecoder());
+ QString decoded = decoder->toUnicode(utf8);
+ QVERIFY(decoder->hasFailure());
+}
+
+QTEST_MAIN(tst_Utf8)
+#include "tst_utf8.moc"
diff --git a/tests/auto/utf8/utf8.pro b/tests/auto/utf8/utf8.pro
new file mode 100644
index 0000000..4ec6851
--- /dev/null
+++ b/tests/auto/utf8/utf8.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+QT -= gui
+SOURCES += tst_utf8.cpp
diff --git a/tests/auto/windowsmobile/test/ddhelper.cpp b/tests/auto/windowsmobile/test/ddhelper.cpp
new file mode 100644
index 0000000..5955cd3
--- /dev/null
+++ b/tests/auto/windowsmobile/test/ddhelper.cpp
@@ -0,0 +1,121 @@
+
+#ifdef Q_OS_WINCE_WM
+
+#include <Ddraw.h>
+#include <QDebug>
+
+static LPDIRECTDRAW g_pDD = NULL; // DirectDraw object
+static LPDIRECTDRAWSURFACE g_pDDSSurface = NULL; // DirectDraw primary surface
+
+static DDSCAPS ddsCaps;
+static DDSURFACEDESC ddsSurfaceDesc;
+static void *buffer = NULL;
+
+static int width = 0;
+static int height = 0;
+static int pitch = 0;
+static int bitCount = 0;
+static int windowId = 0;
+
+static bool initialized = false;
+static bool locked = false;
+
+void q_lock()
+{
+ if (locked) {
+ qWarning("Direct Painter already locked (QDirectPainter::lock())");
+ return;
+ }
+ locked = true;
+
+
+ memset(&ddsSurfaceDesc, 0, sizeof(ddsSurfaceDesc));
+ ddsSurfaceDesc.dwSize = sizeof(ddsSurfaceDesc);
+
+ HRESULT h = g_pDDSSurface->Lock(0, &ddsSurfaceDesc, DDLOCK_WRITEONLY, 0);
+ if (h != DD_OK)
+ qDebug() << "GetSurfaceDesc failed!";
+
+ width = ddsSurfaceDesc.dwWidth;
+ height = ddsSurfaceDesc.dwHeight;
+ bitCount = ddsSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
+ pitch = ddsSurfaceDesc.lPitch;
+ buffer = ddsSurfaceDesc.lpSurface;
+}
+
+void q_unlock()
+{
+ if( !locked) {
+ qWarning("Direct Painter not locked (QDirectPainter::unlock()");
+ return;
+ }
+ g_pDDSSurface->Unlock(0);
+ locked = false;
+}
+
+void q_initDD()
+{
+ if (initialized)
+ return;
+
+ DirectDrawCreate(NULL, &g_pDD, NULL);
+
+ HRESULT h;
+ h = g_pDD->SetCooperativeLevel(0, DDSCL_NORMAL);
+
+ if (h != DD_OK)
+ qDebug() << "cooperation level failed";
+
+ h = g_pDD->TestCooperativeLevel();
+ if (h != DD_OK)
+ qDebug() << "cooperation level failed test";
+
+ DDSURFACEDESC ddsd;
+ memset(&ddsd, 0, sizeof(ddsd));
+ ddsd.dwSize = sizeof(ddsd);
+
+ ddsd.dwFlags = DDSD_CAPS;
+
+ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+
+ h = g_pDD->CreateSurface(&ddsd, &g_pDDSSurface, NULL);
+
+ if (h != DD_OK)
+ qDebug() << "CreateSurface failed!";
+
+ if (g_pDDSSurface->GetCaps(&ddsCaps) != DD_OK)
+ qDebug() << "GetCaps failed";
+
+ q_lock();
+ q_unlock();
+ initialized = true;
+}
+
+uchar* q_frameBuffer()
+{
+ return (uchar*) buffer;
+}
+
+int q_screenDepth()
+{
+ return bitCount;
+}
+
+int q_screenWidth()
+{
+ return width;
+}
+
+int q_screenHeight()
+{
+ return height;
+}
+
+int q_linestep()
+{
+ return pitch;
+}
+
+#endif //Q_OS_WINCE_WM
+
+
diff --git a/tests/auto/windowsmobile/test/ddhelper.h b/tests/auto/windowsmobile/test/ddhelper.h
new file mode 100644
index 0000000..3dfa9e6
--- /dev/null
+++ b/tests/auto/windowsmobile/test/ddhelper.h
@@ -0,0 +1,21 @@
+#ifndef __DDHELPER__
+#define __DDHELPER__
+
+extern uchar* q_frameBuffer();
+
+extern int q_screenDepth();
+
+extern int q_screenWidth();
+
+extern int q_screenHeight();
+
+extern int q_linestep();
+
+extern void q_initDD();
+
+extern void q_unlock();
+
+extern void q_lock();
+
+#endif //__DDHELPER__
+
diff --git a/tests/auto/windowsmobile/test/test.pro b/tests/auto/windowsmobile/test/test.pro
new file mode 100644
index 0000000..2420bf1
--- /dev/null
+++ b/tests/auto/windowsmobile/test/test.pro
@@ -0,0 +1,24 @@
+
+load(qttest_p4)
+
+HEADERS += ddhelper.h
+SOURCES += tst_windowsmobile.cpp ddhelper.cpp
+RESOURCES += windowsmobile.qrc
+
+TARGET = tst_windowsmobile
+
+wincewm*: {
+ addFiles.sources = \
+ ../testQMenuBar/*.exe
+
+
+ addFiles.path = "\Program Files\tst_windowsmobile"
+ DEPLOYMENT += addFiles
+}
+
+wincewm*: {
+ LIBS += Ddraw.lib
+}
+
+
+
diff --git a/tests/auto/windowsmobile/test/testQMenuBar_current.png b/tests/auto/windowsmobile/test/testQMenuBar_current.png
new file mode 100644
index 0000000..d03e69a
--- /dev/null
+++ b/tests/auto/windowsmobile/test/testQMenuBar_current.png
Binary files differ
diff --git a/tests/auto/windowsmobile/test/testSimpleWidget_current.png b/tests/auto/windowsmobile/test/testSimpleWidget_current.png
new file mode 100644
index 0000000..5cbc2bb
--- /dev/null
+++ b/tests/auto/windowsmobile/test/testSimpleWidget_current.png
Binary files differ
diff --git a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
new file mode 100644
index 0000000..391e206
--- /dev/null
+++ b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
@@ -0,0 +1,191 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtCore/QDate>
+#include <QtCore/QDebug>
+#include <QtCore/QObject>
+#include <QtGui>
+#include <windows.h>
+#include <ddhelper.h>
+
+
+
+class tst_WindowsMobile : public QObject
+{
+ Q_OBJECT
+public:
+ tst_WindowsMobile()
+ {
+#ifdef Q_OS_WINCE_WM
+ q_initDD();
+#endif
+ }
+
+#ifdef Q_OS_WINCE_WM
+ private slots:
+ void testMainWindowAndMenuBar();
+ void testSimpleWidget();
+#endif
+};
+
+#ifdef Q_OS_WINCE_WM
+
+bool qt_wince_is_platform(const QString &platformString) {
+ TCHAR tszPlatform[64];
+ if (SystemParametersInfo(SPI_GETPLATFORMTYPE,
+ sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0))
+ if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform))
+ return true;
+ return false;
+}
+
+bool qt_wince_is_smartphone() {
+ return qt_wince_is_platform(QString::fromLatin1("Smartphone"));
+}
+
+void openMenu()
+{
+ ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,450,630,0,0);
+ ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,450,630,0,0);
+ QTest::qWait(2000);
+ ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0);
+ ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0);
+ QTest::qWait(2000);
+ ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,55535,0,0);
+ ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,55535,0,0);
+ QTest::qWait(2000);
+ ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,58535,0,0);
+ ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,58535,0,0);
+ QTest::qWait(2000);
+ ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,40535,55535,0,0);
+ ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,40535,55535,0,0);
+ QTest::qWait(2000);
+ ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,32535,55535,0,0);
+ ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,32535,55535,0,0);
+ QTest::qWait(2000);
+ ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0);
+ ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0);
+ QTest::qWait(2000);
+ ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,50535,0,0);
+ ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,50535,0,0);
+ QTest::qWait(2000);
+ ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,40535,0,0);
+ ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,40535,0,0);
+ QTest::qWait(2000);
+ ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,48535,45535,0,0);
+ QTest::qWait(2000);
+ ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,48535,45535,0,0);
+}
+
+void compareScreenshots(const QString &image1, const QString &image2)
+{
+ if (qt_wince_is_smartphone())
+ QSKIP("This test is only for Windows Mobile", SkipAll);
+ QImage screenShot(image1);
+ QImage original(image2);
+
+ //ignore the clock
+ QPainter p1(&screenShot);
+ QPainter p2(&original);
+ p1.fillRect(310, 6, 400, 34, Qt::black);
+ p2.fillRect(310, 6, 400, 34, Qt::black);
+
+ QVERIFY(original == screenShot);
+}
+
+void takeScreenShot(const QString filename)
+{
+ q_lock();
+ QImage image = QImage(( uchar *) q_frameBuffer(), q_screenWidth(),
+ q_screenHeight(), q_screenWidth() * q_screenDepth() / 8, QImage::Format_RGB16);
+ image.save(filename, "PNG");
+ q_unlock();
+}
+
+void tst_WindowsMobile::testMainWindowAndMenuBar()
+{
+ QProcess process;
+ process.start("testQMenuBar.exe");
+ QCOMPARE(process.state(), QProcess::Running);
+ QTest::qWait(6000);
+ openMenu();
+ QTest::qWait(1000);
+ takeScreenShot("testQMenuBar_current.png");
+ process.close();
+ compareScreenshots("testQMenuBar_current.png", ":/testQMenuBar_current.png");
+}
+
+void tst_WindowsMobile::testSimpleWidget()
+{
+ QMenuBar menubar;
+ menubar.show();
+ QWidget maximized;
+ QPalette pal = maximized.palette();
+ pal.setColor(QPalette::Background, Qt::red);
+ maximized.setPalette(pal);
+ maximized.showMaximized();
+ QWidget widget;
+ widget.setGeometry(100, 100, 200, 200);
+ widget.setWindowTitle("Widget");
+ widget.show();
+ qApp->processEvents();
+ QTest::qWait(1000);
+
+ QWidget widget2;
+ widget2.setGeometry(100, 380, 300, 200);
+ widget2.setWindowTitle("Widget 2");
+ widget2.setWindowFlags(Qt::Popup);
+ widget2.show();
+
+ qApp->processEvents();
+ QTest::qWait(1000);
+ takeScreenShot("testSimpleWidget_current.png");
+ compareScreenshots("testSimpleWidget_current.png", ":/testSimpleWidget_current.png");
+}
+
+
+#endif //Q_OS_WINCE_WM
+
+
+QTEST_MAIN(tst_WindowsMobile)
+#include "tst_windowsmobile.moc"
+
diff --git a/tests/auto/windowsmobile/test/windowsmobile.qrc b/tests/auto/windowsmobile/test/windowsmobile.qrc
new file mode 100644
index 0000000..5d6f614
--- /dev/null
+++ b/tests/auto/windowsmobile/test/windowsmobile.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>testQMenuBar_current.png</file>
+ <file>testSimpleWidget_current.png</file>
+</qresource>
+</RCC>
diff --git a/tests/auto/windowsmobile/testQMenuBar/main.cpp b/tests/auto/windowsmobile/testQMenuBar/main.cpp
new file mode 100644
index 0000000..4a3b3b2
--- /dev/null
+++ b/tests/auto/windowsmobile/testQMenuBar/main.cpp
@@ -0,0 +1,72 @@
+#include <QtTest/QtTest>
+#include <QtCore/QDate>
+#include <QtCore/QDebug>
+#include <QtCore/QObject>
+#include <QtGui>
+#include <windows.h>
+
+int main(int argc, char * argv[])
+{
+ int widgetNum = 20;
+
+ QList<QWidget*> widgets;
+ QApplication app(argc, argv);
+
+ QMainWindow mainWindow;
+ mainWindow.setWindowTitle("Test");
+ QMenu *fileMenu = mainWindow.menuBar()->addMenu("File");
+ QMenu *editMenu = mainWindow.menuBar()->addMenu("Edit");
+ QMenu *viewMenu = mainWindow.menuBar()->addMenu("View");
+ QMenu *toolsMenu = mainWindow.menuBar()->addMenu("Tools");
+ QMenu *optionsMenu = mainWindow.menuBar()->addMenu("Options");
+ QMenu *helpMenu = mainWindow.menuBar()->addMenu("Help");
+
+ qApp->processEvents();
+
+ fileMenu->addAction("Open");
+ QAction *close = fileMenu->addAction("Close");
+ fileMenu->addSeparator();
+ fileMenu->addAction("Exit");
+
+ close->setEnabled(false);
+
+ editMenu->addAction("Cut");
+ editMenu->addAction("Pase");
+ editMenu->addAction("Copy");
+ editMenu->addSeparator();
+ editMenu->addAction("Find");
+
+ viewMenu->addAction("Hide");
+ viewMenu->addAction("Show");
+ viewMenu->addAction("Explore");
+ QAction *visible = viewMenu->addAction("Visible");
+ visible->setCheckable(true);
+ visible->setChecked(true);
+
+ toolsMenu->addMenu("Hammer");
+ toolsMenu->addMenu("Caliper");
+ toolsMenu->addMenu("Helm");
+
+ optionsMenu->addMenu("Settings");
+ optionsMenu->addMenu("Standard");
+ optionsMenu->addMenu("Extended");
+
+ QMenu *subMenu = helpMenu->addMenu("Help");
+ subMenu->addAction("Index");
+ subMenu->addSeparator();
+ subMenu->addAction("Vodoo Help");
+ helpMenu->addAction("Contens");
+ helpMenu->addSeparator();
+ helpMenu->addAction("About");
+
+ QToolBar toolbar;
+ mainWindow.addToolBar(&toolbar);
+ toolbar.addAction(QIcon(qApp->style()->standardPixmap(QStyle::SP_FileIcon)), QString("textAction"));
+
+ QTextEdit textEdit;
+ mainWindow.setCentralWidget(&textEdit);
+
+ mainWindow.showMaximized();
+
+ app.exec();
+}
diff --git a/tests/auto/windowsmobile/testQMenuBar/testQMenuBar.pro b/tests/auto/windowsmobile/testQMenuBar/testQMenuBar.pro
new file mode 100644
index 0000000..6dd288b
--- /dev/null
+++ b/tests/auto/windowsmobile/testQMenuBar/testQMenuBar.pro
@@ -0,0 +1,2 @@
+SOURCES += main.cpp
+DESTDIR = ./
diff --git a/tests/auto/windowsmobile/windowsmobile.pro b/tests/auto/windowsmobile/windowsmobile.pro
new file mode 100644
index 0000000..2e6b444
--- /dev/null
+++ b/tests/auto/windowsmobile/windowsmobile.pro
@@ -0,0 +1,9 @@
+
+TEMPLATE = subdirs
+
+wincewm* {
+ SUBDIRS = testQMenuBar
+}
+ SUBDIRS += test
+
+