summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2012-09-20 15:35:21 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-13 05:51:19 +0200
commit6b04ee10e6a17999679de86e80ce66886ceab963 (patch)
treea939a0c9466e90d19ffeffc76bbd592ae2d3489a /tests/auto/gui
parentdc0d5bf387a0b440c74b9e822c46b09e20e00720 (diff)
Auto tests: revise cursor dependant tests
Cursor dependant auto tests are currently skipped in various ways. Some are checking PlatformQuirks::haveMouseCursor() that tries to detect if the desktop environment is MeeGo, using obsolete Q_WS_X11. Some are skipped if QT_NO_CURSOR or Q_OS_WINCE is defined and some are actually missing the approriate guards. => unify by defining QTEST_NO_CURSOR in qtest-config.h when appropriate ie. for platforms that have no regular mouse cursor support or when QT_NO_CURSOR is defined. Task-number: QTBUG-22551 Change-Id: I9a1e0e3156617945ae46226c79268955454c8a9a Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp6
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp9
2 files changed, 13 insertions, 2 deletions
diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
index f167bcb139..45f4791439 100644
--- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
+++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
@@ -44,6 +44,8 @@
#include <QtGui>
#include <QtTest/QtTest>
+#include "../../../qtest-config.h"
+
Q_DECLARE_METATYPE(QMetaType::Type)
class tst_QGuiMetaType: public QObject
@@ -133,11 +135,13 @@ template<> struct TypeComparator<QMetaType::QBitmap>
{ return v1.size() == v2.size(); }
};
+#ifndef QTEST_NO_CURSOR
template<> struct TypeComparator<QMetaType::QCursor>
{
static bool equal(const QCursor &v1, const QCursor &v2)
{ return v1.shape() == v2.shape(); }
};
+#endif
template <int ID>
struct DefaultValueFactory
@@ -176,9 +180,11 @@ template<> struct TestValueFactory<QMetaType::QRegion> {
template<> struct TestValueFactory<QMetaType::QBitmap> {
static QBitmap *create() { return new QBitmap(16, 32); }
};
+#ifndef QTEST_NO_CURSOR
template<> struct TestValueFactory<QMetaType::QCursor> {
static QCursor *create() { return new QCursor(Qt::WaitCursor); }
};
+#endif
template<> struct TestValueFactory<QMetaType::QKeySequence> {
static QKeySequence *create() { return new QKeySequence(QKeySequence::Close); }
};
diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
index 38dc1a92f2..4748b7c833 100644
--- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
+++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
@@ -65,6 +65,7 @@
#include "tst_qvariant_common.h"
+#include "../../../../qtest-config.h"
class tst_QGuiVariant : public QObject
{
@@ -182,7 +183,7 @@ void tst_QGuiVariant::canConvert_data()
var = QVariant::fromValue(QColor());
QTest::newRow("Color")
<< var << N << N << N << Y << Y << Y << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << Y << N << N << N << N;
-#ifndef QT_NO_CURSOR
+#ifndef QTEST_NO_CURSOR
var = QVariant::fromValue(QCursor());
QTest::newRow("Cursor")
<< var << N << N << N << N << N << N << Y << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N;
@@ -508,7 +509,7 @@ void tst_QGuiVariant::writeToReadFromDataStream_data()
QTest::newRow( "bitmap_valid" ) << QVariant::fromValue( bitmap ) << false;
QTest::newRow( "brush_valid" ) << QVariant::fromValue( QBrush( Qt::red ) ) << false;
QTest::newRow( "color_valid" ) << QVariant::fromValue( QColor( Qt::red ) ) << false;
-#ifndef QT_NO_CURSOR
+#ifndef QTEST_NO_CURSOR
QTest::newRow( "cursor_valid" ) << QVariant::fromValue( QCursor( Qt::PointingHandCursor ) ) << false;
#endif
QTest::newRow( "font_valid" ) << QVariant::fromValue( QFont( "times", 12 ) ) << false;
@@ -676,12 +677,16 @@ void tst_QGuiVariant::implicitConstruction()
void tst_QGuiVariant::guiVariantAtExit()
{
// crash test, it should not crash at QGuiApplication exit
+#ifndef QTEST_NO_CURSOR
static QVariant cursor = QCursor();
+#endif
static QVariant point = QPoint();
static QVariant icon = QIcon();
static QVariant image = QImage();
static QVariant palette = QPalette();
+#ifndef QTEST_NO_CURSOR
Q_UNUSED(cursor);
+#endif
Q_UNUSED(point);
Q_UNUSED(icon);
Q_UNUSED(image);