diff options
author | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-08-15 09:26:16 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-08-23 08:00:43 +0200 |
commit | 8d0e307bc7f9f4458e6ea2d2fc0d6cd25be4fda9 (patch) | |
tree | f12a065df95d54699e3266702aa7b62f707fdc33 /tests/auto/quick/qquickimage | |
parent | 15ee12508ec8663ae09ebfc61cc4f0725311bdec (diff) |
Downscale textures which exceed the GL texture limit
This way they will at least render.
[ChangeLog][QtQuick] Images exceeding GL_MAX_TEXTURE_SIZE will be
downscaled to fit so they will still show.
Change-Id: I169ecac768036812b8e14265ec1a0a8902655666
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'tests/auto/quick/qquickimage')
-rw-r--r-- | tests/auto/quick/qquickimage/data/hugeImages.qml | 60 | ||||
-rw-r--r-- | tests/auto/quick/qquickimage/data/tootall.png | bin | 0 -> 238 bytes | |||
-rw-r--r-- | tests/auto/quick/qquickimage/data/toowide.png | bin | 0 -> 217 bytes | |||
-rw-r--r-- | tests/auto/quick/qquickimage/tst_qquickimage.cpp | 17 |
4 files changed, 77 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickimage/data/hugeImages.qml b/tests/auto/quick/qquickimage/data/hugeImages.qml new file mode 100644 index 0000000000..f195299693 --- /dev/null +++ b/tests/auto/quick/qquickimage/data/hugeImages.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + width: 200 + height: 200 + + Image { + source: "toowide.png" + width: 100 + height: 100 + } + + Image { + x: 100 + source: "tootall.png" + width: 100 + height: 100 + } +} diff --git a/tests/auto/quick/qquickimage/data/tootall.png b/tests/auto/quick/qquickimage/data/tootall.png Binary files differnew file mode 100644 index 0000000000..98d0f18ec1 --- /dev/null +++ b/tests/auto/quick/qquickimage/data/tootall.png diff --git a/tests/auto/quick/qquickimage/data/toowide.png b/tests/auto/quick/qquickimage/data/toowide.png Binary files differnew file mode 100644 index 0000000000..4a0a92c651 --- /dev/null +++ b/tests/auto/quick/qquickimage/data/toowide.png diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index a68a763887..3b70c680e9 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -56,6 +56,7 @@ #include <QtGui/QPainter> #include <QtGui/QImageReader> #include <QQuickWindow> +#include <QQuickView> #include <QQuickImageProvider> #include "../../shared/util.h" @@ -106,6 +107,7 @@ private slots: void sourceSizeChanges(); void correctStatus(); void highdpi(); + void hugeImages(); private: QQmlEngine engine; @@ -969,6 +971,21 @@ void tst_qquickimage::highdpi() delete obj; } +void tst_qquickimage::hugeImages() +{ + QQuickView view; + view.setSource(testFileUrl("hugeImages.qml")); + view.setGeometry(0, 0, 200, 200); + view.create(); + + QImage contents = view.grabWindow(); + + QCOMPARE(contents.pixel(0, 0), qRgba(255, 0, 0, 255)); + QCOMPARE(contents.pixel(99, 99), qRgba(255, 0, 0, 255)); + QCOMPARE(contents.pixel(100, 0), qRgba(0, 0, 255, 255)); + QCOMPARE(contents.pixel(199, 99), qRgba(0, 0, 255, 255)); +} + QTEST_MAIN(tst_qquickimage) #include "tst_qquickimage.moc" |