diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2012-01-11 17:34:58 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-16 15:07:33 +0100 |
commit | e79eedcb1eaf56280035550f4c6bb2395a51fd16 (patch) | |
tree | 45e6d0c6aa05ddd59762159b7dc27bd877f57134 /tests/auto | |
parent | 7911627f718d0e4876c42adbb5f3e02cf3c9f4eb (diff) |
Added log and status properties to ShaderEffect.
Task-number: QTBUG-23531
Change-Id: I136f6d9642ff9d4074fe8dae1f5714a05349107a
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp | 57 |
1 files changed, 6 insertions, 51 deletions
diff --git a/tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp b/tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp index 3287b8ccdb..dc5ea455bf 100644 --- a/tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp +++ b/tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp @@ -89,52 +89,8 @@ private: OpacityPresent = 0x08, PropertyPresent = 0x10 }; - - static void installMsgHandler(); - static void uninstallMsgHandler(); - static void msgHandler(QtMsgType type, const char *msg); - static void expectWarning(const char *msg); - - static QtMsgHandler originalMsgHandler; - static QByteArray actualWarnings; - static QByteArray expectedWarnings; }; -QtMsgHandler tst_qquickshadereffect::originalMsgHandler = 0; -QByteArray tst_qquickshadereffect::actualWarnings; -QByteArray tst_qquickshadereffect::expectedWarnings; - -void tst_qquickshadereffect::installMsgHandler() -{ - Q_ASSERT(originalMsgHandler == 0); - originalMsgHandler = qInstallMsgHandler(msgHandler); - actualWarnings.clear(); - expectedWarnings.clear(); -} - -void tst_qquickshadereffect::uninstallMsgHandler() -{ - Q_ASSERT(originalMsgHandler != 0); - qInstallMsgHandler(originalMsgHandler); - originalMsgHandler = 0; - QCOMPARE(QString(actualWarnings), QString(expectedWarnings)); // QString for sensible output. -} - -void tst_qquickshadereffect::msgHandler(QtMsgType type, const char *msg) -{ - Q_ASSERT(originalMsgHandler != 0); - if (type == QtWarningMsg) - actualWarnings.append(msg).append('\n'); - originalMsgHandler(type, msg); -} - -void tst_qquickshadereffect::expectWarning(const char *msg) -{ - Q_ASSERT(originalMsgHandler != 0); - expectedWarnings.append(msg).append('\n'); - QTest::ignoreMessage(QtWarningMsg, msg); -} - tst_qquickshadereffect::tst_qquickshadereffect() { } @@ -295,21 +251,20 @@ void tst_qquickshadereffect::lookThroughShaderCode() TestShaderEffect item; QVERIFY(!item.isConnected(SIGNAL(dummyChanged()))); // Nothing connected yet. - installMsgHandler(); + QString expected; if ((presenceFlags & VertexPresent) == 0) - expectWarning("QQuickShaderEffect: Missing reference to \'qt_Vertex\'."); + expected += "Warning: Missing reference to \'qt_Vertex\'.\n"; if ((presenceFlags & TexCoordPresent) == 0) - expectWarning("QQuickShaderEffect: Missing reference to \'qt_MultiTexCoord0\'."); + expected += "Warning: Missing reference to \'qt_MultiTexCoord0\'.\n"; if ((presenceFlags & MatrixPresent) == 0) - expectWarning("QQuickShaderEffect: Missing reference to \'qt_Matrix\'."); + expected += "Warning: Missing reference to \'qt_Matrix\'.\n"; if ((presenceFlags & OpacityPresent) == 0) - expectWarning("QQuickShaderEffect: Missing reference to \'qt_Opacity\'."); + expected += "Warning: Missing reference to \'qt_Opacity\'.\n"; item.setVertexShader(vertexShader); item.setFragmentShader(fragmentShader); item.ensureCompleted(); - - uninstallMsgHandler(); + QCOMPARE(item.parseLog(), expected); // If the uniform was successfully parsed, the notify signal has been connected to an update slot. QCOMPARE(item.isConnected(SIGNAL(dummyChanged())), (presenceFlags & PropertyPresent) != 0); |