Skip to content

Commit

Permalink
skip unit tests if no required OpenGL 2.0 feature on this platform
Browse files Browse the repository at this point in the history
Change-Id: I68feb5938339f327b45cf66b7aec1c582753f18d
  • Loading branch information
yinyunqiao committed May 17, 2011
1 parent ab858bc commit 7740c4c
Show file tree
Hide file tree
Showing 12 changed files with 167 additions and 1 deletion.
16 changes: 16 additions & 0 deletions tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp
Expand Up @@ -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
Expand All @@ -60,6 +61,9 @@ class tst_qsgflickable : public QObject
tst_qsgflickable();

private slots:
void initTestCase();
void cleanupTestCase();

void create();
void horizontalViewportSize();
void verticalViewportSize();
Expand All @@ -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;
Expand Down
15 changes: 15 additions & 0 deletions tests/auto/declarative/qsgflipable/tst_qsgflipable.cpp
Expand Up @@ -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
Expand All @@ -60,6 +62,8 @@ class tst_qsgflipable : public QObject
tst_qsgflipable();

private slots:
void initTestCase();
void cleanupTestCase();
void create();
void checkFrontAndBack();
void setFrontAndBack();
Expand All @@ -74,6 +78,17 @@ private slots:

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()
Expand Down
14 changes: 14 additions & 0 deletions tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp
Expand Up @@ -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
Expand All @@ -63,6 +64,8 @@ class tst_qsgfocusscope : public QObject
T *findItem(QSGItem *parent, const QString &id);

private slots:
void initTestCase();
void cleanupTestCase();
void basic();
void nested();
void noFocus();
Expand All @@ -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.
Expand Down
13 changes: 13 additions & 0 deletions tests/auto/declarative/qsggridview/tst_qsggridview.cpp
Expand Up @@ -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
Expand All @@ -65,6 +66,8 @@ class tst_QSGGridView : public QObject
tst_QSGGridView();

private slots:
void initTestCase();
void cleanupTestCase();
void items();
void changed();
void inserted();
Expand Down Expand Up @@ -106,7 +109,17 @@ private slots:
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:
Expand Down
14 changes: 14 additions & 0 deletions tests/auto/declarative/qsglistview/tst_qsglistview.cpp
Expand Up @@ -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
Expand All @@ -66,6 +67,8 @@ class tst_QSGListView : public QObject
tst_QSGListView();

private slots:
void initTestCase();
void cleanupTestCase();
// Test both QListModelInterface and QAbstractItemModel model types
void qListModelInterface_items();
void qAbstractItemModel_items();
Expand Down Expand Up @@ -133,6 +136,17 @@ private slots:
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
Expand Down
15 changes: 15 additions & 0 deletions tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp
Expand Up @@ -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
Expand All @@ -57,6 +58,8 @@ class tst_QSGMouseArea: public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void cleanupTestCase();
void dragProperties();
void resetDrag();
void dragging();
Expand All @@ -77,6 +80,18 @@ private slots:
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();
Expand Down
15 changes: 15 additions & 0 deletions tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp
Expand Up @@ -55,6 +55,7 @@
#include <QStringListModel>
#include <QStandardItemModel>
#include <QFile>
#include <QtOpenGL/QGLShaderProgram>

#include "../../../shared/util.h"

Expand Down Expand Up @@ -89,6 +90,8 @@ class tst_QSGPathView : public QObject
tst_QSGPathView();

private slots:
void initTestCase();
void cleanupTestCase();
void initValues();
void items();
void dataModel();
Expand Down Expand Up @@ -121,6 +124,18 @@ private slots:
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
Expand Down
13 changes: 13 additions & 0 deletions tests/auto/declarative/qsgpincharea/tst_qsgpincharea.cpp
Expand Up @@ -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
Expand All @@ -55,14 +56,26 @@ class tst_QSGPinchArea: public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void cleanupTestCase();
void pinchProperties();
void scale();
void pan();

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();
Expand Down
13 changes: 13 additions & 0 deletions tests/auto/declarative/qsgtext/tst_qsgtext.cpp
Expand Up @@ -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
Expand All @@ -68,6 +69,8 @@ class tst_qsgtext : public QObject
tst_qsgtext();

private slots:
void initTestCase();
void cleanupTestCase();
void text();
void width();
void wrap();
Expand Down Expand Up @@ -127,7 +130,17 @@ private slots:

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"
Expand Down
13 changes: 13 additions & 0 deletions tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
Expand Up @@ -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>
Expand Down Expand Up @@ -97,6 +98,8 @@ class tst_qsgtextedit : public QObject
tst_qsgtextedit();

private slots:
void initTestCase();
void cleanupTestCase();
void text();
void width();
void wrap();
Expand Down Expand Up @@ -170,7 +173,17 @@ private slots:

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"
Expand Down
14 changes: 13 additions & 1 deletion tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -83,7 +84,8 @@ class tst_qsgtextinput : public QObject
tst_qsgtextinput();

private slots:

void initTestCase();
void cleanupTestCase();
void text();
void width();
void font();
Expand Down Expand Up @@ -144,7 +146,17 @@ private slots:
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"
Expand Down

0 comments on commit 7740c4c

Please sign in to comment.