File indexing completed on 2024-04-28 15:20:39
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 app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); 0017 0018 QQuickView view; 0019 QQmlContext *context = view.rootContext(); 0020 0021 QImage image; 0022 if (app.devicePixelRatio() < 2) { 0023 image = QImage(QFINDTESTDATA("testimage.png")); 0024 } else { 0025 image = QImage(QFINDTESTDATA("testimage@2x.png")); 0026 image.setDevicePixelRatio(2); 0027 } 0028 0029 context->setContextProperty(QStringLiteral("testImage"), image); 0030 0031 view.setSource(QUrl::fromLocalFile(QFINDTESTDATA("qimageitemtest.qml"))); 0032 view.show(); 0033 0034 return app.exec(); 0035 }