| 1 | /* |
| 2 | * Copyright 2013 Canonical Ltd. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU Lesser General Public License as published by |
| 6 | * the Free Software Foundation; version 3. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU Lesser General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU Lesser General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | * |
| 16 | * Author: Florian Boucault <[email protected]> |
| 17 | */ |
| 18 | |
| 19 | #include <QtQml/QQmlEngine> |
| 20 | #include <QtQuick/QQuickView> |
| 21 | #include <QtTest/QtTest> |
| 22 | |
| 23 | class tst_LomiriShapecxx . . $ tst_LomiriShape#: public QObjectcxx . . $ QObject# |
| 24 | { |
| 25 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 26 | |
| 27 | private: |
| 28 | QQuickViewcxx . . $ QQuickView# *m_quickViewcxx . . $ tst_LomiriShape#m_quickView.; |
| 29 | |
| 30 | private Q_SLOTScxx . . $ `<external>/1208926524888476972/qobjectdefs.h:92:10`!: |
| 31 | |
| 32 | void initTestCasecxx . . $ tst_LomiriShape#initTestCase(49f6e7a06ebc5aa8).() |
| 33 | { |
| 34 | m_quickViewcxx . . $ tst_LomiriShape#m_quickView. = new QQuickViewcxx . . $ QQuickView#; |
| 35 | m_quickViewcxx . . $ tst_LomiriShape#m_quickView.->setGeometrycxx . . $ QWindow#setGeometry(748afa4755bc9595).(0, 0, 900, 500); |
| 36 | m_quickViewcxx . . $ tst_LomiriShape#m_quickView.->showcxx . . $ QWindow#show(49f6e7a06ebc5aa8).(); |
| 37 | |
| 38 | // add modules folder so we have access to the plugin from QML |
| 39 | QQmlEnginecxx . . $ QQmlEngine# *engine = m_quickViewcxx . . $ tst_LomiriShape#m_quickView.->enginecxx . . $ QQuickView#engine(a2abd829983e1876).(); |
| 40 | QStringcxx . . $ QString# modulescxx . . $ QString#QString(85c52e162fed56f9).(LOMIRI_QML_IMPORT_PATHcxx . . $ `<built-in>:485:9`!); |
| 41 | QStringListcxx . . $ QStringList# imports = engine->importPathListcxx . . $ QQmlEngine#importPathList(e1dbd5c4feadc8f5).(); |
| 42 | imports.prependcxx . . $ QList#prepend(77d9f17553126ecb).(QDircxx . . $ QDir#QDir(3520e46b33348bf6).(modules).absolutePathcxx . . $ QDir#absolutePath(6ef7b6c27b00b43d).()); |
| 43 | engine->setImportPathListcxx . . $ QQmlEngine#setImportPathList(631c0101495f0328).(imports); |
| 44 | } |
| 45 | |
| 46 | void noDistortioncxx . . $ tst_LomiriShape#noDistortion(49f6e7a06ebc5aa8).() { |
| 47 | QSKIPcxx . . $ `<external>/8602788698586413231/qtestcase.h:193:9`!("This test passes on local machines but not in CI as it requires working OpenGL"); |
| 48 | m_quickViewcxx . . $ tst_LomiriShape#m_quickView.->setSourcecxx . . $ QQuickView#setSource(37355d2f77053a23).(QUrlcxx . . $ QUrl#::fromLocalFilecxx . . $ QUrl#fromLocalFile(daf4b0201622af21).("no_distortion.qml"cxx . . $ QString#QString(85c52e162fed56f9).)); |
| 49 | QCoreApplicationcxx . . $ QCoreApplication#::processEventscxx . . $ QCoreApplication#processEvents(5ce75b802d22674c).(); |
| 50 | |
| 51 | QImagecxx . . $ QImage# result = m_quickViewcxx . . $ tst_LomiriShape#m_quickView.->grabWindowcxx . . $ QQuickWindow#grabWindow(89a140e6ec82607c).(); |
| 52 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!result.isNull()); |
| 53 | |
| 54 | QImagecxx . . $ QImage# expected = QImagecxx . . $ QImage#QImage(7ced637d9e669cca).("no_distortion_expected.png"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 55 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!expected.isNull()); |
| 56 | |
| 57 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result, expected); |
| 58 | } |
| 59 | }; |
| 60 | |
| 61 | QTEST_MAINcxx . . $ `<external>/4204159469433502174/qtest.h:508:9`!(tst_LomiriShape) |
| 62 | |
| 63 | #include "tst_lomiri_shape.moc"cxx . . $ `<file>/tests/unit/lomiri_shape11/.moc/tst_lomiri_shape.moc`/ |