diff --git a/tests/components/ComponentBase.qml b/tests/components/ComponentBase.qml new file mode 100644 --- /dev/null +++ b/tests/components/ComponentBase.qml @@ -0,0 +1,37 @@ +import QtQuick 2.0 +import QtQuick.Layouts 1.2 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 3.0 as PlasmaComponents + +PlasmaCore.ColorScope +{ + id: root + width: 500 + height: 300 + property bool invertedColors: false + default property alias children: container.children + colorGroup: invertedColors ? PlasmaCore.Theme.ComplementaryColorGroup : PlasmaCore.Theme.NormalColorGroup + + Rectangle { + anchors.fill: parent + color: PlasmaCore.ColorScope.backgroundColor + } + + PlasmaComponents.Label { + id: label + text: root.invertedColors ? "Invert" : "Normal" + MouseArea { + anchors.fill: parent + onClicked: root.invertedColors = !root.invertedColors + } + } + + Item { + id: container + anchors.top: label.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + } +} diff --git a/tests/components/busyindicator.qml b/tests/components/busyindicator.qml --- a/tests/components/busyindicator.qml +++ b/tests/components/busyindicator.qml @@ -1,11 +1,7 @@ import QtQuick 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents -Rectangle { - width: 600 - height: 300 - color: "white" - +ComponentBase { Column { anchors.fill: parent anchors.margins: 20 @@ -33,5 +29,4 @@ } } - } diff --git a/tests/components/busyindicator3.qml b/tests/components/busyindicator3.qml --- a/tests/components/busyindicator3.qml +++ b/tests/components/busyindicator3.qml @@ -1,11 +1,7 @@ import QtQuick 2.0 import org.kde.plasma.components 3.0 as PlasmaComponents -Rectangle { - width: 600 - height: 300 - color: "white" - +ComponentBase { Column { anchors.fill: parent anchors.margins: 20 diff --git a/tests/components/button.qml b/tests/components/button.qml --- a/tests/components/button.qml +++ b/tests/components/button.qml @@ -4,12 +4,7 @@ import QtQuick.Controls 1.2 import QtQuick.Layouts 1.2 -Rectangle -{ - width: 500 - height: 500 - color: "white" - +ComponentBase { Grid { anchors.fill: parent anchors.margins: 20 diff --git a/tests/components/button3.qml b/tests/components/button3.qml --- a/tests/components/button3.qml +++ b/tests/components/button3.qml @@ -3,54 +3,49 @@ import org.kde.plasma.components 3.0 as PlasmaComponents import QtQuick.Layouts 1.2 -Rectangle -{ - width: 500 - height: 500 - color: "white" - +ComponentBase { Grid { anchors.fill: parent anchors.margins: 20 spacing: 20 columns: 2 - Label { + PlasmaComponents.Label { text: "icon + text" } PlasmaComponents.Button { icon.name: "list-remove" text: "test" } - Label { + PlasmaComponents.Label { text: "icon alone, should look small and square" } PlasmaComponents.Button { icon.name: "list-remove" } - Label { + PlasmaComponents.Label { text: "text alone, should be about 12 chars wide" } PlasmaComponents.Button { text: "test" } - Label { + PlasmaComponents.Label { text: "long text, should expand to fit" } PlasmaComponents.Button { icon.name: "list-remove" text: "This is a really really really really long button" } - Label { + PlasmaComponents.Label { text: "long text but constrained, should be 150px and elided" } @@ -61,7 +56,7 @@ } - Label { + PlasmaComponents.Label { text: "button (with or without icon) and textfield should have the same height" } @@ -77,7 +72,7 @@ } } - Label { + PlasmaComponents.Label { text: "minimum width property. Should be two letters wide" } diff --git a/tests/components/checkbox.qml b/tests/components/checkbox.qml --- a/tests/components/checkbox.qml +++ b/tests/components/checkbox.qml @@ -4,12 +4,7 @@ import QtQuick.Controls 1.2 import QtQuick.Layouts 1.2 -Rectangle -{ - width: 500 - height: 500 - color: "white" - +ComponentBase { Grid { anchors.fill: parent anchors.margins: 20 diff --git a/tests/components/checkbox3.qml b/tests/components/checkbox3.qml --- a/tests/components/checkbox3.qml +++ b/tests/components/checkbox3.qml @@ -3,58 +3,53 @@ import org.kde.plasma.components 3.0 as PlasmaComponents import QtQuick.Layouts 1.2 -Rectangle -{ - width: 500 - height: 500 - color: "white" - +ComponentBase { Grid { anchors.fill: parent anchors.margins: 20 spacing: 4 columns: 2 - Label { + PlasmaComponents.Label { text: "text" } PlasmaComponents.CheckBox { text: "Some awesome checkbox" } - Label { + PlasmaComponents.Label { text: "focus" } PlasmaComponents.CheckBox { text: "Some awesome checkbox" focus: true } - Label { + PlasmaComponents.Label { text: "checked" } PlasmaComponents.CheckBox { text: "Some awesome checkbox" checkState: Qt.Checked } - Label { + PlasmaComponents.Label { text: "tri-state" } PlasmaComponents.CheckBox { text: "Some awesome checkbox" checkState: Qt.PartiallyChecked } - Label { + PlasmaComponents.Label { text: "disabled" } PlasmaComponents.CheckBox { text: "Some awesome checkbox" enabled: false } - Label { + PlasmaComponents.Label { text: "disabled and checked" } PlasmaComponents.CheckBox { diff --git a/tests/components/combobox.qml b/tests/components/combobox.qml --- a/tests/components/combobox.qml +++ b/tests/components/combobox.qml @@ -3,23 +3,17 @@ import org.kde.plasma.components 2.0 import org.kde.plasma.core 2.0 as PlasmaCore -Rectangle { - id: root - color: "white" - width: 800 - height: 300 - - ListModel { - id: demoModel - ListElement { text: "Banana"; color: "Yellow" } - ListElement { text: "Apple"; color: "Green" } - ListElement { text: "Coconut"; color: "Brown" } - } - +ComponentBase { Flow { anchors.fill: parent anchors.margins: 20 spacing: 20 + ListModel { + id: demoModel + ListElement { text: "Banana"; color: "Yellow" } + ListElement { text: "Apple"; color: "Green" } + ListElement { text: "Coconut"; color: "Brown" } + } ComboBox { model:demoModel diff --git a/tests/components/menu.qml b/tests/components/menu.qml --- a/tests/components/menu.qml +++ b/tests/components/menu.qml @@ -1,10 +1,7 @@ import QtQuick 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents -Rectangle { - width: 600 - height: 250 - color: "white" +ComponentBase { Flow { anchors.fill: parent diff --git a/tests/components/progressbar.qml b/tests/components/progressbar.qml --- a/tests/components/progressbar.qml +++ b/tests/components/progressbar.qml @@ -2,15 +2,10 @@ import org.kde.plasma.components 2.0 as PlasmaComponents -Rectangle { +ComponentBase { id: root - property int orientation: orientationCombo.model[orientationCombo.currentIndex].value - color: "white" - width: 900 - height: 600 - Flow { anchors.fill: parent anchors.margins: 20 diff --git a/tests/components/progressbar3.qml b/tests/components/progressbar3.qml --- a/tests/components/progressbar3.qml +++ b/tests/components/progressbar3.qml @@ -2,13 +2,9 @@ import org.kde.plasma.components 3.0 as PlasmaComponents -Rectangle { +ComponentBase { id: root - color: "white" - width: 900 - height: 600 - Flow { anchors.fill: parent anchors.margins: 20 diff --git a/tests/components/radiobutton.qml b/tests/components/radiobutton.qml --- a/tests/components/radiobutton.qml +++ b/tests/components/radiobutton.qml @@ -4,50 +4,45 @@ import QtQuick.Controls 1.2 import QtQuick.Layouts 1.2 -Rectangle -{ - width: 500 - height: 500 - color: "white" - +ComponentBase { Grid { anchors.fill: parent anchors.margins: 20 spacing: 4 columns: 2 - Label { + PlasmaComponents.Label { text: "text" } PlasmaComponents.RadioButton { text: "Some awesome radiobutton" } - Label { + PlasmaComponents.Label { text: "focus" } PlasmaComponents.RadioButton { text: "Some awesome radiobutton" focus: true } - Label { + PlasmaComponents.Label { text: "checked" } PlasmaComponents.RadioButton { text: "Some awesome radiobutton" checked: true } - Label { + PlasmaComponents.Label { text: "disabled" } PlasmaComponents.RadioButton { text: "Some awesome radiobutton" enabled: false } - Label { + PlasmaComponents.Label { text: "disabled and checked" } PlasmaComponents.RadioButton { diff --git a/tests/components/radiobutton3.qml b/tests/components/radiobutton3.qml --- a/tests/components/radiobutton3.qml +++ b/tests/components/radiobutton3.qml @@ -3,50 +3,45 @@ import org.kde.plasma.components 2.0 as PlasmaComponents import QtQuick.Layouts 1.2 -Rectangle -{ - width: 500 - height: 500 - color: "white" - +ComponentBase { Grid { anchors.fill: parent anchors.margins: 20 spacing: 4 columns: 2 - Label { + PlasmaComponents.Label { text: "text" } PlasmaComponents.RadioButton { text: "Some awesome radiobutton" } - Label { + PlasmaComponents.Label { text: "focus" } PlasmaComponents.RadioButton { text: "Some awesome radiobutton" focus: true } - Label { + PlasmaComponents.Label { text: "checked" } PlasmaComponents.RadioButton { text: "Some awesome radiobutton" checked: true } - Label { + PlasmaComponents.Label { text: "disabled" } PlasmaComponents.RadioButton { text: "Some awesome radiobutton" enabled: false } - Label { + PlasmaComponents.Label { text: "disabled and checked" } PlasmaComponents.RadioButton { diff --git a/tests/components/textarea.qml b/tests/components/textarea.qml --- a/tests/components/textarea.qml +++ b/tests/components/textarea.qml @@ -4,11 +4,8 @@ import QtQuick.Controls 1.3 -Rectangle { +ComponentBase { id: root - color: "white" - width: 800 - height: 300 property string longText: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed at volutpat nibh, non elementum nulla. Nunc sem magna, semper sit amet sollicitudin et, vestibulum sed metus. Fusce tempor dolor purus, non posuere urna sodales in. Aenean eu erat ipsum. Fusce egestas pulvinar nisi. Mauris vel enim tincidunt, elementum diam sed, tincidunt nulla. Maecenas tempus vitae ligula et convallis. Nullam justo velit, dignissim a nisl at, blandit posuere leo. Maecenas ac scelerisque odio, eget placerat ipsum. Ut iaculis, tortor et ullamcorper fringilla, mauris neque dapibus arcu, eget suscipit libero libero ut nunc. Sed maximus enim a ligula facilisis, non efficitur dolor blandit. Curabitur venenatis mattis erat ac gravida." diff --git a/tests/components/textarea3.qml b/tests/components/textarea3.qml --- a/tests/components/textarea3.qml +++ b/tests/components/textarea3.qml @@ -2,11 +2,8 @@ import org.kde.plasma.components 3.0 as PlasmaComponents -Rectangle { +ComponentBase { id: root - color: "white" - width: 800 - height: 300 property string longText: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed at volutpat nibh, non elementum nulla. Nunc sem magna, semper sit amet sollicitudin et, vestibulum sed metus. Fusce tempor dolor purus, non posuere urna sodales in. Aenean eu erat ipsum. Fusce egestas pulvinar nisi. Mauris vel enim tincidunt, elementum diam sed, tincidunt nulla. Maecenas tempus vitae ligula et convallis. Nullam justo velit, dignissim a nisl at, blandit posuere leo. Maecenas ac scelerisque odio, eget placerat ipsum. Ut iaculis, tortor et ullamcorper fringilla, mauris neque dapibus arcu, eget suscipit libero libero ut nunc. Sed maximus enim a ligula facilisis, non efficitur dolor blandit. Curabitur venenatis mattis erat ac gravida." diff --git a/tests/components/textfield.qml b/tests/components/textfield.qml --- a/tests/components/textfield.qml +++ b/tests/components/textfield.qml @@ -4,12 +4,8 @@ import QtQuick.Controls 1.3 -Rectangle { +ComponentBase { id: root - color: "white" - width: 800 - height: 300 - property string longText: "This is a longer sentence" Flow { diff --git a/tests/components/textfield3.qml b/tests/components/textfield3.qml --- a/tests/components/textfield3.qml +++ b/tests/components/textfield3.qml @@ -2,12 +2,8 @@ import org.kde.plasma.components 3.0 as PlasmaComponents -Rectangle { +ComponentBase { id: root - color: "white" - width: 800 - height: 300 - property string longText: "This is a longer sentence" Flow { diff --git a/tests/components/toolbutton.qml b/tests/components/toolbutton.qml --- a/tests/components/toolbutton.qml +++ b/tests/components/toolbutton.qml @@ -2,12 +2,7 @@ import org.kde.plasma.components 2.0 as PlasmaComponents -Rectangle -{ - width: 500 - height: 300 - color: "white" - +ComponentBase { Flow { anchors.fill: parent anchors.margins: 20 diff --git a/tests/components/toolbutton3.qml b/tests/components/toolbutton3.qml --- a/tests/components/toolbutton3.qml +++ b/tests/components/toolbutton3.qml @@ -1,13 +1,10 @@ import QtQuick 2.0 -import org.kde.plasma.components 3.0 as PlasmaComponents +import org.kde.plasma.core 2.0 as PlasmaCore -Rectangle -{ - width: 500 - height: 300 - color: "white" +import org.kde.plasma.components 3.0 as PlasmaComponents +ComponentBase { Flow { anchors.fill: parent anchors.margins: 20