diff options
Diffstat (limited to 'tests')
85 files changed, 1460 insertions, 203 deletions
diff --git a/tests/auto/checkxmlfiles/checkxmlfiles.pro b/tests/auto/checkxmlfiles/checkxmlfiles.pro index d53c11c..319ba9b 100644 --- a/tests/auto/checkxmlfiles/checkxmlfiles.pro +++ b/tests/auto/checkxmlfiles/checkxmlfiles.pro @@ -6,7 +6,7 @@ QT -= gui include (../xmlpatterns.pri) -wince*|symbian*: { +wince*|symbian: { QT += network addFiles.sources = \ $$QT_SOURCE_TREE/examples/sql/masterdetail/albumdetails.xml \ diff --git a/tests/auto/corelib.pro b/tests/auto/corelib.pro index 259be4c..531fed2 100644 --- a/tests/auto/corelib.pro +++ b/tests/auto/corelib.pro @@ -101,3 +101,10 @@ SUBDIRS=\ selftests \ utf8 \ +symbian:SUBDIRS -= \ + qtconcurrentfilter \ + qtconcurrentiteratekernel \ + qtconcurrentmap \ + qtconcurrentrun \ + qtconcurrentthreadengine \ + diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro index a8fd2b4..cfaa3fa 100644 --- a/tests/auto/gui.pro +++ b/tests/auto/gui.pro @@ -220,3 +220,11 @@ win32:SUBDIRS -= qtextpiecetable qstylesheetstyle \ qtextpiecetable \ +symbian:SUBDIRS -= \ + qhelpcontentmodel \ + qhelpenginecore \ + qhelpgenerator \ + qhelpindexmodel \ + qhelpprojectdata \ + qsystemtrayicon \ + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt index 195c0e6..d4ebe49 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt @@ -2,3 +2,6 @@ .*/lupdate/testdata/good/parsecpp2/main.cpp:55: Excess closing brace .* .*/lupdate/testdata/good/parsecpp2/main.cpp:61: Excess closing brace .* .*/lupdate/testdata/good/parsecpp2/main.cpp:65: Excess closing brace .* +.*/lupdate/testdata/good/parsecpp2/main.cpp:120: //% cannot be used with tr\(\) / QT_TR_NOOP\(\)\. Ignoring +.*/lupdate/testdata/good/parsecpp2/main.cpp:123: //% cannot be used with translate\(\) / QT_TRANSLATE_NOOP\(\)\. Ignoring +.*/lupdate/testdata/good/parsecpp2/main.cpp:126: Discarding unconsumed meta data diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp index feb885c..06e6fe0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp @@ -112,3 +112,16 @@ void ToBeUsed::caller() { tr("NameSpace::ToBeUsed"); } + + + +// QTBUG-11818 +//% "Foo" +QObject::tr("Hello World"); +QObject::tr("Hello World"); +//% "Bar" +QApplication::translate("QObject", "Hello World"); +QApplication::translate("QObject", "Hello World"); +//% "Baz" +clear = me; +QObject::tr("Hello World"); diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result index 6f48e27..806f56f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result @@ -10,6 +10,18 @@ </message> </context> <context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="120"/> + <location filename="main.cpp" line="121"/> + <location filename="main.cpp" line="123"/> + <location filename="main.cpp" line="124"/> + <location filename="main.cpp" line="127"/> + <source>Hello World</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>TopLevel</name> <message> <location filename="main.cpp" line="82"/> diff --git a/tests/auto/mediaobject/mediaobject.pro b/tests/auto/mediaobject/mediaobject.pro index bef2fe9..e887df4 100755 --- a/tests/auto/mediaobject/mediaobject.pro +++ b/tests/auto/mediaobject/mediaobject.pro @@ -14,7 +14,7 @@ wince*{ DEFINES += tst_MediaObject=tst_MediaObject_waveout } -symbian*:{ +symbian:{ addFiles.sources = media/test.sdp addFiles.path = media DEPLOYMENT += addFiles diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index a56d842..19f3677 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -1322,6 +1322,25 @@ public slots: void foo(struct const_ *) {}; }; + +template<typename T1, typename T2> +class TestTemplate2 +{ +}; + +class QTBUG11647_constInTemplateParameter : public QObject +{ Q_OBJECT +public slots: + void testSlot(TestTemplate2<const int, const short*>) {} + void testSlot2(TestTemplate2<int, short const * const >) {} + void testSlot3(TestTemplate2<TestTemplate2 < const int, const short* > const *, + TestTemplate2< TestTemplate2 < void, int > , unsigned char *> > ) {} + +signals: + void testSignal(TestTemplate2<const int, const short*>); +}; + + QTEST_APPLESS_MAIN(tst_Moc) #include "tst_moc.moc" diff --git a/tests/auto/networkselftest/networkselftest.pro b/tests/auto/networkselftest/networkselftest.pro index b0d537a..d7cb7f3 100644 --- a/tests/auto/networkselftest/networkselftest.pro +++ b/tests/auto/networkselftest/networkselftest.pro @@ -8,7 +8,7 @@ wince*: { addFiles.path = . DEPLOYMENT = addFiles DEFINES += SRCDIR=\\\"\\\" -} else:symbian* { +} else:symbian { addFiles.sources = rfc3252.txt addFiles.path = . DEPLOYMENT = addFiles diff --git a/tests/auto/patternistexamples/patternistexamples.pro b/tests/auto/patternistexamples/patternistexamples.pro index c528c93..f83e0aa 100644 --- a/tests/auto/patternistexamples/patternistexamples.pro +++ b/tests/auto/patternistexamples/patternistexamples.pro @@ -1,7 +1,7 @@ load(qttest_p4) SOURCES += tst_patternistexamples.cpp CONFIG += qtestlib -wince*|symbian*: { +wince*|symbian: { snippets.sources = $$QT_SOURCE_TREE/doc/src/snippets/patternist/* snippets.path = patternist widgetRen.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/widgetRenderer/* diff --git a/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro b/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro index e8b1ce9..3193764 100644 --- a/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro +++ b/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro @@ -3,11 +3,12 @@ ###################################################################### TEMPLATE = app -!symbian*: { +!symbian: { DEPENDPATH += . INCLUDEPATH += . } -wince*|symbian*:TARGET = ../desktopsettingsaware +wince*:TARGET = ../desktopsettingsaware +symbian:TARGET = desktopsettingsaware # Input SOURCES += main.cpp diff --git a/tests/auto/qapplication/test/test.pro b/tests/auto/qapplication/test/test.pro index e68af26..30eb751 100644 --- a/tests/auto/qapplication/test/test.pro +++ b/tests/auto/qapplication/test/test.pro @@ -11,7 +11,7 @@ wince* { DEPLOYMENT = additional deploy someTest } -symbian*: { +symbian: { additional.sources = ../desktopsettingsaware/desktopsettingsaware.exe additional.path = desktopsettingsaware someTest.sources = test.pro diff --git a/tests/auto/qaudiooutput/qaudiooutput.pro b/tests/auto/qaudiooutput/qaudiooutput.pro index a6286ec..e1734e0 100644 --- a/tests/auto/qaudiooutput/qaudiooutput.pro +++ b/tests/auto/qaudiooutput/qaudiooutput.pro @@ -4,7 +4,7 @@ SOURCES += tst_qaudiooutput.cpp QT = core multimedia -wince*|symbian*: { +wince*|symbian: { deploy.sources += 4.wav DEPLOYMENT = deploy !symbian { diff --git a/tests/auto/qbearertestcommon.h b/tests/auto/qbearertestcommon.h index c9df249..138c444 100644 --- a/tests/auto/qbearertestcommon.h +++ b/tests/auto/qbearertestcommon.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qchar/qchar.pro b/tests/auto/qchar/qchar.pro index a534d14..3813e4e 100644 --- a/tests/auto/qchar/qchar.pro +++ b/tests/auto/qchar/qchar.pro @@ -3,12 +3,12 @@ SOURCES += tst_qchar.cpp QT = core -wince*|symbian*: { +wince*|symbian: { deploy.sources += NormalizationTest.txt DEPLOYMENT = deploy } -symbian*: { +symbian: { DEFINES += SRCDIR="" } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/qclipboard/test/test.pro b/tests/auto/qclipboard/test/test.pro index 62a38af..0f8cad1 100644 --- a/tests/auto/qclipboard/test/test.pro +++ b/tests/auto/qclipboard/test/test.pro @@ -10,13 +10,13 @@ win32 { } } -wince*|symbian*: { +wince*|symbian: { copier.sources = ../copier/copier.exe copier.path = copier paster.sources = ../paster/paster.exe paster.path = paster - symbian*: { + symbian: { load(data_caging_paths) rsc.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/copier.rsc rsc.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/paster.rsc diff --git a/tests/auto/qcryptographichash/qcryptographichash.pro b/tests/auto/qcryptographichash/qcryptographichash.pro index aa9a7c4..7e1a866 100644 --- a/tests/auto/qcryptographichash/qcryptographichash.pro +++ b/tests/auto/qcryptographichash/qcryptographichash.pro @@ -2,7 +2,7 @@ load(qttest_p4) SOURCES += tst_qcryptographichash.cpp QT = core -symbian*: { +symbian: { TARGET.EPOCSTACKSIZE =0x5000 -TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb" +TARGET.EPOCHEAPSIZE="0x100000 0x1000000" # // Min 1Mb, max 16Mb } diff --git a/tests/auto/qdiriterator/qdiriterator.pro b/tests/auto/qdiriterator/qdiriterator.pro index ece886c..d60b52d 100644 --- a/tests/auto/qdiriterator/qdiriterator.pro +++ b/tests/auto/qdiriterator/qdiriterator.pro @@ -3,7 +3,7 @@ SOURCES += tst_qdiriterator.cpp RESOURCES += qdiriterator.qrc QT = core -wince*|symbian*: { +wince*|symbian: { addFiles.sources = entrylist recursiveDirs foo addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qdom/qdom.pro b/tests/auto/qdom/qdom.pro index 61914b5..5434ada 100644 --- a/tests/auto/qdom/qdom.pro +++ b/tests/auto/qdom/qdom.pro @@ -4,7 +4,7 @@ SOURCES += tst_qdom.cpp QT = core xml QT -= gui -wince*|symbian*: { +wince*|symbian: { addFiles.sources = testdata doubleNamespaces.xml umlaut.xml addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qfile/qfile.pro b/tests/auto/qfile/qfile.pro index 33fd2fd..0383e30 100644 --- a/tests/auto/qfile/qfile.pro +++ b/tests/auto/qfile/qfile.pro @@ -5,5 +5,5 @@ wince*:{ SUBDIRS = test stdinprocess } -!symbian*:SUBDIRS += largefile +!symbian:SUBDIRS += largefile diff --git a/tests/auto/qfileinfo/qfileinfo.pro b/tests/auto/qfileinfo/qfileinfo.pro index 2038514..ef5ed22 100644 --- a/tests/auto/qfileinfo/qfileinfo.pro +++ b/tests/auto/qfileinfo/qfileinfo.pro @@ -6,7 +6,7 @@ QT = core RESOURCES += qfileinfo.qrc -wince*:|symbian*: { +wince*:|symbian: { deploy.sources += qfileinfo.qrc tst_qfileinfo.cpp res.sources = resources\\file1 resources\\file1.ext1 resources\\file1.ext1.ext2 res.path = resources diff --git a/tests/auto/qftp/qftp.pro b/tests/auto/qftp/qftp.pro index 33d479a..9618962 100644 --- a/tests/auto/qftp/qftp.pro +++ b/tests/auto/qftp/qftp.pro @@ -9,7 +9,7 @@ wince*: { addFiles.path = . DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\"\\\" -} else:symbian* { +} else:symbian { addFiles.sources = rfc3252.txt addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index fe68c8e..31a6845 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -442,6 +442,7 @@ private slots: void updateMicroFocus(); void textItem_shortcuts(); void scroll(); + void stopClickFocusPropagation(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -10268,6 +10269,59 @@ void tst_QGraphicsItem::scroll() QCOMPARE(item2->lastExposedRect, expectedItem2Expose); } +void tst_QGraphicsItem::stopClickFocusPropagation() +{ + class MyItem : public QGraphicsRectItem + { + public: + MyItem() : QGraphicsRectItem(0, 0, 100, 100) {} + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) + { + painter->fillRect(boundingRect(), hasFocus() ? QBrush(Qt::red) : brush()); + } + }; + + QGraphicsScene scene(-50, -50, 400, 400); + scene.setStickyFocus(true); + + QGraphicsRectItem *noFocusOnTop = new MyItem; + noFocusOnTop->setBrush(Qt::yellow); + noFocusOnTop->setFlag(QGraphicsItem::ItemStopsClickFocusPropagation); + + QGraphicsRectItem *focusableUnder = new MyItem; + focusableUnder->setBrush(Qt::blue); + focusableUnder->setFlag(QGraphicsItem::ItemIsFocusable); + focusableUnder->setPos(50, 50); + + QGraphicsRectItem *itemWithFocus = new MyItem; + itemWithFocus->setBrush(Qt::black); + itemWithFocus->setFlag(QGraphicsItem::ItemIsFocusable); + itemWithFocus->setPos(250, 10); + + scene.addItem(noFocusOnTop); + scene.addItem(focusableUnder); + scene.addItem(itemWithFocus); + focusableUnder->stackBefore(noFocusOnTop); + itemWithFocus->setFocus(); + + QGraphicsView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + QApplication::setActiveWindow(&view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); + QVERIFY(itemWithFocus->hasFocus()); + + QPointF mousePressPoint = noFocusOnTop->mapToScene(QPointF()); + mousePressPoint.rx() += 60; + mousePressPoint.ry() += 60; + const QList<QGraphicsItem *> itemsAtMousePressPosition = scene.items(mousePressPoint); + QVERIFY(itemsAtMousePressPosition.contains(focusableUnder)); + + sendMousePress(&scene, mousePressPoint); + QVERIFY(itemWithFocus->hasFocus()); +} + void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor() { struct Item : public QGraphicsTextItem diff --git a/tests/auto/qgraphicsscene/qgraphicsscene.pro b/tests/auto/qgraphicsscene/qgraphicsscene.pro index 401c9eb..cc6f585 100644 --- a/tests/auto/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/qgraphicsscene/qgraphicsscene.pro @@ -6,7 +6,7 @@ win32:!wince*: LIBS += -lUser32 !wince*:!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\" DEFINES += QT_NO_CAST_TO_ASCII -wince*|symbian*: { +wince*|symbian: { rootFiles.sources = Ash_European.jpg graphicsScene_selection.data rootFiles.path = . renderFiles.sources = testData\\render\\* @@ -17,4 +17,4 @@ wince*:{ DEFINES += SRCDIR=\\\".\\\" } -symbian:TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb" +symbian:TARGET.EPOCHEAPSIZE="0x100000 0x1000000" # Min 1Mb, max 16Mb diff --git a/tests/auto/qhash/qhash.pro b/tests/auto/qhash/qhash.pro index 6fedb82..86b98a2 100644 --- a/tests/auto/qhash/qhash.pro +++ b/tests/auto/qhash/qhash.pro @@ -2,7 +2,7 @@ load(qttest_p4) SOURCES += tst_qhash.cpp QT = core -symbian*: { +symbian: { TARGET.EPOCSTACKSIZE =0x5000 -TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb" +TARGET.EPOCHEAPSIZE="0x100000 0x1000000" # // Min 1Mb, max 16Mb } diff --git a/tests/auto/qhttp/qhttp.pro b/tests/auto/qhttp/qhttp.pro index 23a73c4..c0be518 100644 --- a/tests/auto/qhttp/qhttp.pro +++ b/tests/auto/qhttp/qhttp.pro @@ -13,7 +13,7 @@ wince*: { addFiles.path = . DEPLOYMENT = addFiles webFiles cgi DEFINES += SRCDIR=\\\"\\\" -} else:symbian* { +} else:symbian { webFiles.sources = webserver/* webFiles.path = webserver cgi.sources = webserver/cgi-bin/* diff --git a/tests/auto/qicoimageformat/qicoimageformat.pro b/tests/auto/qicoimageformat/qicoimageformat.pro index b9c8622..cabab3f 100644 --- a/tests/auto/qicoimageformat/qicoimageformat.pro +++ b/tests/auto/qicoimageformat/qicoimageformat.pro @@ -12,7 +12,7 @@ wince*: { } addPlugins.path = imageformats DEPLOYMENT += addFiles addPlugins -} else:symbian* { +} else:symbian { addFiles.sources = icons addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qimage/qimage.pro b/tests/auto/qimage/qimage.pro index 3e0bd69..6469211 100644 --- a/tests/auto/qimage/qimage.pro +++ b/tests/auto/qimage/qimage.pro @@ -6,7 +6,7 @@ wince*: { addImages.path = images DEPLOYMENT += addImages DEFINES += SRCDIR=\\\".\\\" -} else:symbian* { +} else:symbian { TARGET.EPOCHEAPSIZE = 0x200000 0x800000 addImages.sources = images/* addImages.path = images diff --git a/tests/auto/qimagereader/qimagereader.pro b/tests/auto/qimagereader/qimagereader.pro index 402e94b..f8fc7fa 100644 --- a/tests/auto/qimagereader/qimagereader.pro +++ b/tests/auto/qimagereader/qimagereader.pro @@ -27,7 +27,7 @@ wince*: { DEFINES += SRCDIR=\\\".\\\" } -symbian*: { +symbian: { images.sources = images images.path = . diff --git a/tests/auto/qimagewriter/qimagewriter.pro b/tests/auto/qimagewriter/qimagewriter.pro index 2171c3e..f25472f 100644 --- a/tests/auto/qimagewriter/qimagewriter.pro +++ b/tests/auto/qimagewriter/qimagewriter.pro @@ -10,7 +10,7 @@ wince*: { addFiles.path = images DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\".\\\" -} else:symbian* { +} else:symbian { addFiles.sources = images\\*.* addFiles.path = images DEPLOYMENT += addFiles diff --git a/tests/auto/qitemmodel/qitemmodel.pro b/tests/auto/qitemmodel/qitemmodel.pro index 2d0bdea..92709fe 100644 --- a/tests/auto/qitemmodel/qitemmodel.pro +++ b/tests/auto/qitemmodel/qitemmodel.pro @@ -15,7 +15,7 @@ QT += sql #} symbian { - TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb" + TARGET.EPOCHEAPSIZE="0x100000 0x1000000" # // Min 1Mb, max 16Mb qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin diff --git a/tests/auto/qlayout/qlayout.pro b/tests/auto/qlayout/qlayout.pro index 0dfe1e9..c99f1d9 100644 --- a/tests/auto/qlayout/qlayout.pro +++ b/tests/auto/qlayout/qlayout.pro @@ -6,7 +6,7 @@ load(qttest_p4) SOURCES += tst_qlayout.cpp contains(QT_CONFIG, qt3support): QT += qt3support -wince*|symbian*: { +wince*|symbian: { addFiles.sources = baseline addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qlibrary/tst/tst.pro b/tests/auto/qlibrary/tst/tst.pro index e15d7ed..4c647c0 100644 --- a/tests/auto/qlibrary/tst/tst.pro +++ b/tests/auto/qlibrary/tst/tst.pro @@ -16,7 +16,7 @@ wince*: { addFiles.path = . DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\"\\\" -}else:symbian* { +}else:symbian { binDep.sources = \ mylib.dll \ system.trolltech.test.mylib.dll diff --git a/tests/auto/qline/qline.pro b/tests/auto/qline/qline.pro index 1a3d7f2..4651fd3 100644 --- a/tests/auto/qline/qline.pro +++ b/tests/auto/qline/qline.pro @@ -1,6 +1,6 @@ load(qttest_p4) QT -= gui SOURCES += tst_qline.cpp -unix:!mac:!symbian*:!vxworks:LIBS+=-lm +unix:!mac:!symbian:!vxworks:LIBS+=-lm diff --git a/tests/auto/qlocalsocket/qlocalsocket.pro b/tests/auto/qlocalsocket/qlocalsocket.pro index 287e946..3911a64 100644 --- a/tests/auto/qlocalsocket/qlocalsocket.pro +++ b/tests/auto/qlocalsocket/qlocalsocket.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs SUBDIRS = lackey test -!wince*:!symbian*: SUBDIRS += example +!wince*:!symbian: SUBDIRS += example symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qmenubar/qmenubar.pro b/tests/auto/qmenubar/qmenubar.pro index a0a6420..adce164 100644 --- a/tests/auto/qmenubar/qmenubar.pro +++ b/tests/auto/qmenubar/qmenubar.pro @@ -2,5 +2,5 @@ load(qttest_p4) HEADERS += SOURCES += tst_qmenubar.cpp -contains(QT_CONFIG, qt3support):!symbian*:QT += qt3support +contains(QT_CONFIG, qt3support):!symbian:QT += qt3support diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 4cb63a1..cc9fb0c 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -168,6 +168,7 @@ private slots: void task256322_highlight(); void menubarSizeHint(); void taskQTBUG4965_escapeEaten(); + void taskQTBUG11823_crashwithInvisibleActions(); #if defined(QT3_SUPPORT) void indexBasedInsertion_data(); @@ -1690,6 +1691,34 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten() QTRY_VERIFY(!menubar.isVisible()); } +void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions() +{ + QMenuBar menubar; + menubar.setNativeMenuBar(false); //we can't check the geometry of native menubars + + QAction * m = menubar.addAction( "&m" ); + QAction * a = menubar.addAction( "&a" ); + + menubar.show(); + QApplication::setActiveWindow(&menubar); + QTest::qWaitForWindowShown(&menubar); + menubar.setActiveAction(m); + QCOMPARE(menubar.activeAction(), m); + QTest::keyClick(0, Qt::Key_Right); + QCOMPARE(menubar.activeAction(), a); + QTest::keyClick(0, Qt::Key_Right); + QCOMPARE(menubar.activeAction(), m); + a->setVisible(false); + + menubar.setActiveAction(m); + QCOMPARE(menubar.activeAction(), m); //the active action shouldn't have changed + + //it used to crash here because the action is invisible + QTest::keyClick(0, Qt::Key_Right); + QCOMPARE(menubar.activeAction(), m); //the active action shouldn't have changed +} + + #if defined(QT3_SUPPORT) void tst_QMenuBar::indexBasedInsertion_data() { diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index b6d4558..62416b1 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -740,6 +740,8 @@ void tst_QMetaObject::normalizedType_data() QTest::newRow("template5") << "QList< ::Foo::Bar>" << "QList< ::Foo::Bar>"; QTest::newRow("template6") << "QList<::Foo::Bar>" << "QList<::Foo::Bar>"; QTest::newRow("template7") << "QList<QList<int> >" << "QList<QList<int> >"; + QTest::newRow("template8") << "QMap<const int, const short*>" << "QMap<const int,const short*>"; + QTest::newRow("template9") << "QPair<const QPair<int, int const *> , QPair<QHash<int, const char*> > >" << "QPair<const QPair<int,const int*>,QPair<QHash<int,const char*> > >"; QTest::newRow("value1") << "const QString &" << "QString"; QTest::newRow("value2") << "QString const &" << "QString"; QTest::newRow("constInName1") << "constconst" << "constconst"; diff --git a/tests/auto/qmovie/qmovie.pro b/tests/auto/qmovie/qmovie.pro index a8ec478..510a70e 100644 --- a/tests/auto/qmovie/qmovie.pro +++ b/tests/auto/qmovie/qmovie.pro @@ -13,7 +13,7 @@ wince*: { } -symbian*: { +symbian: { addFiles.sources = animations\\* addFiles.path = animations DEPLOYMENT += addFiles diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp index e4f2486..24f6e52 100644 --- a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp @@ -75,17 +75,20 @@ private slots: void robustnessBombing(); + void sessionClosing_data(); + void sessionClosing(); + void outOfProcessSession(); void invalidSession(); void repeatedOpenClose_data(); void repeatedOpenClose(); - - void roamingErrorCodes(); - + void sessionStop_data(); void sessionStop(); + void roamingErrorCodes(); + void sessionProperties_data(); void sessionProperties(); @@ -131,6 +134,7 @@ void tst_QNetworkSession::initTestCase() // If you wish to skip tests, set value as false. This is often very convinient because tests are so lengthy. // Better way still would be to make this readable from a file. testsToRun["robustnessBombing"] = true; + testsToRun["sessionClosing"] = true; testsToRun["outOfProcessSession"] = true; testsToRun["invalidSession"] = true; testsToRun["repeatedOpenClose"] = true; @@ -265,6 +269,53 @@ void tst_QNetworkSession::robustnessBombing() testSession.reject(); } +void tst_QNetworkSession::sessionClosing_data() { + QTest::addColumn<QString>("bearerType"); + QTest::addColumn<QNetworkConfiguration::Type>("configurationType"); + + QTest::newRow("WLAN_IAP") << "WLAN" << QNetworkConfiguration::InternetAccessPoint; + QTest::newRow("Cellular_IAP") << "cellular" << QNetworkConfiguration::InternetAccessPoint; + QTest::newRow("SNAP") << "bearer_type_not_relevant_with_SNAPs" << QNetworkConfiguration::ServiceNetwork; +} + +// Testcase for closing the session at unexpected times +void tst_QNetworkSession::sessionClosing() +{ + if (!testsToRun["sessionClosing"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } + QFETCH(QString, bearerType); + QFETCH(QNetworkConfiguration::Type, configurationType); + + // Update configurations so that WLANs are discovered too. + updateConfigurations(); + + // First check that opening once succeeds and determine if test is doable + QNetworkConfiguration config = suitableConfiguration(bearerType, configurationType); + if (!config.isValid()) { + QSKIP("No suitable configurations, skipping this round of repeated open-close test.", SkipSingle); + } + qDebug() << "Using following configuration to bomb with close(): " << config.name(); + QNetworkSession session(config); + if (!openSession(&session) || + !closeSession(&session)) { + QSKIP("Unable to open/close session, skipping this round of close() bombing.", SkipSingle); + } + + qDebug() << "Closing without issuing open()"; + session.close(); + + for (int i = 0; i < 25; i++) { + qDebug() << "Opening and then waiting: " << i * 100 << " ms before closing."; + session.open(); + QTest::qWait(i*100); + session.close(); + // Sooner or later session must end in Disconnected state, + // no matter what the phase was. + QTRY_VERIFY(session.state() == QNetworkSession::Disconnected); + QTest::qWait(200); // Give platform a breathe, otherwise we'll be catching other errors + } +} void tst_QNetworkSession::invalidSession() { @@ -629,7 +680,7 @@ void tst_QNetworkSession::sessionStop() QVERIFY(openSession(&innocentSession)); qDebug("Waiting for %d ms after open to make sure all platform indications are propagated", configWaitdelayInMs); QTest::qWait(configWaitdelayInMs); - qDebug("----------4.2 Calling closedSession.stop()"); + qDebug("----------4.2 Calling closedSession.stop()"); closedSession.stop(); qDebug("Waiting for %d ms to get all configurationChange signals from platform..", configWaitdelayInMs); QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals @@ -1037,21 +1088,28 @@ void tst_QNetworkSession::sessionOpenCloseStop() if (configuration.type() == QNetworkConfiguration::ServiceNetwork) { bool roamedSuccessfully = false; - QCOMPARE(stateChangedSpy2.count(), 4); + QNetworkSession::State state; + if (stateChangedSpy2.count() == 4) { + state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(0).at(0)); + QVERIFY(state == QNetworkSession::Connecting); - QNetworkSession::State state = - qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(0).at(0)); - QVERIFY(state == QNetworkSession::Connecting); + state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(1).at(0)); + QVERIFY(state == QNetworkSession::Connected); - state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(1).at(0)); - QVERIFY(state == QNetworkSession::Connected); + state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(2).at(0)); + QVERIFY(state == QNetworkSession::Closing); - state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(2).at(0)); - QVERIFY(state == QNetworkSession::Closing); + state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(3).at(0)); + QVERIFY(state == QNetworkSession::Disconnected); + } else if (stateChangedSpy2.count() == 2) { + state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(0).at(0)); + QVERIFY(state == QNetworkSession::Closing); - state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(3).at(0)); - QVERIFY(state == QNetworkSession::Disconnected); - + state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(1).at(0)); + QVERIFY(state == QNetworkSession::Disconnected); + } else { + QFAIL("Unexpected amount of state changes when roaming."); + } QTRY_VERIFY(session.state() == QNetworkSession::Roaming || session.state() == QNetworkSession::Connected || @@ -1060,30 +1118,44 @@ void tst_QNetworkSession::sessionOpenCloseStop() QTRY_VERIFY(stateChangedSpy.count() > 0); state = qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(stateChangedSpy.count() - 1).at(0)); + for (int i = 0; i < stateChangedSpy.count(); i++) { + QNetworkSession::State state_temp = + qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(i).at(0)); + // Extra debug because a fragile point in testcase because statuses vary. + qDebug() << "------- Statechange spy at: " << i << " is " << state_temp; + } + if (state == QNetworkSession::Roaming) { QTRY_VERIFY(session.state() == QNetworkSession::Connected); QTRY_VERIFY(session2.state() == QNetworkSession::Connected); roamedSuccessfully = true; + } else if (state == QNetworkSession::Closing) { + QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected); + QTRY_VERIFY(session.state() == QNetworkSession::Connected); + roamedSuccessfully = true; } else if (state == QNetworkSession::Disconnected) { QTRY_VERIFY(!errorSpy.isEmpty()); QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected); } else if (state == QNetworkSession::Connected) { QTRY_VERIFY(errorSpy.isEmpty()); + if (stateChangedSpy.count() > 1) { state = qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(stateChangedSpy.count() - 2).at(0)); QVERIFY(state == QNetworkSession::Roaming); } roamedSuccessfully = true; - } + } if (roamedSuccessfully) { + // Verify that you can open session based on the disconnected configuration QString configId = session.sessionProperty("ActiveConfiguration").toString(); - QNetworkConfiguration config = manager.configurationFromIdentifier(configId); + QNetworkConfiguration config = manager.configurationFromIdentifier(configId); QNetworkSession session3(config); QSignalSpy errorSpy3(&session3, SIGNAL(error(QNetworkSession::SessionError))); QSignalSpy sessionOpenedSpy3(&session3, SIGNAL(opened())); session3.open(); - session3.waitForOpened(); + session3.waitForOpened(); + QTest::qWait(1000); // Wait awhile to get all signals from platform if (session.isOpen()) QVERIFY(!sessionOpenedSpy3.isEmpty() || !errorSpy3.isEmpty()); session.stop(); @@ -1102,9 +1174,18 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(state == QNetworkSession::Closing); state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(1).at(0)); QVERIFY(state == QNetworkSession::Disconnected); - } else { // Assume .count() == 1 - QCOMPARE(stateChangedSpy2.count(), 1); - QNetworkSession::State state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(0).at(0)); + } else { + QVERIFY(stateChangedSpy2.count() >= 1); + + for (int i = 0; i < stateChangedSpy2.count(); i++) { + QNetworkSession::State state_temp = + qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(i).at(0)); + // Extra debug because a fragile point in testcase. + qDebug() << "+++++ Statechange spy at: " << i << " is " << state_temp; + } + + QNetworkSession::State state = + qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(stateChangedSpy2.count() - 1).at(0)); // Symbian version dependant. QVERIFY(state == QNetworkSession::Disconnected); } diff --git a/tests/auto/qpainter/qpainter.pro b/tests/auto/qpainter/qpainter.pro index c8446d1..69dc98d 100644 --- a/tests/auto/qpainter/qpainter.pro +++ b/tests/auto/qpainter/qpainter.pro @@ -1,7 +1,7 @@ load(qttest_p4) contains(QT_CONFIG, qt3support): QT += qt3support SOURCES += tst_qpainter.cpp -wince*|symbian*: { +wince*|symbian: { addFiles.sources = drawEllipse drawLine_rop_bitmap drawPixmap_rop drawPixmap_rop_bitmap task217400.png addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 701dc2e..27ee6e7 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -2648,12 +2648,16 @@ void tst_QPainter::setOpacity() p.drawImage(imageRect, src, imageRect); p.end(); - QImage expected(imageSize, destFormat); - p.begin(&expected); - p.fillRect(imageRect, QColor(127, 127, 127)); - p.end(); - - QCOMPARE(dest, expected); + QImage actual = dest.convertToFormat(QImage::Format_RGB32); + + for (int y = 0; y < actual.height(); ++y) { + QRgb *p = (QRgb *)actual.scanLine(y); + for (int x = 0; x < actual.width(); ++x) { + QVERIFY(qAbs(qRed(p[x]) - 127) <= 0xf); + QVERIFY(qAbs(qGreen(p[x]) - 127) <= 0xf); + QVERIFY(qAbs(qBlue(p[x]) - 127) <= 0xf); + } + } } void tst_QPainter::drawhelper_blend_untransformed_data() diff --git a/tests/auto/qpathclipper/qpathclipper.pro b/tests/auto/qpathclipper/qpathclipper.pro index 930a6f2..590fba0 100644 --- a/tests/auto/qpathclipper/qpathclipper.pro +++ b/tests/auto/qpathclipper/qpathclipper.pro @@ -5,6 +5,6 @@ SOURCES += tst_qpathclipper.cpp paths.cpp requires(contains(QT_CONFIG,private_tests)) -unix:!mac:!symbian*:LIBS+=-lm +unix:!mac:!symbian:LIBS+=-lm diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif Binary files differnew file mode 100644 index 0000000..f813c05 --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif diff --git a/tests/auto/qpixmap/qpixmap.pro b/tests/auto/qpixmap/qpixmap.pro index a3577bd..c3ee192 100644 --- a/tests/auto/qpixmap/qpixmap.pro +++ b/tests/auto/qpixmap/qpixmap.pro @@ -1,7 +1,7 @@ load(qttest_p4) SOURCES += tst_qpixmap.cpp contains(QT_CONFIG, qt3support): QT += qt3support -wince*|symbian*: { +wince*|symbian: { task31722_0.sources = convertFromImage/task31722_0/*.png task31722_0.path = convertFromImage/task31722_0 @@ -18,7 +18,7 @@ wince*|symbian*: { wince*: { DEFINES += SRCDIR=\\\".\\\" -} else:symbian* { +} else:symbian { DEPLOYMENT_PLUGIN += qmng LIBS += -lfbscli.dll -lbitgdi.dll -lgdi.dll contains(QT_CONFIG, openvg) { diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 179f068..f22edf6 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -44,6 +44,7 @@ #include <qpixmap.h> #include <qbitmap.h> #include <qimage.h> +#include <qimagereader.h> #include <qmatrix.h> #include <qdesktopwidget.h> #include <qpaintengine.h> @@ -175,6 +176,11 @@ private slots: void loadFromDataImage_data(); void loadFromDataImage(); + void fromImageReader_data(); + void fromImageReader(); + + void fromImageReaderAnimatedGif(); + void preserveDepth(); void splash_crash(); @@ -1577,6 +1583,61 @@ void tst_QPixmap::loadFromDataImage() QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap)); } +void tst_QPixmap::fromImageReader_data() +{ + QTest::addColumn<QString>("imagePath"); +#ifdef Q_OS_SYMBIAN + const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; +#else + const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; +#endif + QTest::newRow("designer_argb32.png") << prefix + "/designer_argb32.png"; + QTest::newRow("designer_indexed8_no_alpha.png") << prefix + "/designer_indexed8_no_alpha.png"; + QTest::newRow("designer_indexed8_with_alpha.png") << prefix + "/designer_indexed8_with_alpha.png"; + QTest::newRow("designer_rgb32.png") << prefix + "/designer_rgb32.png"; + QTest::newRow("designer_indexed8_no_alpha.gif") << prefix + "/designer_indexed8_no_alpha.gif"; + QTest::newRow("designer_indexed8_with_alpha.gif") << prefix + "/designer_indexed8_with_alpha.gif"; + QTest::newRow("designer_rgb32.jpg") << prefix + "/designer_rgb32.jpg"; +} + +void tst_QPixmap::fromImageReader() +{ + QFETCH(QString, imagePath); + + QImage imageRef(imagePath); + QPixmap pixmapWithCopy = QPixmap::fromImage(imageRef); + + QImageReader imageReader(imagePath); + + QPixmap directLoadingPixmap = QPixmap::fromImageReader(&imageReader); + + QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap)); +} + +void tst_QPixmap::fromImageReaderAnimatedGif() +{ +#ifdef Q_OS_SYMBIAN + const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; +#else + const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; +#endif + const QString path = prefix + QString::fromLatin1("/designer_indexed8_with_alpha_animated.gif"); + + QImageReader referenceReader(path); + QImageReader pixmapReader(path); + + Q_ASSERT(referenceReader.canRead()); + Q_ASSERT(referenceReader.imageCount() > 1); + + for (int i = 0; i < referenceReader.imageCount(); ++i) { + QImage refImage = referenceReader.read(); + QPixmap refPixmap = QPixmap::fromImage(refImage); + + QPixmap directLoadingPixmap = QPixmap::fromImageReader(&pixmapReader); + QVERIFY(pixmapsAreEqual(&refPixmap, &directLoadingPixmap)); + } +} + void tst_QPixmap::task_246446() { // This crashed without the bugfix in 246446 diff --git a/tests/auto/qprocess/testDetached/testDetached.pro b/tests/auto/qprocess/testDetached/testDetached.pro index 319cfa6..80a616b 100644 --- a/tests/auto/qprocess/testDetached/testDetached.pro +++ b/tests/auto/qprocess/testDetached/testDetached.pro @@ -5,6 +5,6 @@ CONFIG -= app_bundle INSTALLS = DESTDIR = ./ -symbian*: { +symbian: { TARGET.EPOCSTACKSIZE =0x14000 } diff --git a/tests/auto/qresourceengine/qresourceengine.pro b/tests/auto/qresourceengine/qresourceengine.pro index 3e47b52..17e36af 100644 --- a/tests/auto/qresourceengine/qresourceengine.pro +++ b/tests/auto/qresourceengine/qresourceengine.pro @@ -20,7 +20,7 @@ QMAKE_EXTRA_TARGETS = runtime_resource PRE_TARGETDEPS += $${runtime_resource.target} QT = core -wince*|symbian*:{ +wince*|symbian:{ deploy.sources += runtime_resource.rcc parentdir.txt test.sources = testqrc/* test.path = testqrc diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro index 7d0f5d0..fc35f66 100644 --- a/tests/auto/qscriptengine/qscriptengine.pro +++ b/tests/auto/qscriptengine/qscriptengine.pro @@ -9,7 +9,7 @@ wince* { DEFINES += SRCDIR=\\\"$$PWD\\\" } -wince*|symbian*: { +wince*|symbian: { addFiles.sources = script addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 5e59950..6885adf 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -51,6 +51,8 @@ #include <QtCore/qnumeric.h> #include <stdlib.h> +#include <QtScript/private/qscriptdeclarativeclass_p.h> + Q_DECLARE_METATYPE(QList<int>) Q_DECLARE_METATYPE(QObjectList) Q_DECLARE_METATYPE(QScriptProgram) @@ -169,6 +171,8 @@ private slots: void qRegExpInport_data(); void qRegExpInport(); void reentrency(); + void newFixedStaticScopeObject(); + void newGrowingStaticScopeObject(); }; tst_QScriptEngine::tst_QScriptEngine() @@ -4955,5 +4959,243 @@ void tst_QScriptEngine::reentrency() QCOMPARE(eng.evaluate("foo() + hello").toInt32(), 5+6+9); } +void tst_QScriptEngine::newFixedStaticScopeObject() +{ + QScriptEngine eng; + static const int propertyCount = 4; + QString names[] = { "foo", "bar", "baz", "Math" }; + QScriptValue values[] = { 123, "ciao", true, false }; + QScriptValue::PropertyFlags flags[] = { QScriptValue::Undeletable, + QScriptValue::ReadOnly | QScriptValue::Undeletable, + QScriptValue::SkipInEnumeration | QScriptValue::Undeletable, + QScriptValue::Undeletable }; + QScriptValue scope = QScriptDeclarativeClass::newStaticScopeObject(&eng, propertyCount, names, values, flags); + + // Query property. + for (int i = 0; i < propertyCount; ++i) { + for (int x = 0; x < 2; ++x) { + if (x) { + // Properties can't be deleted. + scope.setProperty(names[i], QScriptValue()); + } + QVERIFY(scope.property(names[i]).equals(values[i])); + QCOMPARE(scope.propertyFlags(names[i]), flags[i]); + } + } + + // Property that doesn't exist. + QVERIFY(!scope.property("noSuchProperty").isValid()); + QCOMPARE(scope.propertyFlags("noSuchProperty"), QScriptValue::PropertyFlags()); + + // Write to writable property. + { + QScriptValue oldValue = scope.property("foo"); + QVERIFY(oldValue.isNumber()); + QScriptValue newValue = oldValue.toNumber() * 2; + scope.setProperty("foo", newValue); + QVERIFY(scope.property("foo").equals(newValue)); + scope.setProperty("foo", oldValue); + QVERIFY(scope.property("foo").equals(oldValue)); + } + + // Write to read-only property. + scope.setProperty("bar", 456); + QVERIFY(scope.property("bar").equals("ciao")); + + // Iterate. + { + QScriptValueIterator it(scope); + QSet<QString> iteratedNames; + while (it.hasNext()) { + it.next(); + iteratedNames.insert(it.name()); + } + for (int i = 0; i < propertyCount; ++i) + QVERIFY(iteratedNames.contains(names[i])); + } + + // Push it on the scope chain of a new context. + QScriptContext *ctx = eng.pushContext(); + ctx->pushScope(scope); + QCOMPARE(ctx->scopeChain().size(), 3); // Global Object, native activation, custom scope + QVERIFY(ctx->activationObject().equals(scope)); + + // Read property from JS. + for (int i = 0; i < propertyCount; ++i) { + for (int x = 0; x < 2; ++x) { + if (x) { + // Property can't be deleted from JS. + QScriptValue ret = eng.evaluate(QString::fromLatin1("delete %0").arg(names[i])); + QVERIFY(ret.equals(false)); + } + QVERIFY(eng.evaluate(names[i]).equals(values[i])); + } + } + + // Property that doesn't exist. + QVERIFY(eng.evaluate("noSuchProperty").equals("ReferenceError: Can't find variable: noSuchProperty")); + + // Write property from JS. + { + QScriptValue oldValue = eng.evaluate("foo"); + QVERIFY(oldValue.isNumber()); + QScriptValue newValue = oldValue.toNumber() * 2; + QVERIFY(eng.evaluate("foo = foo * 2; foo").equals(newValue)); + scope.setProperty("foo", oldValue); + QVERIFY(eng.evaluate("foo").equals(oldValue)); + } + + // Write to read-only property. + QVERIFY(eng.evaluate("bar = 456; bar").equals("ciao")); + + // Create a closure and return properties from there. + { + QScriptValue props = eng.evaluate("(function() { var baz = 'shadow'; return [foo, bar, baz, Math, Array]; })()"); + QVERIFY(props.isArray()); + // "foo" and "bar" come from scope object. + QVERIFY(props.property(0).equals(scope.property("foo"))); + QVERIFY(props.property(1).equals(scope.property("bar"))); + // "baz" shadows property in scope object. + QVERIFY(props.property(2).equals("shadow")); + // "Math" comes from scope object, and shadows Global Object's "Math". + QVERIFY(props.property(3).equals(scope.property("Math"))); + QVERIFY(!props.property(3).equals(eng.globalObject().property("Math"))); + // "Array" comes from Global Object. + QVERIFY(props.property(4).equals(eng.globalObject().property("Array"))); + } + + // As with normal JS, assigning to an undefined variable will create + // the property on the Global Object, not the inner scope. + QVERIFY(!eng.globalObject().property("newProperty").isValid()); + QVERIFY(eng.evaluate("(function() { newProperty = 789; })()").isUndefined()); + QVERIFY(!scope.property("newProperty").isValid()); + QVERIFY(eng.globalObject().property("newProperty").isNumber()); + + // Nested static scope. + { + static const int propertyCount2 = 2; + QString names2[] = { "foo", "hum" }; + QScriptValue values2[] = { 321, "hello" }; + QScriptValue::PropertyFlags flags2[] = { QScriptValue::Undeletable, + QScriptValue::ReadOnly | QScriptValue::Undeletable }; + QScriptValue scope2 = QScriptDeclarativeClass::newStaticScopeObject(&eng, propertyCount2, names2, values2, flags2); + ctx->pushScope(scope2); + + // "foo" shadows scope.foo. + QVERIFY(eng.evaluate("foo").equals(scope2.property("foo"))); + QVERIFY(!eng.evaluate("foo").equals(scope.property("foo"))); + // "hum" comes from scope2. + QVERIFY(eng.evaluate("hum").equals(scope2.property("hum"))); + // "Array" comes from Global Object. + QVERIFY(eng.evaluate("Array").equals(eng.globalObject().property("Array"))); + + ctx->popScope(); + } + + QScriptValue fun = eng.evaluate("(function() { return foo; })"); + QVERIFY(fun.isFunction()); + eng.popContext(); + // Function's scope chain persists after popContext(). + QVERIFY(fun.call().equals(scope.property("foo"))); +} + +void tst_QScriptEngine::newGrowingStaticScopeObject() +{ + QScriptEngine eng; + QScriptValue scope = QScriptDeclarativeClass::newStaticScopeObject(&eng); + + // Initially empty. + QVERIFY(!QScriptValueIterator(scope).hasNext()); + QVERIFY(!scope.property("foo").isValid()); + + // Add a static property. + scope.setProperty("foo", 123); + QVERIFY(scope.property("foo").equals(123)); + QCOMPARE(scope.propertyFlags("foo"), QScriptValue::Undeletable); + + // Modify existing property. + scope.setProperty("foo", 456); + QVERIFY(scope.property("foo").equals(456)); + + // Add a read-only property. + scope.setProperty("bar", "ciao", QScriptValue::ReadOnly); + QVERIFY(scope.property("bar").equals("ciao")); + QCOMPARE(scope.propertyFlags("bar"), QScriptValue::ReadOnly | QScriptValue::Undeletable); + + // Attempt to modify read-only property. + scope.setProperty("bar", "hello"); + QVERIFY(scope.property("bar").equals("ciao")); + + // Properties can't be deleted. + scope.setProperty("foo", QScriptValue()); + QVERIFY(scope.property("foo").equals(456)); + scope.setProperty("bar", QScriptValue()); + QVERIFY(scope.property("bar").equals("ciao")); + + // Iterate. + { + QScriptValueIterator it(scope); + QSet<QString> iteratedNames; + while (it.hasNext()) { + it.next(); + iteratedNames.insert(it.name()); + } + QCOMPARE(iteratedNames.size(), 2); + QVERIFY(iteratedNames.contains("foo")); + QVERIFY(iteratedNames.contains("bar")); + } + + // Push it on the scope chain of a new context. + QScriptContext *ctx = eng.pushContext(); + ctx->pushScope(scope); + QCOMPARE(ctx->scopeChain().size(), 3); // Global Object, native activation, custom scope + QVERIFY(ctx->activationObject().equals(scope)); + + // Read property from JS. + QVERIFY(eng.evaluate("foo").equals(scope.property("foo"))); + QVERIFY(eng.evaluate("bar").equals(scope.property("bar"))); + + // Write property from JS. + { + QScriptValue oldValue = eng.evaluate("foo"); + QVERIFY(oldValue.isNumber()); + QScriptValue newValue = oldValue.toNumber() * 2; + QVERIFY(eng.evaluate("foo = foo * 2; foo").equals(newValue)); + scope.setProperty("foo", oldValue); + QVERIFY(eng.evaluate("foo").equals(oldValue)); + } + + // Write to read-only property. + QVERIFY(eng.evaluate("bar = 456; bar").equals("ciao")); + + // Shadow property. + QVERIFY(eng.evaluate("Math").equals(eng.globalObject().property("Math"))); + scope.setProperty("Math", "fake Math"); + QVERIFY(eng.evaluate("Math").equals(scope.property("Math"))); + + // Variable declarations will create properties on the scope. + eng.evaluate("var baz = 456"); + QVERIFY(scope.property("baz").equals(456)); + + // Function declarations will create properties on the scope. + eng.evaluate("function fun() { return baz; }"); + QVERIFY(scope.property("fun").isFunction()); + QVERIFY(scope.property("fun").call().equals(scope.property("baz"))); + + // Demonstrate the limitation of a growable static scope: Once a function that + // uses the scope has been compiled, it won't pick up properties that are added + // to the scope later. + { + QScriptValue fun = eng.evaluate("(function() { return futureProperty; })"); + QVERIFY(fun.isFunction()); + QCOMPARE(fun.call().toString(), QString::fromLatin1("ReferenceError: Can't find variable: futureProperty")); + scope.setProperty("futureProperty", "added after the function was compiled"); + // If scope were dynamic, this would return the new property. + QCOMPARE(fun.call().toString(), QString::fromLatin1("ReferenceError: Can't find variable: futureProperty")); + } + + eng.popContext(); +} + QTEST_MAIN(tst_QScriptEngine) #include "tst_qscriptengine.moc" diff --git a/tests/auto/qsemaphore/tst_qsemaphore.cpp b/tests/auto/qsemaphore/tst_qsemaphore.cpp index ace33dc..7cede30 100644 --- a/tests/auto/qsemaphore/tst_qsemaphore.cpp +++ b/tests/auto/qsemaphore/tst_qsemaphore.cpp @@ -63,6 +63,7 @@ private slots: void tryAcquire(); void tryAcquireWithTimeout_data(); void tryAcquireWithTimeout(); + void tryAcquireWithTimeoutStarvation(); void release(); void available(); void producerConsumer(); @@ -232,8 +233,8 @@ void tst_QSemaphore::tryAcquireWithTimeout_data() { QTest::addColumn<int>("timeout"); - QTest::newRow("") << 1000; - QTest::newRow("") << 10000; + QTest::newRow("1s") << 1000; + QTest::newRow("10s") << 10000; } void tst_QSemaphore::tryAcquireWithTimeout() @@ -316,6 +317,50 @@ void tst_QSemaphore::tryAcquireWithTimeout() QCOMPARE(semaphore.available(), 0); } +void tst_QSemaphore::tryAcquireWithTimeoutStarvation() +{ + class Thread : public QThread + { + public: + QSemaphore startup; + QSemaphore *semaphore; + int amountToConsume, timeout; + + void run() + { + startup.release(); + forever { + if (!semaphore->tryAcquire(amountToConsume, timeout)) + break; + semaphore->release(amountToConsume); + } + } + }; + + QSemaphore semaphore; + semaphore.release(1); + + Thread consumer; + consumer.semaphore = &semaphore; + consumer.amountToConsume = 1; + consumer.timeout = 1000; + + // start the thread and wait for it to start consuming + consumer.start(); + consumer.startup.acquire(); + + // try to consume more than the thread we started is, and provide a longer + // timeout... we should timeout, not wait indefinitely + QVERIFY(!semaphore.tryAcquire(consumer.amountToConsume * 2, consumer.timeout * 2)); + + // the consumer should still be running + QVERIFY(consumer.isRunning() && !consumer.isFinished()); + + // acquire, and wait for smallConsumer to timeout + semaphore.acquire(); + QVERIFY(consumer.wait()); +} + void tst_QSemaphore::release() { DEPENDS_ON("acquire"); } diff --git a/tests/auto/qset/qset.pro b/tests/auto/qset/qset.pro index 05ad07d..b45a015 100644 --- a/tests/auto/qset/qset.pro +++ b/tests/auto/qset/qset.pro @@ -2,7 +2,7 @@ load(qttest_p4) SOURCES += tst_qset.cpp QT = core -symbian*: { +symbian: { TARGET.EPOCSTACKSIZE =0x5000 -TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb" +TARGET.EPOCHEAPSIZE="0x100000 0x1000000" # // Min 1Mb, max 16Mb } diff --git a/tests/auto/qsound/qsound.pro b/tests/auto/qsound/qsound.pro index 383a085..bb1981c 100644 --- a/tests/auto/qsound/qsound.pro +++ b/tests/auto/qsound/qsound.pro @@ -1,7 +1,7 @@ load(qttest_p4) SOURCES += tst_qsound.cpp -wince*|symbian*: { +wince*|symbian: { deploy.sources += 4.wav DEPLOYMENT = deploy !symbian:DEFINES += SRCDIR=\\\"\\\" diff --git a/tests/auto/qsplitter/qsplitter.pro b/tests/auto/qsplitter/qsplitter.pro index 5ec2b9d..b11e408 100644 --- a/tests/auto/qsplitter/qsplitter.pro +++ b/tests/auto/qsplitter/qsplitter.pro @@ -4,7 +4,7 @@ SOURCES += tst_qsplitter.cpp contains(QT_CONFIG, qt3support): QT += qt3support -wince*|symbian*: { +wince*|symbian: { addFiles.sources = extradata.txt setSizes3.dat addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qstyle/qstyle.pro b/tests/auto/qstyle/qstyle.pro index 1ffe369..11f5943 100644 --- a/tests/auto/qstyle/qstyle.pro +++ b/tests/auto/qstyle/qstyle.pro @@ -2,7 +2,7 @@ load(qttest_p4) TARGET.EPOCHEAPSIZE = 0x200000 0x800000 SOURCES += tst_qstyle.cpp -wince*|symbian*: { +wince*|symbian: { !symbian:DEFINES += SRCDIR=\\\".\\\" addPixmap.sources = task_25863.png addPixmap.path = . diff --git a/tests/auto/qtcpsocket/qtcpsocket.pro b/tests/auto/qtcpsocket/qtcpsocket.pro index 370a695..8b1f664 100644 --- a/tests/auto/qtcpsocket/qtcpsocket.pro +++ b/tests/auto/qtcpsocket/qtcpsocket.pro @@ -2,7 +2,7 @@ TEMPLATE = subdirs !wince*: SUBDIRS = test stressTest -wince*|symbian*|vxworks* : SUBDIRS = test +wince*|symbian|vxworks* : SUBDIRS = test requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro index cba5a74..aa1fbb5 100644 --- a/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro +++ b/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro @@ -4,7 +4,7 @@ HEADERS += SOURCES += tst_qtextboundaryfinder.cpp !symbian:*:DEFINES += SRCDIR=\\\"$$PWD\\\" -wince*|symbian*:{ +wince*|symbian:{ addFiles.sources = data addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qtextbrowser/qtextbrowser.pro b/tests/auto/qtextbrowser/qtextbrowser.pro index e159a3c..88061a9 100644 --- a/tests/auto/qtextbrowser/qtextbrowser.pro +++ b/tests/auto/qtextbrowser/qtextbrowser.pro @@ -1,11 +1,11 @@ load(qttest_p4) SOURCES += tst_qtextbrowser.cpp -!symbian*:DEFINES += SRCDIR=\\\"$$PWD\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\" contains(QT_CONFIG, qt3support): QT += qt3support -wince*|symbian*: { +wince*|symbian: { addFiles.sources = *.html addFiles.path = . addDir.sources = subdir/* diff --git a/tests/auto/qtextedit/qtextedit.pro b/tests/auto/qtextedit/qtextedit.pro index 3efabad..43813da 100644 --- a/tests/auto/qtextedit/qtextedit.pro +++ b/tests/auto/qtextedit/qtextedit.pro @@ -5,7 +5,7 @@ INCLUDEPATH += ../ HEADERS += SOURCES += tst_qtextedit.cpp -wince*|symbian*: { +wince*|symbian: { addImages.sources = fullWidthSelection/* addImages.path = fullWidthSelection DEPLOYMENT += addImages diff --git a/tests/auto/qthread/qthread.pro b/tests/auto/qthread/qthread.pro index 4ea8fe5..0b042ab 100644 --- a/tests/auto/qthread/qthread.pro +++ b/tests/auto/qthread/qthread.pro @@ -1,4 +1,4 @@ load(qttest_p4) SOURCES += tst_qthread.cpp QT = core -symbian*:LIBS += -llibpthread +symbian:LIBS += -llibpthread diff --git a/tests/auto/qthreadstorage/qthreadstorage.pro b/tests/auto/qthreadstorage/qthreadstorage.pro index 376ba65..3071098 100644 --- a/tests/auto/qthreadstorage/qthreadstorage.pro +++ b/tests/auto/qthreadstorage/qthreadstorage.pro @@ -1,4 +1,4 @@ load(qttest_p4) SOURCES += tst_qthreadstorage.cpp QT = core -symbian*:LIBS += -llibpthread +symbian:LIBS += -llibpthread diff --git a/tests/auto/qtipc/qsharedmemory/test/test.pro b/tests/auto/qtipc/qsharedmemory/test/test.pro index 4ff5486..68a5362 100644 --- a/tests/auto/qtipc/qsharedmemory/test/test.pro +++ b/tests/auto/qtipc/qsharedmemory/test/test.pro @@ -24,7 +24,7 @@ addFiles.sources = $$OUT_PWD/../../lackey/lackey.exe ../../lackey/scripts addFiles.path = . DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\".\\\" -}else:symbian*{ +}else:symbian{ requires(contains(QT_CONFIG,script)) QT += gui script addFiles.sources = ../../lackey/scripts diff --git a/tests/auto/qtransform/qtransform.pro b/tests/auto/qtransform/qtransform.pro index 298feb2..92bef8c 100644 --- a/tests/auto/qtransform/qtransform.pro +++ b/tests/auto/qtransform/qtransform.pro @@ -2,6 +2,6 @@ load(qttest_p4) HEADERS += SOURCES += tst_qtransform.cpp -unix:!mac:!symbian*:LIBS+=-lm +unix:!mac:!symbian:LIBS+=-lm diff --git a/tests/auto/qtranslator/qtranslator.pro b/tests/auto/qtranslator/qtranslator.pro index 2b08b4a..5b742f7 100644 --- a/tests/auto/qtranslator/qtranslator.pro +++ b/tests/auto/qtranslator/qtranslator.pro @@ -2,7 +2,7 @@ load(qttest_p4) SOURCES += tst_qtranslator.cpp RESOURCES += qtranslator.qrc -wince*|symbian*: { +wince*|symbian: { addFiles.sources = hellotr_la.qm msgfmt_from_po.qm addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qtwidgets/qtwidgets.pro b/tests/auto/qtwidgets/qtwidgets.pro index b762acb..9c33cd1 100644 --- a/tests/auto/qtwidgets/qtwidgets.pro +++ b/tests/auto/qtwidgets/qtwidgets.pro @@ -1,5 +1,5 @@ load(qttest_p4) -symbian*:TARGET.EPOCHEAPSIZE=0x200000 0xa00000 +symbian:TARGET.EPOCHEAPSIZE=0x200000 0xa00000 SOURCES += tst_qtwidgets.cpp mainwindow.cpp HEADERS += mainwindow.h diff --git a/tests/auto/qudpsocket/test/test.pro b/tests/auto/qudpsocket/test/test.pro index 44d3d30..9c0d009 100644 --- a/tests/auto/qudpsocket/test/test.pro +++ b/tests/auto/qudpsocket/test/test.pro @@ -14,7 +14,7 @@ win32 { DESTDIR = ../ } -wince*|symbian*: { +wince*|symbian: { addApp.sources = ../clientserver/clientserver.exe addApp.path = clientserver DEPLOYMENT += addApp diff --git a/tests/auto/qwmatrix/qwmatrix.pro b/tests/auto/qwmatrix/qwmatrix.pro index 58ea706..bab298b 100644 --- a/tests/auto/qwmatrix/qwmatrix.pro +++ b/tests/auto/qwmatrix/qwmatrix.pro @@ -1,6 +1,6 @@ load(qttest_p4) SOURCES += tst_qwmatrix.cpp -unix:!mac:!symbian*:LIBS+=-lm +unix:!mac:!symbian:LIBS+=-lm diff --git a/tests/auto/qxml/qxml.pro b/tests/auto/qxml/qxml.pro index 304fc54..5fb7fe2 100644 --- a/tests/auto/qxml/qxml.pro +++ b/tests/auto/qxml/qxml.pro @@ -3,7 +3,7 @@ load(qttest_p4) SOURCES += tst_qxml.cpp QT = core xml -wince*|symbian*: { +wince*|symbian: { addFiles.sources = 0x010D.xml addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qxmlformatter/qxmlformatter.pro b/tests/auto/qxmlformatter/qxmlformatter.pro index 4c00d73..339fa55 100644 --- a/tests/auto/qxmlformatter/qxmlformatter.pro +++ b/tests/auto/qxmlformatter/qxmlformatter.pro @@ -3,7 +3,7 @@ SOURCES += tst_qxmlformatter.cpp include (../xmlpatterns.pri) -wince*|symbian*:{ +wince*|symbian:{ addFiles.sources = baselines input addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qxmlquery/qxmlquery.pro b/tests/auto/qxmlquery/qxmlquery.pro index cfab564..ae73488 100644 --- a/tests/auto/qxmlquery/qxmlquery.pro +++ b/tests/auto/qxmlquery/qxmlquery.pro @@ -18,7 +18,7 @@ wince* { include (../xmlpatterns.pri) -wince*|symbian*: { +wince*|symbian: { addFiles.sources = pushBaselines input.xml addFiles.path = . diff --git a/tests/auto/qxmlsimplereader/qxmlsimplereader.pro b/tests/auto/qxmlsimplereader/qxmlsimplereader.pro index bfdec58..c107470 100644 --- a/tests/auto/qxmlsimplereader/qxmlsimplereader.pro +++ b/tests/auto/qxmlsimplereader/qxmlsimplereader.pro @@ -12,7 +12,7 @@ QT += network xml QT -= gui -wince*|symbian*: { +wince*|symbian: { addFiles.sources = encodings parser xmldocs addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qxmlstream/qxmlstream.pro b/tests/auto/qxmlstream/qxmlstream.pro index f82a7b3..8f076be 100644 --- a/tests/auto/qxmlstream/qxmlstream.pro +++ b/tests/auto/qxmlstream/qxmlstream.pro @@ -4,7 +4,7 @@ SOURCES += tst_qxmlstream.cpp QT = core xml network -wince*|symbian*: { +wince*|symbian: { addFiles.sources = data XML-Test-Suite addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/benchmarks/opengl/main.cpp b/tests/benchmarks/opengl/main.cpp index beb4d43..c042fce 100644 --- a/tests/benchmarks/opengl/main.cpp +++ b/tests/benchmarks/opengl/main.cpp @@ -75,6 +75,10 @@ private slots: void gradients_data(); void gradients(); + void textureUpload_data(); + void textureUpload(); + + private: QGLPixelBuffer *pb; }; @@ -374,6 +378,53 @@ void OpenGLBench::gradients() } } +void OpenGLBench::textureUpload_data() +{ + QTest::addColumn<int>("size"); + QTest::addColumn<int>("flags"); + QTest::addColumn<int>("format"); + + int sizes[] = { 8, 10, 16, 20, 32, 50, 64, 100, 128, 200, 256, 500, 512, 1000, 1024, 2000, 2048, -1 }; + int flags[] = { QGLContext::InternalBindOption, + QGLContext::DefaultBindOption, + -1 }; + int formats[] = { GL_RGB, GL_RGBA, -1 }; + + for (int s = 0; sizes[s] != -1; ++s) { + for (int f = 0; flags[f] != -1; ++f) { + for (int a = 0; formats[a] != -1; ++a) { + QByteArray name; + name.append("size=").append(QByteArray::number(sizes[s])); + name.append(", flags=").append(f == 0 ? "internal" : "default"); + name.append(", format=").append(a == 0 ? "RGB" : "RGBA"); + QTest::newRow(name.constData()) << sizes[s] << flags[f] << formats[a]; + } + } + } +} + +void OpenGLBench::textureUpload() +{ + QFETCH(int, size); + QFETCH(int, flags); + QFETCH(int, format); + + QPixmap pixmap(size, size); + + if (format == GL_RGB) + pixmap.fill(Qt::red); + else + pixmap.fill(Qt::transparent); + + pb->makeCurrent(); + QGLContext *context = const_cast<QGLContext *>(QGLContext::currentContext()); + QTime time; + + time.start(); + context->bindTexture(pixmap, GL_TEXTURE_2D, format, (QGLContext::BindOptions) flags); + QTest::setBenchmarkResult(time.elapsed(), QTest::WalltimeMilliseconds); +} + QTEST_MAIN(OpenGLBench) #include "main.moc" diff --git a/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp index 35e2f28..4610046 100644 --- a/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp +++ b/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp @@ -42,6 +42,8 @@ #include <qtest.h> #include <QtScript> +#include <QtScript/private/qscriptdeclarativeclass_p.h> + //TESTED_FILES= class tst_QScriptEngine : public QObject @@ -74,6 +76,8 @@ private slots: void nativeCall(); void translation_data(); void translation(); + void readScopeProperty_data(); + void readScopeProperty(); }; tst_QScriptEngine::tst_QScriptEngine() @@ -288,5 +292,53 @@ void tst_QScriptEngine::translation() } } +void tst_QScriptEngine::readScopeProperty_data() +{ + QTest::addColumn<bool>("staticScope"); + QTest::addColumn<bool>("nestedScope"); + QTest::newRow("single dynamic scope") << false << false; + QTest::newRow("single static scope") << true << false; + QTest::newRow("double dynamic scope") << false << true; + QTest::newRow("double static scope") << true << true; +} + +void tst_QScriptEngine::readScopeProperty() +{ + QFETCH(bool, staticScope); + QFETCH(bool, nestedScope); + + QScriptEngine engine; + QScriptContext *ctx = engine.pushContext(); + + QScriptValue scope; + if (staticScope) + scope = QScriptDeclarativeClass::newStaticScopeObject(&engine); + else + scope = engine.newObject(); + scope.setProperty("foo", 123); + ctx->pushScope(scope); + + if (nestedScope) { + QScriptValue scope2; + if (staticScope) + scope2 = QScriptDeclarativeClass::newStaticScopeObject(&engine); + else + scope2 = engine.newObject(); + scope2.setProperty("bar", 456); // ensure a miss in inner scope + ctx->pushScope(scope2); + } + + QScriptValue fun = engine.evaluate("(function() {\n" + " for (var i = 0; i < 10000; ++i) {\n" + " foo; foo; foo; foo; foo; foo; foo; foo;\n" + " }\n" + "})"); + engine.popContext(); + QVERIFY(fun.isFunction()); + QBENCHMARK { + fun.call(); + } +} + QTEST_MAIN(tst_QScriptEngine) #include "tst_qscriptengine.moc" diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp index bf60dd1..6f280db 100644 --- a/tests/manual/bearerex/bearerex.cpp +++ b/tests/manual/bearerex/bearerex.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,6 +40,7 @@ ****************************************************************************/ #include "bearerex.h" +#include "datatransferer.h" #include <QtNetwork> @@ -261,8 +262,8 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration, QListWidget* eventListWidget, int index, BearerEx * parent) - : QWidget(parent), m_http(0), m_eventListWidget(eventListWidget), - m_index(index), m_httpRequestOngoing(false), m_alrEnabled (false) + : QWidget(parent), m_dataTransferer(0), m_eventListWidget(eventListWidget), + m_index(index), m_alrEnabled (false) { setupUi(this); @@ -300,41 +301,46 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration, SessionTab::~SessionTab() { - // Need to be nulled, because modal dialogs may return after destruction of this object and - // use already released resources. - delete m_NetworkSession; - m_NetworkSession = NULL; - delete m_http; - m_http = NULL; + delete m_NetworkSession; m_NetworkSession = 0; + delete m_dataTransferer; m_dataTransferer = 0; } -void SessionTab::on_createQHttpButton_clicked() +void SessionTab::on_createQNetworkAccessManagerButton_clicked() { - if (m_httpRequestOngoing) { - return; + if (m_dataTransferer) { + disconnect(m_dataTransferer, 0, 0, 0); + delete m_dataTransferer; + m_dataTransferer = 0; } - - if (m_http) { - disconnect(m_http, 0, 0, 0); - delete m_http; + // Create new object according to current selection + QString type(comboBox->currentText()); + if (type == "QNAM") { + m_dataTransferer = new DataTransfererQNam(this); + } else if (type == "QTcpSocket") { + m_dataTransferer = new DataTransfererQTcp(this); + } else if (type == "QHttp") { + m_dataTransferer = new DataTransfererQHttp(this); + } else { + qDebug("BearerEx Warning, unknown data transfer object requested, not creating anything."); + return; } - m_http = new QHttp(this); - createQHttpButton->setText("Recreate QHttp"); - connect(m_http, SIGNAL(done(bool)), this, SLOT(done(bool))); + createQNetworkAccessManagerButton->setText("Recreate"); + connect(m_dataTransferer, SIGNAL(finished(quint32, qint64, QString)), this, SLOT(finished(quint32, qint64, QString))); } void SessionTab::on_sendRequestButton_clicked() { - if (m_http) { - QString urlstring("http://www.google.com"); - QUrl url(urlstring); - m_http->setHost(url.host(), QHttp::ConnectionModeHttp, url.port() == -1 ? 0 : url.port()); - m_http->get(urlstring); - m_httpRequestOngoing = true; + if (m_dataTransferer) { + if (!m_dataTransferer->transferData()) { + QMessageBox msgBox; + msgBox.setStandardButtons(QMessageBox::Close); + msgBox.setText("Data transfer not started. \nVery likely data transfer ongoing."); + msgBox.exec(); + } } else { QMessageBox msgBox; msgBox.setStandardButtons(QMessageBox::Close); - msgBox.setText("QHttp not created.\nCreate QHttp First."); + msgBox.setText("Data object not created.\nCreate data object first."); msgBox.exec(); } } @@ -419,7 +425,7 @@ void SessionTab::opened() listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Opened")); m_eventListWidget->addItem(listItem); - QVariant identifier = m_NetworkSession->property("ActiveConfiguration"); + QVariant identifier = m_NetworkSession->sessionProperty("ActiveConfiguration"); if (!identifier.isNull()) { QString configId = identifier.toString(); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); @@ -429,7 +435,7 @@ void SessionTab::opened() } if (m_NetworkSession->configuration().type() == QNetworkConfiguration::UserChoice) { - QVariant identifier = m_NetworkSession->property("UserChoiceConfiguration"); + QVariant identifier = m_NetworkSession->sessionProperty("UserChoiceConfiguration"); if (!identifier.isNull()) { QString configId = identifier.toString(); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); @@ -480,6 +486,18 @@ QString SessionTab::stateString(QNetworkSession::State state) return stateString; } +void SessionTab::on_dataObjectChanged(const QString &newObjectType) +{ + qDebug() << "BearerEx SessionTab dataObjectChanged to: " << newObjectType; + if (m_dataTransferer) { + disconnect(m_dataTransferer, 0, 0, 0); + delete m_dataTransferer; m_dataTransferer = 0; + qDebug() << "BearerEx SessionTab, previous data object deleted."; + } + createQNetworkAccessManagerButton->setText("Create"); +} + + void SessionTab::stateChanged(QNetworkSession::State state) { newState(state); @@ -491,7 +509,7 @@ void SessionTab::stateChanged(QNetworkSession::State state) void SessionTab::newState(QNetworkSession::State state) { - QVariant identifier = m_NetworkSession->property("ActiveConfiguration"); + QVariant identifier = m_NetworkSession->sessionProperty("ActiveConfiguration"); if (state == QNetworkSession::Connected && !identifier.isNull()) { QString configId = identifier.toString(); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); @@ -542,18 +560,15 @@ void SessionTab::error(QNetworkSession::SessionError error) msgBox.exec(); } -void SessionTab::done(bool error) +void SessionTab::finished(quint32 errorCode, qint64 dataReceived, QString errorType) { - m_httpRequestOngoing = false; - QMessageBox msgBox; msgBox.setStandardButtons(QMessageBox::Close); - if (error) { - msgBox.setText("HTTP request failed."); - } else { - QString result(m_http->readAll()); - msgBox.setText(QString("HTTP request finished successfully.\nReceived ")+QString::number(result.length())+QString(" bytes.")); - } + msgBox.setText(QString("Data transfer completed. \nError code: ") + + QString::number(int(errorCode)) + + "\nError type: " + errorType + + "\nBytes received: " + + QString::number(dataReceived)); msgBox.exec(); // Check if the networksession still exists - it may have gone after returning from // the modal dialog (in the case that app has been closed, and deleting QHttp will diff --git a/tests/manual/bearerex/bearerex.h b/tests/manual/bearerex/bearerex.h index 6bcb3e5..b81d486 100644 --- a/tests/manual/bearerex/bearerex.h +++ b/tests/manual/bearerex/bearerex.h @@ -55,13 +55,16 @@ #endif #include "qnetworkconfigmanager.h" #include "qnetworksession.h" +#include "datatransferer.h" #include "xqlistwidget.h" QT_BEGIN_NAMESPACE -class QHttp; +class QNetworkAccessManager; +class QNetworkReply; QT_END_NAMESPACE class SessionTab; +class DataTransferer; QT_USE_NAMESPACE @@ -113,14 +116,15 @@ public: QString stateString(QNetworkSession::State state); private Q_SLOTS: - void on_createQHttpButton_clicked(); + void on_createQNetworkAccessManagerButton_clicked(); void on_sendRequestButton_clicked(); void on_openSessionButton_clicked(); void on_closeSessionButton_clicked(); void on_stopConnectionButton_clicked(); void on_deleteSessionButton_clicked(); + void on_dataObjectChanged(const QString& newObjectType); void on_alrButton_clicked(); - void done(bool error); + void finished(quint32 errorCode, qint64 dataReceived, QString errorType); void newConfigurationActivated(); void preferredConfigurationChanged(const QNetworkConfiguration& config, bool isSeamless); @@ -131,13 +135,14 @@ private Q_SLOTS: void error(QNetworkSession::SessionError error); private: //data - QHttp* m_http; + // QNetworkAccessManager* m_networkAccessManager; + DataTransferer* m_dataTransferer; QNetworkSession* m_NetworkSession; QNetworkConfigurationManager* m_ConfigManager; QListWidget* m_eventListWidget; QNetworkConfiguration m_config; int m_index; - bool m_httpRequestOngoing; + bool m_dataTransferOngoing; bool m_alrEnabled; }; diff --git a/tests/manual/bearerex/bearerex.pro b/tests/manual/bearerex/bearerex.pro index 7b21183..df39c85 100644 --- a/tests/manual/bearerex/bearerex.pro +++ b/tests/manual/bearerex/bearerex.pro @@ -17,10 +17,12 @@ maemo5|maemo6 { # Example headers and sources HEADERS += bearerex.h \ - xqlistwidget.h + xqlistwidget.h \ + datatransferer.h SOURCES += bearerex.cpp \ main.cpp \ - xqlistwidget.cpp + xqlistwidget.cpp \ + datatransferer.cpp symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/tests/manual/bearerex/datatransferer.cpp b/tests/manual/bearerex/datatransferer.cpp new file mode 100644 index 0000000..c3c13a8 --- /dev/null +++ b/tests/manual/bearerex/datatransferer.cpp @@ -0,0 +1,220 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QDebug> +#include <QUrl> +#include <QByteArray> +#include <QDataStream> +#include "datatransferer.h" + +DataTransferer::DataTransferer(QObject *parent) : + QObject(parent), m_dataTransferOngoing(false) +{ +} + +bool DataTransferer::dataTransferOngoing() +{ + return m_dataTransferOngoing; +} + + + +// -------- Based on QTcp + +DataTransfererQTcp::DataTransfererQTcp(QObject* parent) +: DataTransferer(parent) +{ + qDebug("BearerEx DataTransferer QTcp created."); + + connect(&m_qsocket, SIGNAL(readyRead()), this, SLOT(readyRead())); + connect(&m_qsocket, SIGNAL(connected()), this, SLOT(connected())); + connect(&m_qsocket, SIGNAL(error(QAbstractSocket::SocketError)), + this, SLOT(error(QAbstractSocket::SocketError))); +} + +DataTransfererQTcp::~DataTransfererQTcp() +{ + qDebug("BearerEx DataTransferer QTcp destroyed."); + m_qsocket.abort(); +} + +bool DataTransfererQTcp::transferData() +{ + if (m_dataTransferOngoing) { + return false; + } + qDebug("BearerEx datatransfer for QTcp requested."); + // Connect to host + QUrl url("http://www.google.com.au"); + m_qsocket.connectToHost(url.host(), url.port(80)); + + // m_qsocket.connectToHost("http://www.google.com", 80); + // Wait for connected() signal. + m_dataTransferOngoing = true; + return true; +} + +void DataTransfererQTcp::connected() +{ + qDebug("BearerEx DataTransfererQtcp connected, requesting data."); + // Establish HTTP request + //QByteArray request("GET / HTTP/1.1 \nHost: www.google.com\n\n"); + QByteArray request("GET / HTTP/1.1\n\n"); + + // QByteArray request("GET /index.html HTTP/1.1 \n Host: www.google.com \n\n"); + qint64 dataWritten = m_qsocket.write(request); + m_qsocket.flush(); + + qDebug() << "BearerEx DataTransferQTcp wrote " << dataWritten << " bytes"; + // Start waiting for readyRead() of error() +} + +void DataTransfererQTcp::readyRead() +{ + qDebug() << "BearerEx DataTransfererQTcp readyRead() with "; + qint64 bytesAvailable = m_qsocket.bytesAvailable(); + qDebug() << bytesAvailable << " bytes available."; + + // QDataStream in(&m_qsocket); + QByteArray array = m_qsocket.readAll(); + QString data = QString::fromAscii(array); + + // in >> data; + + qDebug() << "BearerEx DataTransferQTcp data received: " << data; + m_dataTransferOngoing = false; + // m_qsocket.error() returns uninitialized value in case no error has occured, + // so emit '0' + emit finished(0, bytesAvailable, "QAbstractSocket::SocketError"); +} + +void DataTransfererQTcp::error(QAbstractSocket::SocketError socketError) +{ + qDebug("BearerEx DataTransfererQTcp error(), aborting socket."); + m_qsocket.abort(); + m_dataTransferOngoing = false; + emit finished(socketError, 0, "QAbstractSocket::SocketError"); +} + +// -------- Based on QHttp + +DataTransfererQHttp::DataTransfererQHttp(QObject* parent) +: DataTransferer(parent) +{ + connect(&m_qhttp, SIGNAL(done(bool)), this, SLOT(done(bool))); + qDebug("BearerEx DataTransferer QHttp created."); +} + +DataTransfererQHttp::~DataTransfererQHttp() +{ + qDebug("BearerEx DataTransferer QHttp destroyed."); +} + +bool DataTransfererQHttp::transferData() +{ + qDebug("BearerEx datatransfer for QHttp requested."); + if (m_dataTransferOngoing) { + return false; + } + QString urlstring("http://www.google.com"); + QUrl url(urlstring); + m_qhttp.setHost(url.host(), QHttp::ConnectionModeHttp, url.port() == -1 ? 0 : url.port()); + m_qhttp.get(urlstring); + m_dataTransferOngoing = true; + return true; +} + +void DataTransfererQHttp::done(bool /*error*/ ) +{ + qDebug("BearerEx DatatransfererQHttp reply was finished (error code is type QHttp::Error)."); + qint64 dataReceived = 0; + quint32 errorCode = m_qhttp.error(); + if (m_qhttp.error() == QHttp::NoError) { + QString result(m_qhttp.readAll()); + dataReceived = result.length(); + } + m_dataTransferOngoing = false; + emit finished(errorCode, dataReceived, "QHttp::Error"); +} + +// -------- Based on QNetworkAccessManager + +DataTransfererQNam::DataTransfererQNam(QObject* parent) +: DataTransferer(parent) +{ + connect(&m_qnam, SIGNAL(finished(QNetworkReply*)), + this, SLOT(replyFinished(QNetworkReply*))); + qDebug("BearerEx DataTransferer QNam created."); +} + +DataTransfererQNam::~DataTransfererQNam() +{ + qDebug("BearerEx DataTransferer QNam destroyed."); +} + +bool DataTransfererQNam::transferData() +{ + qDebug("BearerEx datatransfer for QNam requested."); + if (m_dataTransferOngoing) { + return false; + } + m_qnam.get(QNetworkRequest(QUrl("http://www.google.com"))); + m_dataTransferOngoing = true; + return true; +} + +void DataTransfererQNam::replyFinished(QNetworkReply *reply) +{ + qDebug("BearerEx DatatransfererQNam reply was finished (error code is type QNetworkReply::NetworkError)."); + qint64 dataReceived = 0; + quint32 errorCode = (quint32)reply->error(); + + if (reply->error() == QNetworkReply::NoError) { + QString result(reply->readAll()); + dataReceived = result.length(); + } + m_dataTransferOngoing = false; + emit finished(errorCode, dataReceived, "QNetworkReply::NetworkError"); + reply->deleteLater(); +} + + + diff --git a/tests/manual/bearerex/datatransferer.h b/tests/manual/bearerex/datatransferer.h new file mode 100644 index 0000000..f2159b7 --- /dev/null +++ b/tests/manual/bearerex/datatransferer.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DATATRANSFERER_H +#define DATATRANSFERER_H + +#include <QObject> +#include <QString> +#include <QNetworkReply> +#include <QNetworkAccessManager> +#include <QTcpSocket> +#include <QHttp> +#include <QDebug> + +// Interface-class for data transferring object + +class DataTransferer : public QObject +{ + Q_OBJECT +public: + explicit DataTransferer(QObject *parent = 0); + virtual ~DataTransferer() { + if (m_dataTransferOngoing) { + qDebug("BearerEx Warning: dataobjects transfer was ongoing when destroyed."); + } + } + virtual bool transferData() = 0; + bool dataTransferOngoing(); + +signals: + void finished(quint32 errorCode, qint64 dataReceived, QString errorType); + +public slots: + +protected: + bool m_dataTransferOngoing; +}; + + +// Specializations/concrete classes + +class DataTransfererQTcp : public DataTransferer +{ + Q_OBJECT +public: + DataTransfererQTcp(QObject* parent = 0); + ~DataTransfererQTcp(); + + virtual bool transferData(); + +public slots: + void readyRead(); + void error(QAbstractSocket::SocketError socketError); + void connected(); + +private: + QTcpSocket m_qsocket; +}; + +class DataTransfererQNam : public DataTransferer +{ + Q_OBJECT +public: + DataTransfererQNam(QObject* parent = 0); + ~DataTransfererQNam(); + + virtual bool transferData(); + +public slots: + void replyFinished(QNetworkReply* reply); + +private: + QNetworkAccessManager m_qnam; +}; + +class DataTransfererQHttp : public DataTransferer +{ + Q_OBJECT +public: + DataTransfererQHttp(QObject* parent = 0); + ~DataTransfererQHttp(); + + virtual bool transferData(); + +public slots: + void done(bool error); + +private: + QHttp m_qhttp; +}; + +#endif // DATATRANSFERER_H diff --git a/tests/manual/bearerex/main.cpp b/tests/manual/bearerex/main.cpp index 20b167e..704321a 100644 --- a/tests/manual/bearerex/main.cpp +++ b/tests/manual/bearerex/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/manual/bearerex/sessiondialog.ui b/tests/manual/bearerex/sessiondialog.ui index fcf2136..c50af70 100644 --- a/tests/manual/bearerex/sessiondialog.ui +++ b/tests/manual/bearerex/sessiondialog.ui @@ -1,78 +1,87 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>SessionTab</class> - <widget class="QWidget" name="SessionTab" > - <layout class="QVBoxLayout" name="verticalLayout" > + <widget class="QWidget" name="SessionTab"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>192</width> + <height>262</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <layout class="QFormLayout" name="formLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="snapLabel" > - <property name="text" > + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="snapLabel"> + <property name="text"> <string>SNAP</string> </property> </widget> </item> - <item row="0" column="1" > - <widget class="QLineEdit" name="snapLineEdit" > - <property name="readOnly" > + <item row="0" column="1"> + <widget class="QLineEdit" name="snapLineEdit"> + <property name="readOnly"> <bool>true</bool> </property> </widget> </item> - <item row="1" column="0" > - <widget class="QLabel" name="iapLabel" > - <property name="text" > + <item row="1" column="0"> + <widget class="QLabel" name="iapLabel"> + <property name="text"> <string>IAP</string> </property> </widget> </item> - <item row="1" column="1" > - <widget class="QLineEdit" name="iapLineEdit" > - <property name="enabled" > + <item row="1" column="1"> + <widget class="QLineEdit" name="iapLineEdit"> + <property name="enabled"> <bool>true</bool> </property> - <property name="readOnly" > + <property name="readOnly"> <bool>true</bool> </property> </widget> </item> - <item row="2" column="0" > - <widget class="QLabel" name="bearerLabel" > - <property name="text" > + <item row="2" column="0"> + <widget class="QLabel" name="bearerLabel"> + <property name="text"> <string>Bearer</string> </property> </widget> </item> - <item row="2" column="1" > - <widget class="QLineEdit" name="bearerLineEdit" > - <property name="readOnly" > + <item row="2" column="1"> + <widget class="QLineEdit" name="bearerLineEdit"> + <property name="readOnly"> <bool>true</bool> </property> </widget> </item> - <item row="3" column="0" > - <widget class="QLabel" name="sentRecDataLabel" > - <property name="text" > + <item row="3" column="0"> + <widget class="QLabel" name="sentRecDataLabel"> + <property name="text"> <string>Sent/Rec.</string> </property> </widget> </item> - <item row="3" column="1" > - <widget class="QLineEdit" name="sentRecDataLineEdit" > - <property name="readOnly" > + <item row="3" column="1"> + <widget class="QLineEdit" name="sentRecDataLineEdit"> + <property name="readOnly"> <bool>true</bool> </property> </widget> </item> - <item row="4" column="0" > - <widget class="QLabel" name="stateLabel" > - <property name="text" > + <item row="4" column="0"> + <widget class="QLabel" name="stateLabel"> + <property name="text"> <string>State</string> </property> </widget> </item> - <item row="4" column="1" > - <widget class="QLineEdit" name="stateLineEdit" > - <property name="readOnly" > + <item row="4" column="1"> + <widget class="QLineEdit" name="stateLineEdit"> + <property name="readOnly"> <bool>true</bool> </property> </widget> @@ -80,52 +89,71 @@ </layout> </item> <item> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="0" > - <widget class="QPushButton" name="openSessionButton" > - <property name="text" > + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QPushButton" name="openSessionButton"> + <property name="text"> <string>Open Session</string> </property> </widget> </item> - <item row="0" column="1" > - <widget class="QPushButton" name="closeSessionButton" > - <property name="text" > + <item row="0" column="1"> + <widget class="QPushButton" name="closeSessionButton"> + <property name="text"> <string>Close Session</string> </property> </widget> </item> - <item row="1" column="0" > - <widget class="QPushButton" name="stopConnectionButton" > - <property name="text" > + <item row="1" column="0"> + <widget class="QPushButton" name="stopConnectionButton"> + <property name="text"> <string>Stop Conn.</string> </property> </widget> </item> - <item row="2" column="0" > - <widget class="QPushButton" name="createQHttpButton" > - <property name="text" > - <string>Create QHttp</string> + <item row="1" column="1"> + <widget class="QPushButton" name="alrButton"> + <property name="text"> + <string>Enable ALR</string> </property> </widget> </item> - <item row="2" column="1" > - <widget class="QPushButton" name="sendRequestButton" > - <property name="text" > + <item row="3" column="0"> + <widget class="QPushButton" name="sendRequestButton"> + <property name="text"> <string>Send Test Req.</string> </property> </widget> </item> - <item row="3" column="0" > - <widget class="QPushButton" name="alrButton" > - <property name="text" > - <string>Enable ALR</string> + <item row="2" column="1"> + <widget class="QPushButton" name="createQNetworkAccessManagerButton"> + <property name="text"> + <string>Create</string> </property> </widget> </item> - <item row="3" column="1" > - <widget class="QPushButton" name="deleteSessionButton" > - <property name="text" > + <item row="2" column="0"> + <widget class="QComboBox" name="comboBox"> + <item> + <property name="text"> + <string>QNAM</string> + </property> + </item> + <item> + <property name="text"> + <string>QTcpSocket</string> + </property> + </item> + <item> + <property name="text"> + <string>QHttp</string> + </property> + </item> + </widget> + </item> + <item row="3" column="1"> + <widget class="QPushButton" name="deleteSessionButton"> + <property name="text"> <string>Delete Session</string> </property> </widget> @@ -135,5 +163,25 @@ </layout> </widget> <resources/> - <connections/> + <connections> + <connection> + <sender>comboBox</sender> + <signal>currentIndexChanged(QString)</signal> + <receiver>SessionTab</receiver> + <slot>on_dataObjectChanged(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>40</x> + <y>211</y> + </hint> + <hint type="destinationlabel"> + <x>10</x> + <y>258</y> + </hint> + </hints> + </connection> + </connections> + <slots> + <slot>on_dataObjectChanged(QString)</slot> + </slots> </ui> diff --git a/tests/manual/bearerex/xqlistwidget.cpp b/tests/manual/bearerex/xqlistwidget.cpp index 8104779..e4b12f2 100644 --- a/tests/manual/bearerex/xqlistwidget.cpp +++ b/tests/manual/bearerex/xqlistwidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/manual/bearerex/xqlistwidget.h b/tests/manual/bearerex/xqlistwidget.h index 0649c2b..7c12138 100644 --- a/tests/manual/bearerex/xqlistwidget.h +++ b/tests/manual/bearerex/xqlistwidget.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp new file mode 100644 index 0000000..a39e094 --- /dev/null +++ b/tests/manual/qtabletevent/regular_widgets/main.cpp @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the FOO module 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QDebug> +#include <QMouseEvent> +#include <QTabletEvent> +#include <QWidget> + +class EventReportWidget : public QWidget +{ +public: + EventReportWidget(); +protected: + void mouseDoubleClickEvent(QMouseEvent *event) { outputMouseEvent(event); } + void mouseMoveEvent(QMouseEvent *event) { outputMouseEvent(event); } + void mousePressEvent(QMouseEvent *event) { outputMouseEvent(event); } + void mouseReleaseEvent(QMouseEvent *event) { outputMouseEvent(event); } + + void tabletEvent(QTabletEvent *); + +private: + void outputMouseEvent(QMouseEvent *event); + + bool m_lastIsMouseMove; + bool m_lastIsTabletMove; +}; + +EventReportWidget::EventReportWidget() + : m_lastIsMouseMove(false) + , m_lastIsTabletMove(false) +{ } + +void EventReportWidget::tabletEvent(QTabletEvent *event) +{ + QWidget::tabletEvent(event); + + QString type; + switch (event->type()) { + case QEvent::TabletEnterProximity: + m_lastIsTabletMove = false; + type = QString::fromLatin1("TabletEnterProximity"); + break; + case QEvent::TabletLeaveProximity: + m_lastIsTabletMove = false; + type = QString::fromLatin1("TabletLeaveProximity"); + break; + case QEvent::TabletMove: + if (m_lastIsTabletMove) + return; + + m_lastIsTabletMove = true; + type = QString::fromLatin1("TabletMove"); + break; + case QEvent::TabletPress: + m_lastIsTabletMove = false; + type = QString::fromLatin1("TabletPress"); + break; + case QEvent::TabletRelease: + m_lastIsTabletMove = false; + type = QString::fromLatin1("TabletRelease"); + break; + default: + Q_ASSERT(false); + break; + } + + qDebug() << "Tablet event, type = " << type + << " position = " << event->pos() + << " global position = " << event->globalPos(); +} + +void EventReportWidget::outputMouseEvent(QMouseEvent *event) +{ + QString type; + switch (event->type()) { + case QEvent::MouseButtonDblClick: + m_lastIsMouseMove = false; + type = QString::fromLatin1("MouseButtonDblClick"); + break; + case QEvent::MouseButtonPress: + m_lastIsMouseMove = false; + type = QString::fromLatin1("MouseButtonPress"); + break; + case QEvent::MouseButtonRelease: + m_lastIsMouseMove = false; + type = QString::fromLatin1("MouseButtonRelease"); + break; + case QEvent::MouseMove: + if (m_lastIsMouseMove) + return; // only show one move to keep things readable + + m_lastIsMouseMove = true; + type = QString::fromLatin1("MouseMove"); + break; + default: + Q_ASSERT(false); + break; + } + + qDebug() << "Mouse event, type = " << type + << " position = " << event->pos() + << " global position = " << event->globalPos(); +} + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + EventReportWidget widget; + widget.show(); + return app.exec(); +} diff --git a/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro b/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro new file mode 100644 index 0000000..9f0da76 --- /dev/null +++ b/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro @@ -0,0 +1,3 @@ +TEMPLATE = app + +SOURCES += main.cpp |