diff options
Diffstat (limited to 'tests')
16 files changed, 131 insertions, 12 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index e16eb75..80d540f 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -8,7 +8,7 @@ TEMPLATE = subdirs SUBDIRS += \ bic \ collections \ - compile \ + compiler \ compilerwarnings \ exceptionsafety \ linguist \ diff --git a/tests/auto/compile/.gitignore b/tests/auto/compiler/.gitignore index bdcee46..bdcee46 100644 --- a/tests/auto/compile/.gitignore +++ b/tests/auto/compiler/.gitignore diff --git a/tests/auto/compile/baseclass.cpp b/tests/auto/compiler/baseclass.cpp index 5479532..5479532 100644 --- a/tests/auto/compile/baseclass.cpp +++ b/tests/auto/compiler/baseclass.cpp diff --git a/tests/auto/compile/baseclass.h b/tests/auto/compiler/baseclass.h index 25abbfe..25abbfe 100644 --- a/tests/auto/compile/baseclass.h +++ b/tests/auto/compiler/baseclass.h diff --git a/tests/auto/compile/compile.pro b/tests/auto/compiler/compiler.pro index 6c38078..c444c63 100644 --- a/tests/auto/compile/compile.pro +++ b/tests/auto/compiler/compiler.pro @@ -1,5 +1,5 @@ load(qttest_p4) -SOURCES += tst_compile.cpp baseclass.cpp derivedclass.cpp +SOURCES += tst_compiler.cpp baseclass.cpp derivedclass.cpp HEADERS += baseclass.h derivedclass.h QT = core diff --git a/tests/auto/compile/derivedclass.cpp b/tests/auto/compiler/derivedclass.cpp index 3b71861..3b71861 100644 --- a/tests/auto/compile/derivedclass.cpp +++ b/tests/auto/compiler/derivedclass.cpp diff --git a/tests/auto/compile/derivedclass.h b/tests/auto/compiler/derivedclass.h index 9396ff9..9396ff9 100644 --- a/tests/auto/compile/derivedclass.h +++ b/tests/auto/compiler/derivedclass.h diff --git a/tests/auto/compile/tst_compile.cpp b/tests/auto/compiler/tst_compiler.cpp index cef798a..78c1a56 100644 --- a/tests/auto/compile/tst_compile.cpp +++ b/tests/auto/compiler/tst_compiler.cpp @@ -653,4 +653,4 @@ void tst_Compiler::staticConstUnionWithInitializerList() const } QTEST_MAIN(tst_Compiler) -#include "tst_compile.moc" +#include "tst_compiler.moc" diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 6adcdfe..effa876 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -156,6 +156,7 @@ private slots: void windowFlags(); void shortcutsDeletion(); void painterStateProtectionOnWindowFrame(); + void ensureClipping(); // Task fixes void task236127_bspTreeIndexFails(); @@ -2459,6 +2460,87 @@ void tst_QGraphicsWidget::task250119_shortcutContext() scene.removeItem(&w_signal); } +class ClippingAndTransformsScene : public QGraphicsScene +{ +public: + QList<QGraphicsItem *> drawnItems; +protected: + void drawItems(QPainter *painter, int numItems, QGraphicsItem *items[], + const QStyleOptionGraphicsItem options[], QWidget *widget = 0) + { + drawnItems.clear(); + for (int i = 0; i < numItems; ++i) + drawnItems << items[i]; + QGraphicsScene::drawItems(painter, numItems, items, options, widget); + } +}; + +class RectWidget : public QGraphicsWidget +{ +public: + + RectWidget(Qt::GlobalColor color, QGraphicsItem *parent=0) : QGraphicsWidget(parent), mColor(color) {} + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) + { + painter->setBrush(QBrush(mColor)); + painter->drawRect(boundingRect()); + } + + Qt::GlobalColor mColor; +}; + +class RectItem : public QGraphicsItem +{ +public: + + RectItem(Qt::GlobalColor color, QGraphicsItem *parent=0) : QGraphicsItem(parent), mColor(color) {} + + QRectF boundingRect() const + {return QRectF(10,10,50,50);} + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) + { + painter->setBrush(QBrush(mColor)); + painter->drawRect(boundingRect()); + } + + Qt::GlobalColor mColor; +}; + +void tst_QGraphicsWidget::ensureClipping() +{ + ClippingAndTransformsScene scene; + scene.setSceneRect(-50, -50, 200, 200); + + //A root that clip children + RectWidget *clipWidget = new RectWidget(Qt::black); + scene.addItem(clipWidget); + + clipWidget->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + + //a child + RectWidget *childWidget = new RectWidget(Qt::red, clipWidget); + clipWidget->setGeometry(QRectF(10, 10, 100, 100)); + childWidget->setGeometry(QRectF(25, 25, 50, 50)); + + //We put a QGraphicsItem to be sure this one is also paint + RectItem *childitem = new RectItem(Qt::blue, clipWidget); + + QGraphicsView view(&scene); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(250); + + QList<QGraphicsItem *> expected; + expected << clipWidget << childWidget << childitem; + QVERIFY(scene.drawnItems.contains(clipWidget)); + QVERIFY(scene.drawnItems.contains(childWidget)); + QVERIFY(scene.drawnItems.contains(childitem)); +} + QTEST_MAIN(tst_QGraphicsWidget) #include "tst_qgraphicswidget.moc" diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 13aa2b8..8590eac 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -266,6 +266,9 @@ tst_QMenu::addActionsAndClear() void tst_QMenu::mouseActivation() { +#ifdef Q_OS_WINCE_WM + QSKIP("We have a separate mouseActivation test for Windows mobile.", SkipAll); +#endif QMenu menu; menu.addAction("Menu Action"); menu.show(); diff --git a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp index 70a198d..5cf27d3 100644 --- a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp +++ b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp @@ -745,6 +745,9 @@ private: void tst_QScriptEngineDebugger::multithreadedDebugging() { +#ifdef Q_OS_WINCE + QSKIP("This tests uses too much memory for Windows CE", SkipAll); +#endif ScriptEvaluator eval; QThread thread; eval.moveToThread(&thread); diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index ba5ef70..85ecf6b 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -181,6 +181,7 @@ private slots: void ignoreSslErrorsList(); void ignoreSslErrorsListWithSlot_data(); void ignoreSslErrorsListWithSlot(); + void readFromClosedSocket(); static void exitLoop() { @@ -1668,6 +1669,34 @@ void tst_QSslSocket::ignoreSslErrorsListWithSlot() QCOMPARE(socket.waitForEncrypted(10000), expectEncryptionSuccess); } +// make sure a closed socket has no bytesAvailable() +// related to https://bugs.webkit.org/show_bug.cgi?id=28016 +void tst_QSslSocket::readFromClosedSocket() +{ + QSslSocketPtr socket = newSocket(); + socket->ignoreSslErrors(); + socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->ignoreSslErrors(); + socket->waitForConnected(); + socket->waitForEncrypted(); + // provoke a response by sending a request + socket->write("GET /gif/fluke.gif HTTP/1.1\n"); + socket->write("Host: "); + socket->write(QtNetworkSettings::serverName().toLocal8Bit().constData()); + socket->write("\n"); + socket->write("\n"); + socket->waitForBytesWritten(); + socket->waitForReadyRead(); + QVERIFY(socket->state() == QAbstractSocket::ConnectedState); + QVERIFY(socket->bytesAvailable()); + socket->close(); + QVERIFY(!socket->bytesAvailable()); + QVERIFY(!socket->bytesToWrite()); + socket->waitForDisconnected(); + QVERIFY(!socket->bytesAvailable()); + QVERIFY(!socket->bytesToWrite()); +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslSocket) diff --git a/tests/auto/qtwidgets/tst_qtwidgets.cpp b/tests/auto/qtwidgets/tst_qtwidgets.cpp index 0ccc0aa..9473648 100644 --- a/tests/auto/qtwidgets/tst_qtwidgets.cpp +++ b/tests/auto/qtwidgets/tst_qtwidgets.cpp @@ -86,9 +86,9 @@ void tst_QtWidgets::snapshot() QString filename = "qtwidgets_" + QHostInfo::localHostName() + "_" + QDateTime::currentDateTime().toString("yyyy.MM.dd_hh.mm.ss") + ".png"; QFtp ftp; - ftp.connectToHost("kramer.troll.no"); - ftp.login("anonymous"); - ftp.cd("pics"); + ftp.connectToHost("qt-test-server.qt-test-net"); + ftp.login("ftptest", "password"); + ftp.cd("qtest/pics"); ftp.put(buf.data(), filename, QFtp::Binary); ftp.close(); diff --git a/tests/auto/windowsmobile/test/testSimpleWidget_current.png b/tests/auto/windowsmobile/test/testSimpleWidget_current.png Binary files differindex 5cbc2bb..09a10a3 100644 --- a/tests/auto/windowsmobile/test/testSimpleWidget_current.png +++ b/tests/auto/windowsmobile/test/testSimpleWidget_current.png diff --git a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp index 73ea0a6..091504c 100644 --- a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp +++ b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp @@ -62,14 +62,14 @@ public: #endif } -#ifdef Q_OS_WINCE_WM +#if defined(Q_OS_WINCE_WM) && defined(_WIN32_WCE) && _WIN32_WCE <= 0x501 private slots: void testMainWindowAndMenuBar(); void testSimpleWidget(); #endif }; -#ifdef Q_OS_WINCE_WM +#if defined(Q_OS_WINCE_WM) && defined(_WIN32_WCE) && _WIN32_WCE <= 0x501 bool qt_wince_is_platform(const QString &platformString) { wchar_t tszPlatform[64]; @@ -120,8 +120,6 @@ void openMenu() void compareScreenshots(const QString &image1, const QString &image2) { - if (qt_wince_is_smartphone()) - QSKIP("This test is only for Windows Mobile", SkipAll); QImage screenShot(image1); QImage original(image2); @@ -145,6 +143,9 @@ void takeScreenShot(const QString filename) void tst_WindowsMobile::testMainWindowAndMenuBar() { + if (qt_wince_is_smartphone()) + QSKIP("This test is only for Windows Mobile", SkipAll); + QProcess process; process.start("testQMenuBar.exe"); QCOMPARE(process.state(), QProcess::Running); @@ -158,6 +159,9 @@ void tst_WindowsMobile::testMainWindowAndMenuBar() void tst_WindowsMobile::testSimpleWidget() { + if (qt_wince_is_smartphone()) + QSKIP("This test is only for Windows Mobile", SkipAll); + QMenuBar menubar; menubar.show(); QWidget maximized; diff --git a/tests/auto/windowsmobile/testQMenuBar/main.cpp b/tests/auto/windowsmobile/testQMenuBar/main.cpp index 4949dbb..f615c48 100644 --- a/tests/auto/windowsmobile/testQMenuBar/main.cpp +++ b/tests/auto/windowsmobile/testQMenuBar/main.cpp @@ -48,8 +48,6 @@ int main(int argc, char * argv[]) { - int widgetNum = 20; - QList<QWidget*> widgets; QApplication app(argc, argv); |