File indexing completed on 2024-05-05 03:54:28
0001 /* 0002 SPDX-FileCopyrightText: 2011 Marco Martin <mart@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include <QGuiApplication> 0008 #include <QQmlContext> 0009 #include <QQuickView> 0010 0011 #include <qtestcase.h> 0012 0013 int main(int argc, char *argv[]) 0014 { 0015 QGuiApplication app(argc, argv); 0016 0017 QQuickView view; 0018 QQmlContext *context = view.rootContext(); 0019 0020 QImage image; 0021 if (app.devicePixelRatio() < 2) { 0022 image = QImage(QFINDTESTDATA("testimage.png")); 0023 } else { 0024 image = QImage(QFINDTESTDATA("testimage@2x.png")); 0025 image.setDevicePixelRatio(2); 0026 } 0027 0028 context->setContextProperty(QStringLiteral("testImage"), image); 0029 0030 view.setSource(QUrl::fromLocalFile(QFINDTESTDATA("qimageitemtest.qml"))); 0031 view.show(); 0032 0033 return app.exec(); 0034 }