aboutsummaryrefslogtreecommitdiffstats
path: root/tests/systemtests
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2011-07-05 13:06:54 +1000
committerQt by Nokia <qt-info@nokia.com>2011-07-20 03:07:06 +0200
commita8925e668aca0e1d2b90308c8286e5bb68f9ee42 (patch)
tree36b30e9aae31ac2afb001b0e581343ed892812fa /tests/systemtests
parent86896ff9b2e0387b0b265f927e7cc3f7b40f498b (diff)
Improvements to Image element
- add Image.Pad as a fillMode - add horizontal and vertical alignment properties Task-number: QTBUG-18291 Change-Id: Iaaf3b2d02c47ad01d2c8b49d146f1a9401b2558d Reviewed-on: http://codereview.qt.nokia.com/1468 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com> Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
Diffstat (limited to 'tests/systemtests')
-rw-r--r--tests/systemtests/declarative/qsgimage/ImageNG.qml19
-rw-r--r--tests/systemtests/declarative/qsgimage/img-align.qml92
-rw-r--r--tests/systemtests/declarative/qsgimage/qt-logo.pngbin0 -> 5149 bytes
3 files changed, 111 insertions, 0 deletions
diff --git a/tests/systemtests/declarative/qsgimage/ImageNG.qml b/tests/systemtests/declarative/qsgimage/ImageNG.qml
new file mode 100644
index 0000000000..4a10910fcf
--- /dev/null
+++ b/tests/systemtests/declarative/qsgimage/ImageNG.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Image {
+ property bool explicitSize: true
+ property alias label: lb.text
+
+ width: explicitSize ? 200 : undefined; height: explicitSize ? 150 : undefined
+ smooth: true
+
+ Rectangle {
+ border.color: "red"; color: "transparent"
+ anchors.fill: parent
+ }
+
+ Text {
+ id: lb
+ anchors.top: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; anchors.topMargin: 4
+ }
+}
diff --git a/tests/systemtests/declarative/qsgimage/img-align.qml b/tests/systemtests/declarative/qsgimage/img-align.qml
new file mode 100644
index 0000000000..55ee112ccd
--- /dev/null
+++ b/tests/systemtests/declarative/qsgimage/img-align.qml
@@ -0,0 +1,92 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: main
+ width: 800; height: 600
+ focus: true
+ color: "#eeeeee"
+
+ property variant hAlign: Image.AlignHCenter
+ property variant vAlign: Image.AlignVCenter
+ property bool mirror: false
+ property string source: "qt-logo.png"
+
+ Flow {
+ anchors.fill: parent
+ anchors { topMargin: 20; leftMargin: 20; rightMargin: 20 }
+ spacing: 30
+
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ mirror: main.mirror; source: main.source
+ explicitSize: false
+ label: "implicit size"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ mirror: main.mirror; source: main.source
+ label: "explicit size"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.Pad
+ mirror: main.mirror; source: main.source
+ label: "padding"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.Tile
+ mirror: main.mirror; source: main.source
+ label: "tile"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.TileHorizontally
+ mirror: main.mirror; source: main.source
+ label: "tile horizontally"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.TileVertically
+ mirror: main.mirror; source: main.source
+ label: "tile vertically"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.PreserveAspectFit
+ mirror: main.mirror; source: main.source
+ label: "preserve aspect fit"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.PreserveAspectFit
+ width: 150; height: 200
+ mirror: main.mirror; source: main.source
+ label: "preserve aspect fit"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.PreserveAspectCrop
+ mirror: main.mirror; source: main.source
+ label: "preserve aspect crop"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.PreserveAspectCrop
+ width: 150; height: 200
+ mirror: main.mirror; source: main.source
+ label: "preserve aspect crop"
+ }
+ }
+
+ Keys.onUpPressed: vAlign = Image.AlignTop
+ Keys.onDownPressed: vAlign = Image.AlignBottom
+ Keys.onLeftPressed: hAlign = Image.AlignLeft
+ Keys.onRightPressed: hAlign = Image.AlignRight
+ Keys.onPressed: {
+ if (event.key == Qt.Key_H)
+ hAlign = Image.AlignHCenter
+ else if (event.key == Qt.Key_V)
+ vAlign = Image.AlignVCenter
+ }
+}
diff --git a/tests/systemtests/declarative/qsgimage/qt-logo.png b/tests/systemtests/declarative/qsgimage/qt-logo.png
new file mode 100644
index 0000000000..14ddf2a028
--- /dev/null
+++ b/tests/systemtests/declarative/qsgimage/qt-logo.png
Binary files differ