skip unit tests if no required OpenGL 2.0 feature on this platform
authorCharles Yin <charles.yin@nokia.com>
Mon, 16 May 2011 03:49:56 +0000 (13:49 +1000)
committerCharles Yin <charles.yin@nokia.com>
Tue, 17 May 2011 04:55:32 +0000 (14:55 +1000)
Change-Id: I68feb5938339f327b45cf66b7aec1c582753f18d

12 files changed:
tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp
tests/auto/declarative/qsgflipable/tst_qsgflipable.cpp
tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp
tests/auto/declarative/qsggridview/tst_qsggridview.cpp
tests/auto/declarative/qsglistview/tst_qsglistview.cpp
tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp
tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp
tests/auto/declarative/qsgpincharea/tst_qsgpincharea.cpp
tests/auto/declarative/qsgtext/tst_qsgtext.cpp
tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp

index 2cc6b3e..1892350 100644 (file)
@@ -47,6 +47,7 @@
 #include <private/qdeclarativevaluetype_p.h>
 #include <math.h>
 #include "../../../shared/util.h"
+#include <QtOpenGL/QGLShaderProgram>
 
 #ifdef Q_OS_SYMBIAN
 // In Symbian OS test data is located in applications private dir
@@ -60,6 +61,9 @@ public:
     tst_qsgflickable();
 
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
+
     void create();
     void horizontalViewportSize();
     void verticalViewportSize();
@@ -86,6 +90,18 @@ tst_qsgflickable::tst_qsgflickable()
 {
 }
 
+void tst_qsgflickable::initTestCase()
+{
+    QSGView canvas;
+    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+        QSKIP("Flickable item needs OpenGL 2.0", SkipAll);
+}
+
+void tst_qsgflickable::cleanupTestCase()
+{
+
+}
+
 void tst_qsgflickable::create()
 {
     QDeclarativeEngine engine;
index 205c2ce..a5e8105 100644 (file)
@@ -47,6 +47,8 @@
 #include <QFontMetrics>
 #include <private/qsgrectangle_p.h>
 #include <math.h>
+#include <QtOpenGL/QGLShaderProgram>
+
 
 #ifdef Q_OS_SYMBIAN
 // In Symbian OS test data is located in applications private dir
@@ -60,6 +62,8 @@ public:
     tst_qsgflipable();
 
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
     void create();
     void checkFrontAndBack();
     void setFrontAndBack();
@@ -75,6 +79,17 @@ private:
 tst_qsgflipable::tst_qsgflipable()
 {
 }
+void tst_qsgflipable::initTestCase()
+{
+    QSGView canvas;
+    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+        QSKIP("Flipable item needs OpenGL 2.0", SkipAll);
+}
+
+void tst_qsgflipable::cleanupTestCase()
+{
+
+}
 
 void tst_qsgflipable::create()
 {
index c793ce9..98ed425 100644 (file)
@@ -47,6 +47,7 @@
 #include <private/qsgtextedit_p.h>
 #include <private/qsgtext_p.h>
 #include <QtDeclarative/private/qsgfocusscope_p.h>
+#include <QtOpenGL/QGLShaderProgram>
 
 #ifdef Q_OS_SYMBIAN
 // In Symbian OS test data is located in applications private dir
@@ -63,6 +64,8 @@ public:
     T *findItem(QSGItem *parent, const QString &id);
 
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
     void basic();
     void nested();
     void noFocus();
@@ -73,6 +76,17 @@ private slots:
     void qtBug13380();
     void forceActiveFocus();
 };
+void tst_qsgfocusscope::initTestCase()
+{
+    QSGView canvas;
+    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+        QSKIP("FocusScope item needs OpenGL 2.0", SkipAll);
+}
+
+void tst_qsgfocusscope::cleanupTestCase()
+{
+
+}
 
 /*
    Find an item with the specified id.
index 931ae7e..7374479 100644 (file)
@@ -52,6 +52,7 @@
 #include <QtDeclarative/private/qsgtext_p.h>
 #include <QtDeclarative/private/qdeclarativelistmodel_p.h>
 #include "../../../shared/util.h"
+#include <QtOpenGL/QGLShaderProgram>
 
 #ifdef Q_OS_SYMBIAN
 // In Symbian OS test data is located in applications private dir
@@ -65,6 +66,8 @@ public:
     tst_QSGGridView();
 
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
     void items();
     void changed();
     void inserted();
@@ -106,7 +109,17 @@ private:
     QList<T*> findItems(QSGItem *parent, const QString &objectName);
     void dumpTree(QSGItem *parent, int depth = 0);
 };
+void tst_QSGGridView::initTestCase()
+{
+    QSGView canvas;
+    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+        QSKIP("QSGGridView needs OpenGL 2.0", SkipAll);
+}
 
+void tst_QSGGridView::cleanupTestCase()
+{
+
+}
 class TestModel : public QAbstractListModel
 {
 public:
index f697e61..507caed 100644 (file)
@@ -53,6 +53,7 @@
 #include <QtDeclarative/private/qlistmodelinterface_p.h>
 #include "../../../shared/util.h"
 #include "incrementalmodel.h"
+#include <QtOpenGL/QGLShaderProgram>
 
 #ifdef Q_OS_SYMBIAN
 // In Symbian OS test data is located in applications private dir
@@ -66,6 +67,8 @@ public:
     tst_QSGListView();
 
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
     // Test both QListModelInterface and QAbstractItemModel model types
     void qListModelInterface_items();
     void qAbstractItemModel_items();
@@ -133,6 +136,17 @@ private:
     void dumpTree(QSGItem *parent, int depth = 0);
 };
 
+void tst_QSGListView::initTestCase()
+{
+    QSGView canvas;
+    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+        QSKIP("QSGListView needs OpenGL 2.0", SkipAll);
+}
+
+void tst_QSGListView::cleanupTestCase()
+{
+
+}
 class TestObject : public QObject
 {
     Q_OBJECT
index 857f888..4e1d253 100644 (file)
@@ -47,6 +47,7 @@
 #include <QtDeclarative/qsgview.h>
 #include <QtDeclarative/qdeclarativecontext.h>
 #include <QtDeclarative/qdeclarativeengine.h>
+#include <QtOpenGL/QGLShaderProgram>
 
 #ifdef Q_OS_SYMBIAN
 // In Symbian OS test data is located in applications private dir
@@ -57,6 +58,8 @@ class tst_QSGMouseArea: public QObject
 {
     Q_OBJECT
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
     void dragProperties();
     void resetDrag();
     void dragging();
@@ -77,6 +80,18 @@ private:
     QSGView *createView();
 };
 
+void tst_QSGMouseArea::initTestCase()
+{
+    QSGView canvas;
+    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+        QSKIP("MouseArea needs OpenGL 2.0", SkipAll);
+}
+
+void tst_QSGMouseArea::cleanupTestCase()
+{
+
+}
+
 void tst_QSGMouseArea::dragProperties()
 {
     QSGView *canvas = createView();
index df8057c..5b95ace 100644 (file)
@@ -55,6 +55,7 @@
 #include <QStringListModel>
 #include <QStandardItemModel>
 #include <QFile>
+#include <QtOpenGL/QGLShaderProgram>
 
 #include "../../../shared/util.h"
 
@@ -89,6 +90,8 @@ public:
     tst_QSGPathView();
 
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
     void initValues();
     void items();
     void dataModel();
@@ -121,6 +124,18 @@ private:
     QList<T*> findItems(QSGItem *parent, const QString &objectName);
 };
 
+void tst_QSGPathView::initTestCase()
+{
+    QSGView canvas;
+    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+        QSKIP("PathView needs OpenGL 2.0", SkipAll);
+}
+
+void tst_QSGPathView::cleanupTestCase()
+{
+
+}
+
 class TestObject : public QObject
 {
     Q_OBJECT
index 01895a6..b6dd1c7 100644 (file)
@@ -45,6 +45,7 @@
 #include <private/qsgrectangle_p.h>
 #include <QtDeclarative/qsgview.h>
 #include <QtDeclarative/qdeclarativecontext.h>
+#include <QtOpenGL/QGLShaderProgram>
 
 #ifdef Q_OS_SYMBIAN
 // In Symbian OS test data is located in applications private dir
@@ -55,6 +56,8 @@ class tst_QSGPinchArea: public QObject
 {
     Q_OBJECT
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
     void pinchProperties();
     void scale();
     void pan();
@@ -62,7 +65,17 @@ private slots:
 private:
     QSGView *createView();
 };
+void tst_QSGPinchArea::initTestCase()
+{
+    QSGView canvas;
+    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+        QSKIP("PinchArea needs OpenGL 2.0", SkipAll);
+}
 
+void tst_QSGPinchArea::cleanupTestCase()
+{
+
+}
 void tst_QSGPinchArea::pinchProperties()
 {
     QSGView *canvas = createView();
index 2861dd9..310b132 100644 (file)
@@ -54,6 +54,7 @@
 
 #include "../../../shared/util.h"
 #include "testhttpserver.h"
+#include <QtOpenGL/QGLShaderProgram>
 
 #ifdef Q_OS_SYMBIAN
 // In Symbian OS test data is located in applications private dir
@@ -68,6 +69,8 @@ public:
     tst_qsgtext();
 
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
     void text();
     void width();
     void wrap();
@@ -127,7 +130,17 @@ private:
 
     QSGView *createView(const QString &filename);
 };
+void tst_qsgtext::initTestCase()
+{
+    QSGView canvas;
+    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+        QSKIP("Text item needs OpenGL 2.0", SkipAll);
+}
 
+void tst_qsgtext::cleanupTestCase()
+{
+
+}
 tst_qsgtext::tst_qsgtext()
 {
     standard << "the quick brown fox jumped over the lazy dog"
index 5510701..9205363 100644 (file)
@@ -60,6 +60,7 @@
 #include <QMimeData>
 #include <private/qapplication_p.h>
 #include <private/qtextcontrol_p.h>
+#include <QtOpenGL/QGLShaderProgram>
 
 #ifdef Q_WS_MAC
 #include <Carbon/Carbon.h>
@@ -97,6 +98,8 @@ public:
     tst_qsgtextedit();
 
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
     void text();
     void width();
     void wrap();
@@ -170,7 +173,17 @@ private:
 
     QDeclarativeEngine engine;
 };
+void tst_qsgtextedit::initTestCase()
+{
+    QSGView canvas;
+    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+        QSKIP("TextEdit item needs OpenGL 2.0", SkipAll);
+}
 
+void tst_qsgtextedit::cleanupTestCase()
+{
+
+}
 tst_qsgtextedit::tst_qsgtextedit()
 {
     standard << "the quick brown fox jumped over the lazy dog"
index b349de9..5f6884b 100644 (file)
@@ -51,6 +51,7 @@
 #include <QStyle>
 #include <QInputContext>
 #include <private/qapplication_p.h>
+#include <QtOpenGL/QGLShaderProgram>
 
 #ifdef Q_OS_SYMBIAN
 // In Symbian OS test data is located in applications private dir
@@ -83,7 +84,8 @@ public:
     tst_qsgtextinput();
 
 private slots:
-
+    void initTestCase();
+    void cleanupTestCase();
     void text();
     void width();
     void font();
@@ -144,7 +146,17 @@ private:
     QStringList standard;
     QStringList colorStrings;
 };
+void tst_qsgtextinput::initTestCase()
+{
+    QSGView canvas;
+    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+        QSKIP("TextInput item needs OpenGL 2.0", SkipAll);
+}
 
+void tst_qsgtextinput::cleanupTestCase()
+{
+
+}
 tst_qsgtextinput::tst_qsgtextinput()
 {
     standard << "the quick brown fox jumped over the lazy dog"
index 23e6295..ce2c816 100644 (file)
@@ -51,6 +51,7 @@
 #include <private/qsgvisualitemmodel_p.h>
 #include <private/qdeclarativevaluetype_p.h>
 #include <math.h>
+#include <QtOpenGL/QGLShaderProgram>
 
 #ifdef Q_OS_SYMBIAN
 // In Symbian OS test data is located in applications private dir
@@ -115,6 +116,8 @@ public:
     tst_qsgvisualdatamodel();
 
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
     void rootIndex();
     void updateLayout();
     void childChanged();
@@ -128,7 +131,17 @@ private:
     template<typename T>
     T *findItem(QSGItem *parent, const QString &objectName, int index);
 };
+void tst_qsgvisualdatamodel::initTestCase()
+{
+    QSGView canvas;
+    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+        QSKIP("VisualDatamodel item needs OpenGL 2.0", SkipAll);
+}
 
+void tst_qsgvisualdatamodel::cleanupTestCase()
+{
+
+}
 class DataObject : public QObject
 {
     Q_OBJECT