diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-06-09 18:20:52 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-27 08:41:16 +0000 |
commit | be1f6327428ff746d2a4e903c1223d2664f16759 (patch) | |
tree | c876c836e0eb6f8d982d0490071cb1ee1db43957 /tests/auto/snippets | |
parent | 6ee9612bdcbe6c59cf9b3a0381f03943f5350b67 (diff) |
Add tst_snippets
This is going to include all snippets used in the documentation,
which will be then automatically tested for vality, and at the
same time the respective screenshots are automatically generated.
Notice that copying the screenshots over to src/doc/images is still
a manual step. This is fully intentional because the screenshot
results may vary quite a bit across different platforms due to
different fonts and so on. FWIW, my personal favorite for generating
the screenshots is OS X.
Change-Id: I72b299f15b498abc1afd0a686c56d43159bee775
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests/auto/snippets')
66 files changed, 729 insertions, 0 deletions
diff --git a/tests/auto/snippets/data/busyindicator/qtquickcontrols2-busyindicator-background.qml b/tests/auto/snippets/data/busyindicator/qtquickcontrols2-busyindicator-background.qml new file mode 100644 index 00000000..88b413cb --- /dev/null +++ b/tests/auto/snippets/data/busyindicator/qtquickcontrols2-busyindicator-background.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +BusyIndicator { + background: Rectangle { + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/busyindicator/qtquickcontrols2-busyindicator-indicator.qml b/tests/auto/snippets/data/busyindicator/qtquickcontrols2-busyindicator-indicator.qml new file mode 100644 index 00000000..317a6a3f --- /dev/null +++ b/tests/auto/snippets/data/busyindicator/qtquickcontrols2-busyindicator-indicator.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +BusyIndicator { + Rectangle { + anchors.fill: indicator + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/button/qtquickcontrols2-button-background.qml b/tests/auto/snippets/data/button/qtquickcontrols2-button-background.qml new file mode 100644 index 00000000..44f163d2 --- /dev/null +++ b/tests/auto/snippets/data/button/qtquickcontrols2-button-background.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Button { + width: 80 + text: "Button" + Rectangle { + anchors.fill: background + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/button/qtquickcontrols2-button-disabled.qml b/tests/auto/snippets/data/button/qtquickcontrols2-button-disabled.qml new file mode 100644 index 00000000..401966b9 --- /dev/null +++ b/tests/auto/snippets/data/button/qtquickcontrols2-button-disabled.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Button { + width: 80 + text: "Disabled" + enabled: false +} diff --git a/tests/auto/snippets/data/button/qtquickcontrols2-button-focused.qml b/tests/auto/snippets/data/button/qtquickcontrols2-button-focused.qml new file mode 100644 index 00000000..d12d837f --- /dev/null +++ b/tests/auto/snippets/data/button/qtquickcontrols2-button-focused.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Button { + width: 80 + text: "Focused" + focus: true +} diff --git a/tests/auto/snippets/data/button/qtquickcontrols2-button-label.qml b/tests/auto/snippets/data/button/qtquickcontrols2-button-label.qml new file mode 100644 index 00000000..d7f76f0f --- /dev/null +++ b/tests/auto/snippets/data/button/qtquickcontrols2-button-label.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Button { + width: 80 + text: "Button" + Rectangle { + anchors.fill: label + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/button/qtquickcontrols2-button-normal.qml b/tests/auto/snippets/data/button/qtquickcontrols2-button-normal.qml new file mode 100644 index 00000000..efd225de --- /dev/null +++ b/tests/auto/snippets/data/button/qtquickcontrols2-button-normal.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Button { + width: 80 + text: "Normal" +} diff --git a/tests/auto/snippets/data/button/qtquickcontrols2-button-pressed.qml b/tests/auto/snippets/data/button/qtquickcontrols2-button-pressed.qml new file mode 100644 index 00000000..3ebcc39e --- /dev/null +++ b/tests/auto/snippets/data/button/qtquickcontrols2-button-pressed.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Button { + width: 80 + text: "Pressed" + pressed: true +} diff --git a/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-background.qml b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-background.qml new file mode 100644 index 00000000..95c0d1dc --- /dev/null +++ b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-background.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +CheckBox { + text: "CheckBox" + background: Rectangle { + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-checked.qml b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-checked.qml new file mode 100644 index 00000000..0e0de49a --- /dev/null +++ b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-checked.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +CheckBox { + text: "Checked" + checked: true +} diff --git a/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-disabled.qml b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-disabled.qml new file mode 100644 index 00000000..92b64adc --- /dev/null +++ b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-disabled.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +CheckBox { + text: "Disabled" + enabled: false +} diff --git a/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-focused.qml b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-focused.qml new file mode 100644 index 00000000..35770d55 --- /dev/null +++ b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-focused.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +CheckBox { + text: "Focused" + focus: true +} diff --git a/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-indicator.qml b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-indicator.qml new file mode 100644 index 00000000..8fda4b1f --- /dev/null +++ b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-indicator.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +CheckBox { + text: "CheckBox" + Rectangle { + anchors.fill: indicator + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-label.qml b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-label.qml new file mode 100644 index 00000000..6deb3944 --- /dev/null +++ b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-label.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +CheckBox { + text: "CheckBox" + Rectangle { + anchors.fill: label + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-normal.qml b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-normal.qml new file mode 100644 index 00000000..d453eabc --- /dev/null +++ b/tests/auto/snippets/data/checkbox/qtquickcontrols2-checkbox-normal.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +CheckBox { + text: "Normal" +} diff --git a/tests/auto/snippets/data/frame/qtquickcontrols2-frame-background.qml b/tests/auto/snippets/data/frame/qtquickcontrols2-frame-background.qml new file mode 100644 index 00000000..16d7c892 --- /dev/null +++ b/tests/auto/snippets/data/frame/qtquickcontrols2-frame-background.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Frame { + width: 100 + height: 100 + background: Rectangle { + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/frame/qtquickcontrols2-frame-frame.qml b/tests/auto/snippets/data/frame/qtquickcontrols2-frame-frame.qml new file mode 100644 index 00000000..64bfb5fc --- /dev/null +++ b/tests/auto/snippets/data/frame/qtquickcontrols2-frame-frame.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Frame { + width: 100 + height: 100 + Rectangle { + parent: frame + anchors.fill: parent + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/groupbox/qtquickcontrols2-groupbox-background.qml b/tests/auto/snippets/data/groupbox/qtquickcontrols2-groupbox-background.qml new file mode 100644 index 00000000..e986fda5 --- /dev/null +++ b/tests/auto/snippets/data/groupbox/qtquickcontrols2-groupbox-background.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +GroupBox { + width: 100 + height: 100 + title: "GroupBox" + background: Rectangle { + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/groupbox/qtquickcontrols2-groupbox-frame.qml b/tests/auto/snippets/data/groupbox/qtquickcontrols2-groupbox-frame.qml new file mode 100644 index 00000000..395cd882 --- /dev/null +++ b/tests/auto/snippets/data/groupbox/qtquickcontrols2-groupbox-frame.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +GroupBox { + width: 100 + height: 100 + title: "GroupBox" + Rectangle { + parent: frame + anchors.fill: parent + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/groupbox/qtquickcontrols2-groupbox-label.qml b/tests/auto/snippets/data/groupbox/qtquickcontrols2-groupbox-label.qml new file mode 100644 index 00000000..00da0450 --- /dev/null +++ b/tests/auto/snippets/data/groupbox/qtquickcontrols2-groupbox-label.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +GroupBox { + width: 100 + height: 100 + title: "GroupBox" + Rectangle { + parent: label + anchors.fill: parent + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/progressbar/qtquickcontrols2-progressbar-background.qml b/tests/auto/snippets/data/progressbar/qtquickcontrols2-progressbar-background.qml new file mode 100644 index 00000000..7be2eec5 --- /dev/null +++ b/tests/auto/snippets/data/progressbar/qtquickcontrols2-progressbar-background.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ProgressBar { + value: 0.5 + Rectangle { + anchors.fill: background + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/progressbar/qtquickcontrols2-progressbar-disabled.qml b/tests/auto/snippets/data/progressbar/qtquickcontrols2-progressbar-disabled.qml new file mode 100644 index 00000000..118e2c53 --- /dev/null +++ b/tests/auto/snippets/data/progressbar/qtquickcontrols2-progressbar-disabled.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ProgressBar { + value: 0.5 + enabled: false +} diff --git a/tests/auto/snippets/data/progressbar/qtquickcontrols2-progressbar-indicator.qml b/tests/auto/snippets/data/progressbar/qtquickcontrols2-progressbar-indicator.qml new file mode 100644 index 00000000..42a58f84 --- /dev/null +++ b/tests/auto/snippets/data/progressbar/qtquickcontrols2-progressbar-indicator.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ProgressBar { + value: 0.5 + Rectangle { + parent: indicator + width: indicator.childrenRect.width + height: indicator.height + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/progressbar/qtquickcontrols2-progressbar-normal.qml b/tests/auto/snippets/data/progressbar/qtquickcontrols2-progressbar-normal.qml new file mode 100644 index 00000000..c2b6e89a --- /dev/null +++ b/tests/auto/snippets/data/progressbar/qtquickcontrols2-progressbar-normal.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ProgressBar { + value: 0.5 +} diff --git a/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-background.qml b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-background.qml new file mode 100644 index 00000000..8ea70c8d --- /dev/null +++ b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-background.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RadioButton { + text: "RadioButton" + background: Rectangle { + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-checked.qml b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-checked.qml new file mode 100644 index 00000000..2e475807 --- /dev/null +++ b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-checked.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RadioButton { + text: "Checked" + checked: true +} diff --git a/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-disabled.qml b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-disabled.qml new file mode 100644 index 00000000..357fbe57 --- /dev/null +++ b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-disabled.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RadioButton { + text: "Disabled" + enabled: false +} diff --git a/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-focused.qml b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-focused.qml new file mode 100644 index 00000000..981f908c --- /dev/null +++ b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-focused.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RadioButton { + text: "Focused" + focus: true +} diff --git a/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-indicator.qml b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-indicator.qml new file mode 100644 index 00000000..8f781695 --- /dev/null +++ b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-indicator.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RadioButton { + text: "RadioButton" + Rectangle { + anchors.fill: indicator + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-label.qml b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-label.qml new file mode 100644 index 00000000..085f34f0 --- /dev/null +++ b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-label.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RadioButton { + text: "RadioButton" + Rectangle { + anchors.fill: label + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-normal.qml b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-normal.qml new file mode 100644 index 00000000..8f61856f --- /dev/null +++ b/tests/auto/snippets/data/radiobutton/qtquickcontrols2-radiobutton-normal.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RadioButton { + text: "Normal" +} diff --git a/tests/auto/snippets/data/scrollbar/qtquickcontrols2-scrollbar-background.qml b/tests/auto/snippets/data/scrollbar/qtquickcontrols2-scrollbar-background.qml new file mode 100644 index 00000000..e466a36f --- /dev/null +++ b/tests/auto/snippets/data/scrollbar/qtquickcontrols2-scrollbar-background.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ScrollBar { + size: 0.5 + position: 0.5 + active: true + height: 100 + background: Rectangle { + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/scrollbar/qtquickcontrols2-scrollbar-handle.qml b/tests/auto/snippets/data/scrollbar/qtquickcontrols2-scrollbar-handle.qml new file mode 100644 index 00000000..3efbab88 --- /dev/null +++ b/tests/auto/snippets/data/scrollbar/qtquickcontrols2-scrollbar-handle.qml @@ -0,0 +1,15 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ScrollBar { + size: 0.5 + position: 0.5 + active: true + height: 100 + Rectangle { + parent: handle + anchors.fill: parent + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/scrollindicator/qtquickcontrols2-scrollindicator-background.qml b/tests/auto/snippets/data/scrollindicator/qtquickcontrols2-scrollindicator-background.qml new file mode 100644 index 00000000..112f9a55 --- /dev/null +++ b/tests/auto/snippets/data/scrollindicator/qtquickcontrols2-scrollindicator-background.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ScrollIndicator { + size: 0.5 + position: 0.5 + active: true + height: 100 + background: Rectangle { + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/scrollindicator/qtquickcontrols2-scrollindicator-indicator.qml b/tests/auto/snippets/data/scrollindicator/qtquickcontrols2-scrollindicator-indicator.qml new file mode 100644 index 00000000..0a90ae54 --- /dev/null +++ b/tests/auto/snippets/data/scrollindicator/qtquickcontrols2-scrollindicator-indicator.qml @@ -0,0 +1,15 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ScrollIndicator { + size: 0.5 + position: 0.5 + active: true + height: 100 + Rectangle { + parent: indicator + anchors.fill: parent + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/slider/qtquickcontrols2-slider-background.qml b/tests/auto/snippets/data/slider/qtquickcontrols2-slider-background.qml new file mode 100644 index 00000000..687dbea0 --- /dev/null +++ b/tests/auto/snippets/data/slider/qtquickcontrols2-slider-background.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Slider { + value: 0.5 + background: Rectangle { + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/slider/qtquickcontrols2-slider-disabled.qml b/tests/auto/snippets/data/slider/qtquickcontrols2-slider-disabled.qml new file mode 100644 index 00000000..5b5532cc --- /dev/null +++ b/tests/auto/snippets/data/slider/qtquickcontrols2-slider-disabled.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Slider { + value: 0.5 + enabled: false +} diff --git a/tests/auto/snippets/data/slider/qtquickcontrols2-slider-focused.qml b/tests/auto/snippets/data/slider/qtquickcontrols2-slider-focused.qml new file mode 100644 index 00000000..f060dbe5 --- /dev/null +++ b/tests/auto/snippets/data/slider/qtquickcontrols2-slider-focused.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Slider { + value: 0.5 + focus: true +} diff --git a/tests/auto/snippets/data/slider/qtquickcontrols2-slider-handle.qml b/tests/auto/snippets/data/slider/qtquickcontrols2-slider-handle.qml new file mode 100644 index 00000000..e24cd664 --- /dev/null +++ b/tests/auto/snippets/data/slider/qtquickcontrols2-slider-handle.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Slider { + value: 0.5 + Rectangle { + anchors.fill: handle + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/slider/qtquickcontrols2-slider-normal.qml b/tests/auto/snippets/data/slider/qtquickcontrols2-slider-normal.qml new file mode 100644 index 00000000..50ba0637 --- /dev/null +++ b/tests/auto/snippets/data/slider/qtquickcontrols2-slider-normal.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Slider { + value: 0.5 +} diff --git a/tests/auto/snippets/data/slider/qtquickcontrols2-slider-track.qml b/tests/auto/snippets/data/slider/qtquickcontrols2-slider-track.qml new file mode 100644 index 00000000..e8f00c7c --- /dev/null +++ b/tests/auto/snippets/data/slider/qtquickcontrols2-slider-track.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Slider { + value: 0.5 + Rectangle { + anchors.fill: track + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/switch/qtquickcontrols2-switch-background.qml b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-background.qml new file mode 100644 index 00000000..7ed7ccc1 --- /dev/null +++ b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-background.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Switch { + text: "Switch" + background: Rectangle { + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/switch/qtquickcontrols2-switch-checked.qml b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-checked.qml new file mode 100644 index 00000000..74ed3f50 --- /dev/null +++ b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-checked.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Switch { + text: "Checked" + checked: true +} diff --git a/tests/auto/snippets/data/switch/qtquickcontrols2-switch-disabled.qml b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-disabled.qml new file mode 100644 index 00000000..5c1e9234 --- /dev/null +++ b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-disabled.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Switch { + text: "Disabled" + enabled: false +} diff --git a/tests/auto/snippets/data/switch/qtquickcontrols2-switch-focused.qml b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-focused.qml new file mode 100644 index 00000000..581cdbcf --- /dev/null +++ b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-focused.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Switch { + text: "Focused" + focus: true +} diff --git a/tests/auto/snippets/data/switch/qtquickcontrols2-switch-indicator.qml b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-indicator.qml new file mode 100644 index 00000000..b13ef6ac --- /dev/null +++ b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-indicator.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Switch { + text: "Switch" + Rectangle { + anchors.fill: indicator + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/switch/qtquickcontrols2-switch-label.qml b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-label.qml new file mode 100644 index 00000000..2ccae69d --- /dev/null +++ b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-label.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Switch { + text: "Switch" + Rectangle { + anchors.fill: label + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/switch/qtquickcontrols2-switch-normal.qml b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-normal.qml new file mode 100644 index 00000000..c403a378 --- /dev/null +++ b/tests/auto/snippets/data/switch/qtquickcontrols2-switch-normal.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Switch { + text: "Normal" +} diff --git a/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-background.qml b/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-background.qml new file mode 100644 index 00000000..ee71a015 --- /dev/null +++ b/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-background.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +TextField { + width: 80 + text: "TextField" + Rectangle { + anchors.fill: background + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-disabled.qml b/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-disabled.qml new file mode 100644 index 00000000..76ba54ed --- /dev/null +++ b/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-disabled.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +TextField { + width: 80 + text: "Disabled" + enabled: false +} diff --git a/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-focused.qml b/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-focused.qml new file mode 100644 index 00000000..f9db3c5a --- /dev/null +++ b/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-focused.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +TextField { + width: 80 + text: "Focused" + focus: true +} diff --git a/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-normal.qml b/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-normal.qml new file mode 100644 index 00000000..a81f35e8 --- /dev/null +++ b/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-normal.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +TextField { + width: 80 + text: "Normal" +} diff --git a/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-placeholder.qml b/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-placeholder.qml new file mode 100644 index 00000000..89d814a6 --- /dev/null +++ b/tests/auto/snippets/data/textfield/qtquickcontrols2-textfield-placeholder.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +TextField { + width: 80 + text: "TextField" + Rectangle { + anchors.fill: placeholder + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-background.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-background.qml new file mode 100644 index 00000000..1ae976f0 --- /dev/null +++ b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-background.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ToggleButton { + text: "ToggleButton" + background: Rectangle { + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-checked.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-checked.qml new file mode 100644 index 00000000..bbb60a05 --- /dev/null +++ b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-checked.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ToggleButton { + text: "Checked" + checked: true +} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-disabled.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-disabled.qml new file mode 100644 index 00000000..72bfbb39 --- /dev/null +++ b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-disabled.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ToggleButton { + text: "Disabled" + enabled: false +} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-focused.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-focused.qml new file mode 100644 index 00000000..fdcb4d42 --- /dev/null +++ b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-focused.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ToggleButton { + text: "Focused" + focus: true +} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-indicator.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-indicator.qml new file mode 100644 index 00000000..7acbe8e4 --- /dev/null +++ b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-indicator.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ToggleButton { + text: "ToggleButton" + Rectangle { + anchors.fill: indicator + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-label.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-label.qml new file mode 100644 index 00000000..1af32b9e --- /dev/null +++ b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-label.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ToggleButton { + text: "ToggleButton" + Rectangle { + anchors.fill: label + color: "transparent" + border.color: "red" + } +} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-normal.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-normal.qml new file mode 100644 index 00000000..fcdfdd7d --- /dev/null +++ b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-normal.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ToggleButton { + text: "Normal" +} diff --git a/tests/auto/snippets/data/toolbar/qtquickcontrols2-toolbar-background.qml b/tests/auto/snippets/data/toolbar/qtquickcontrols2-toolbar-background.qml new file mode 100644 index 00000000..856f113a --- /dev/null +++ b/tests/auto/snippets/data/toolbar/qtquickcontrols2-toolbar-background.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ToolBar { + width: 100 + Rectangle { + parent: background + anchors.fill: parent + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/toolbar/qtquickcontrols2-toolbar-frame.qml b/tests/auto/snippets/data/toolbar/qtquickcontrols2-toolbar-frame.qml new file mode 100644 index 00000000..f0f64f82 --- /dev/null +++ b/tests/auto/snippets/data/toolbar/qtquickcontrols2-toolbar-frame.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ToolBar { + width: 100 + frame: Rectangle { + anchors.fill: parent + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/toolbutton/qtquickcontrols2-toolbutton-background.qml b/tests/auto/snippets/data/toolbutton/qtquickcontrols2-toolbutton-background.qml new file mode 100644 index 00000000..4485bfb5 --- /dev/null +++ b/tests/auto/snippets/data/toolbutton/qtquickcontrols2-toolbutton-background.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ToolButton { + text: "ToolButton" + Rectangle { + anchors.fill: background + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/data/toolbutton/qtquickcontrols2-toolbutton-label.qml b/tests/auto/snippets/data/toolbutton/qtquickcontrols2-toolbutton-label.qml new file mode 100644 index 00000000..17084ced --- /dev/null +++ b/tests/auto/snippets/data/toolbutton/qtquickcontrols2-toolbutton-label.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ToolButton { + text: "ToolButton" + Rectangle { + anchors.fill: label + color: 'transparent' + border.color: 'red' + } +} diff --git a/tests/auto/snippets/snippets.pro b/tests/auto/snippets/snippets.pro new file mode 100644 index 00000000..92575631 --- /dev/null +++ b/tests/auto/snippets/snippets.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +TARGET = tst_snippets + +QT += quick testlib +CONFIG += testcase +osx:CONFIG -= app_bundle + +SOURCES += \ + $$PWD/tst_snippets.cpp + +TESTDATA += \ + $$PWD/data/* diff --git a/tests/auto/snippets/tst_snippets.cpp b/tests/auto/snippets/tst_snippets.cpp new file mode 100644 index 00000000..b07e10b0 --- /dev/null +++ b/tests/auto/snippets/tst_snippets.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest> +#include <QtQuick> + +typedef QPair<QString, QString> QStringPair; + +class tst_Snippets : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + + void screenshots(); + void screenshots_data(); + +private: + QQuickView view; + QMap<QString, QStringPair> filePaths; +}; + +void tst_Snippets::initTestCase() +{ + QDir outdir(QDir::current().filePath("screenshots")); + QVERIFY(outdir.exists() || QDir::current().mkpath("screenshots")); + + QString datadir = QFINDTESTDATA("data"); + QVERIFY(!datadir.isEmpty()); + + qInfo() << datadir; + + QDirIterator it(datadir, QStringList() << "*.qml", QDir::Files | QDir::Readable, QDirIterator::Subdirectories); + while (it.hasNext()) { + QFileInfo fi(it.next()); + filePaths.insert(fi.baseName(), qMakePair(fi.filePath(), outdir.filePath(fi.baseName() + ".png"))); + } + QVERIFY(!filePaths.isEmpty()); +} + +void tst_Snippets::screenshots() +{ + QFETCH(QString, input); + QFETCH(QString, output); + + view.setSource(QUrl::fromLocalFile(input)); + QVERIFY(view.rootObject()); + + view.show(); + view.requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(&view)); + + QSharedPointer<QQuickItemGrabResult> result = view.rootObject()->grabToImage(); + QSignalSpy spy(result.data(), SIGNAL(ready())); + QVERIFY(spy.isValid()); + QVERIFY(spy.wait()); + QVERIFY(result->saveToFile(output)); +} + +void tst_Snippets::screenshots_data() +{ + QTest::addColumn<QString>("input"); + QTest::addColumn<QString>("output"); + + QMap<QString, QStringPair>::const_iterator it; + for (it = filePaths.begin(); it != filePaths.end(); ++it) + QTest::newRow(qPrintable(it.key())) << it.value().first << it.value().second; +} + +QTEST_MAIN(tst_Snippets) + +#include "tst_snippets.moc" |