diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-28 16:01:01 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-28 16:01:01 (GMT) |
commit | f25f5b41a620b6d46e78eb97e3b2784c646493d0 (patch) | |
tree | 2083c23d547ae703df66441e1cb7c03ed9849374 /tests | |
parent | 9b6edd75d37b25d76349ba7b84677d4c9922cc58 (diff) | |
parent | 31affef31b3743a23cf6f099d6a8f72b371586b4 (diff) | |
download | Qt-f25f5b41a620b6d46e78eb97e3b2784c646493d0.zip Qt-f25f5b41a620b6d46e78eb97e3b2784c646493d0.tar.gz Qt-f25f5b41a620b6d46e78eb97e3b2784c646493d0.tar.bz2 |
Merge branch '4.6'
Diffstat (limited to 'tests')
-rw-r--r-- | tests/arthur/lance/main.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qgl/tst_qgl.cpp | 43 | ||||
-rw-r--r-- | tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 18 | ||||
-rw-r--r-- | tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp | 26 | ||||
-rw-r--r-- | tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 12 | ||||
-rw-r--r-- | tests/auto/uiloader/baseline/css_tab_closebutton.ui | 128 |
6 files changed, 219 insertions, 10 deletions
diff --git a/tests/arthur/lance/main.cpp b/tests/arthur/lance/main.cpp index 8bf10eb..534e15d 100644 --- a/tests/arthur/lance/main.cpp +++ b/tests/arthur/lance/main.cpp @@ -380,7 +380,7 @@ int main(int argc, char **argv) QString script = textFile.readAll(); content = script.split("\n", QString::SkipEmptyParts); } else { - printf("failed to read file: '%s'\n", qPrintable(fileName)); + printf("failed to read file: '%s'\n", qPrintable(fileinfo.absoluteFilePath())); continue; } pcmd.setContents(content); diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 8958530..59779b0 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -45,6 +45,7 @@ #include <qcoreapplication.h> #include <qdebug.h> #include <qgl.h> +#include <qglpixelbuffer.h> #include <qglcolormap.h> #include <qpaintengine.h> @@ -70,6 +71,7 @@ private slots: void partialGLWidgetUpdates_data(); void partialGLWidgetUpdates(); void glWidgetRendering(); + void glPBufferRendering(); void glWidgetReparent(); void colormap(); }; @@ -630,6 +632,37 @@ void tst_QGL::partialGLWidgetUpdates() } +// This tests that rendering to a QGLPBuffer using QPainter works. +void tst_QGL::glPBufferRendering() +{ + if (!QGLPixelBuffer::hasOpenGLPbuffers()) + QSKIP("QGLPixelBuffer not supported on this platform", SkipSingle); + + QGLPixelBuffer* pbuf = new QGLPixelBuffer(128, 128); + + QPainter p; + bool begun = p.begin(pbuf); + QVERIFY(begun); + + QPaintEngine::Type engineType = p.paintEngine()->type(); + QVERIFY(engineType == QPaintEngine::OpenGL || engineType == QPaintEngine::OpenGL2); + + p.fillRect(0, 0, 128, 128, Qt::red); + p.fillRect(32, 32, 64, 64, Qt::blue); + p.end(); + + QImage fb = pbuf->toImage(); + delete pbuf; + + QImage reference(128, 128, fb.format()); + p.begin(&reference); + p.fillRect(0, 0, 128, 128, Qt::red); + p.fillRect(32, 32, 64, 64, Qt::blue); + p.end(); + + QCOMPARE(fb, reference); +} + class GLWidget : public QGLWidget { public: @@ -664,7 +697,7 @@ void tst_QGL::glWidgetRendering() QTest::qWait(200); QVERIFY(w.beginOk); - QVERIFY(w.engineType == QPaintEngine::OpenGL); + QVERIFY(w.engineType == QPaintEngine::OpenGL || w.engineType == QPaintEngine::OpenGL2); QImage fb = w.grabFrameBuffer(false).convertToFormat(QImage::Format_RGB32); QImage reference(fb.size(), QImage::Format_RGB32); @@ -697,7 +730,7 @@ void tst_QGL::glWidgetReparent() qt_x11_wait_for_window_manager(widget); qt_x11_wait_for_window_manager(&parentWidget); #endif - QTest::qWait(2000); + QTest::qWait(200); QVERIFY(parentWidget.children().count() == 1); // The layout @@ -707,7 +740,7 @@ void tst_QGL::glWidgetReparent() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&parentWidget); #endif - QTest::qWait(2000); + QTest::qWait(200); QVERIFY(parentWidget.children().count() == 2); // Layout & glwidget QVERIFY(parentWidget.children().contains(widget)); @@ -718,7 +751,7 @@ void tst_QGL::glWidgetReparent() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&parentWidget); #endif - QTest::qWait(2000); + QTest::qWait(200); QVERIFY(parentWidget.children().count() == 1); // The layout @@ -730,7 +763,7 @@ void tst_QGL::glWidgetReparent() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&parentWidget); #endif - QTest::qWait(2000); + QTest::qWait(200); QVERIFY(parentWidget.children().count() == 2); // Layout & glwidget QVERIFY(parentWidget.children().contains(widget)); diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index ef609e0..a09d314 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -50,6 +50,10 @@ Q_DECLARE_METATYPE(QScriptValueList) +QT_BEGIN_NAMESPACE +extern bool qt_script_isJITEnabled(); +QT_END_NAMESPACE + class tst_QScriptContext : public QObject { Q_OBJECT @@ -598,8 +602,10 @@ void tst_QScriptContext::backtrace_data() expected << "<native>('hey') at -1" << "<eval>() at 3" - //### line number should be 2 but the line number information is not kept for eval call - << "foo(arg1 = 'hello', arg2 = 456) at testfile:-1" + << QString::fromLatin1("foo(arg1 = 'hello', arg2 = 456) at testfile:%0") + // interpreter unfortunately doesn't provide line number for eval() + .arg(qt_script_isJITEnabled() ? 2 : -1); + expected << "<global>() at testfile:4"; QTest::newRow("eval") << source << expected; @@ -658,8 +664,10 @@ void tst_QScriptContext::backtrace_data() expected << "<native>('hey') at -1" << "<eval>() at 3" - //### line number should be 3 but the line number information is not kept for eval call - << "plop('hello', 456) at testfile:-1" + << QString::fromLatin1("plop('hello', 456) at testfile:%0") + // interpreter unfortunately doesn't provide line number for eval() + .arg(qt_script_isJITEnabled() ? 3 : -1); + expected << "<global>() at testfile:5"; QTest::newRow("eval in member") << source << expected; @@ -1003,6 +1011,8 @@ void tst_QScriptContext::calledAsConstructor() eng.evaluate("test();"); QVERIFY(!fun3.property("calledAsConstructor").toBool()); eng.evaluate("new test();"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "calledAsConstructor is not correctly set for JS functions when JIT is enabled", Continue); QVERIFY(fun3.property("calledAsConstructor").toBool()); } diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 886c70b..f515304 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -49,6 +49,10 @@ //TESTED_CLASS= //TESTED_FILES= +QT_BEGIN_NAMESPACE +extern bool qt_script_isJITEnabled(); +QT_END_NAMESPACE + class tst_QScriptEngineAgent : public QObject { Q_OBJECT @@ -557,6 +561,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCall() spy->clear(); QVERIFY(eng.evaluate("(function() { return 123; } )()").toNumber()==123); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 4); // evaluate() entry @@ -592,6 +598,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCallWithoutReturn() spy->clear(); eng.evaluate("(function() { var a = 123; } )()"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 4); // evaluate() entry @@ -634,6 +642,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionDefinition() QVERIFY(spy->at(1).value.isUndefined()); eng.evaluate("foo()"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 6); // evaluate() entry @@ -709,6 +719,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_native2() spy->clear(); eng.evaluate("nativeFunctionCallingArg(function() { return 123; })"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 6); // evaluate() entry @@ -797,6 +809,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_builtin() spy->clear(); eng.evaluate("'ciao'.toString()"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 4); // evaluate() entry @@ -1021,6 +1035,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_call() spy->clear(); fun.call(); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 2); // entry @@ -1575,6 +1591,8 @@ void tst_QScriptEngineAgent::exceptionThrowAndCatch() { spy->clear(); eng.evaluate("try { throw new Error('ciao'); } catch (e) { }"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 2); QCOMPARE(spy->at(0).type, ScriptEngineEvent::ExceptionThrow); @@ -1632,6 +1650,8 @@ void tst_QScriptEngineAgent::eventOrder_functionDefinition() QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit); eng.evaluate("foo(123)"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 13); // load QCOMPARE(spy->at(3).type, ScriptEngineEvent::ScriptLoad); @@ -1708,6 +1728,8 @@ void tst_QScriptEngineAgent::eventOrder_throwAndCatch() { spy->clear(); eng.evaluate("try { throw new Error('ciao') } catch (e) { void(e); }"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "One event is missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 12); // load QCOMPARE(spy->at(0).type, ScriptEngineEvent::ScriptLoad); @@ -1752,6 +1774,8 @@ void tst_QScriptEngineAgent::eventOrder_functions() QCOMPARE(spy->count(), 6); eng.evaluate("foo(123)"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 21); // load @@ -1876,6 +1900,8 @@ void tst_QScriptEngineAgent::eventOrder_throwCatchFinally() { spy->clear(); eng.evaluate("try { throw 1; } catch(e) { i = e; } finally { i = 2; }"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "One event is missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 9); // load diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 93f5b6e..d3df376 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -548,6 +548,13 @@ class OtherObject: public QObject void tst_QSharedPointer::qobjectWeakManagement() { { + QWeakPointer<QObject> weak; + weak = QWeakPointer<QObject>(); + QVERIFY(weak.isNull()); + QVERIFY(!weak.data()); + } + + { QObject *obj = new QObject; QWeakPointer<QObject> weak(obj); QVERIFY(!weak.isNull()); @@ -1661,6 +1668,11 @@ void tst_QSharedPointer::invalidConstructs_data() << "QObject *ptr = new QObject;\n" "QWeakPointer<QObject> weak = ptr;\n" // this makes the object unmanaged "QSharedPointer<QObject> shared(ptr);\n"; + + QTest::newRow("shared-pointer-implicit-from-uninitialized") + << &QTest::QExternalTest::tryCompileFail + << "Data *ptr = 0;\n" + "QSharedPointer<Data> weakptr = Qt::Uninitialized;\n"; } void tst_QSharedPointer::invalidConstructs() diff --git a/tests/auto/uiloader/baseline/css_tab_closebutton.ui b/tests/auto/uiloader/baseline/css_tab_closebutton.ui new file mode 100644 index 0000000..82bd2b5 --- /dev/null +++ b/tests/auto/uiloader/baseline/css_tab_closebutton.ui @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Form</class> + <widget class="QWidget" name="Form"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <property name="styleSheet"> + <string notr="true">*{} + +#tabWidget QTabBar::close-button +{ + background: blue; + border: 2px dotted red; + subcontrol-position: top; +} + + +#tabWidget_2 QTabBar::close-button +{ + image: url(images/checkbox_checked.png); + subcontrol-position: left; +} + +#tabWidget_2 QTabBar::close-button:hover +{ + image: url(images/checkbox_unchecked_hover.png); +} + + +#tabWidget_3 QTabBar::close-button +{ + border-image: url(images/pushbutton.png) 3px; + border-width:3px; +} + + +</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QTabWidget" name="tabWidget"> + <property name="tabsClosable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Test the close button in the tabbar</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + </widget> + </widget> + </item> + <item row="0" column="1" rowspan="2"> + <widget class="QTabWidget" name="tabWidget_3"> + <property name="tabPosition"> + <enum>QTabWidget::East</enum> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <property name="tabsClosable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="tab_5"> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + </widget> + <widget class="QWidget" name="tab_6"> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + </widget> + </widget> + </item> + <item row="1" column="0"> + <widget class="QTabWidget" name="tabWidget_2"> + <property name="tabPosition"> + <enum>QTabWidget::South</enum> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <property name="tabsClosable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + </widget> + <widget class="QWidget" name="tab_4"> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + </widget> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> |