1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the test suite of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #include <QtDeclarative/qdeclarativeengine.h>
43 #include <QtDeclarative/qdeclarativecomponent.h>
44 #include <QtQuick/qquickview.h>
45 #include <private/qquickflipable_p.h>
46 #include <private/qdeclarativevaluetype_p.h>
47 #include <QFontMetrics>
48 #include <QtQuick/private/qquickrectangle_p.h>
50 #include <QtOpenGL/QGLShaderProgram>
51 #include "../../shared/util.h"
53 class tst_qquickflipable : public QDeclarativeDataTest
60 void checkFrontAndBack();
61 void setFrontAndBack();
63 // below here task issues
64 void QTBUG_9161_crash();
65 void QTBUG_8474_qgv_abort();
68 QDeclarativeEngine engine;
71 void tst_qquickflipable::create()
73 QDeclarativeEngine engine;
74 QDeclarativeComponent c(&engine, testFileUrl("test-flipable.qml"));
75 QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create());
81 void tst_qquickflipable::checkFrontAndBack()
83 QDeclarativeEngine engine;
84 QDeclarativeComponent c(&engine, testFileUrl("test-flipable.qml"));
85 QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create());
88 QVERIFY(obj->front() != 0);
89 QVERIFY(obj->back() != 0);
93 void tst_qquickflipable::setFrontAndBack()
95 QDeclarativeEngine engine;
96 QDeclarativeComponent c(&engine, testFileUrl("test-flipable.qml"));
97 QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create());
100 QVERIFY(obj->front() != 0);
101 QVERIFY(obj->back() != 0);
103 QString message = c.url().toString() + ":3:1: QML Flipable: front is a write-once property";
104 QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
105 obj->setFront(new QQuickRectangle());
107 message = c.url().toString() + ":3:1: QML Flipable: back is a write-once property";
108 QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
109 obj->setBack(new QQuickRectangle());
113 void tst_qquickflipable::QTBUG_9161_crash()
115 QQuickView *canvas = new QQuickView;
116 canvas->setSource(testFileUrl("crash.qml"));
117 QQuickItem *root = canvas->rootObject();
123 void tst_qquickflipable::QTBUG_8474_qgv_abort()
125 QQuickView *canvas = new QQuickView;
126 canvas->setSource(testFileUrl("flipable-abort.qml"));
127 QQuickItem *root = canvas->rootObject();
133 QTEST_MAIN(tst_qquickflipable)
135 #include "tst_qquickflipable.moc"