aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-29 22:25:11 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-30 09:51:36 +0000
commit19e7cc53a7189c5c35a478d06b435433297771c5 (patch)
treea1b1958cdaf36813b362b943acc4a55ba5294b27 /tests
parent390fb0d4a8e4f308b225a86b48205b14633cf0e2 (diff)
Simplify TextField & TextArea placeholder
Better not expose the extra Text item in the API. Ideally it should be implemented as a scenegraph node. We might even want to promote the placeholderText property (and add placeholderColor) to TextInput and TextEdit in Qt Quick core. Change-Id: I4f443c77d1c696b87a50ee184f868713dd50316f Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_textarea.qml10
-rw-r--r--tests/auto/controls/data/tst_textfield.qml10
-rw-r--r--tests/auto/snippets/data/qtlabscontrols-textfield-placeholder.qml12
-rw-r--r--tests/manual/fonts/main.qml4
4 files changed, 18 insertions, 18 deletions
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml
index 1c31f435..286a32ce 100644
--- a/tests/auto/controls/data/tst_textarea.qml
+++ b/tests/auto/controls/data/tst_textarea.qml
@@ -89,11 +89,17 @@ TestCase {
control.horizontalAlignment = TextArea.AlignRight
compare(control.horizontalAlignment, TextArea.AlignRight)
- compare(control.placeholder.horizontalAlignment, Text.AlignRight)
+ for (var i = 0; i < control.children.length; ++i) {
+ if (control.children[i].hasOwnProperty("horizontalAlignment"))
+ compare(control.children[i].horizontalAlignment, Text.AlignRight) // placeholder
+ }
control.verticalAlignment = TextArea.AlignBottom
compare(control.verticalAlignment, TextArea.AlignBottom)
- compare(control.placeholder.verticalAlignment, Text.AlignBottom)
+ for (var j = 0; j < control.children.length; ++j) {
+ if (control.children[j].hasOwnProperty("verticalAlignment"))
+ compare(control.children[j].verticalAlignment, Text.AlignBottom) // placeholder
+ }
control.destroy()
}
diff --git a/tests/auto/controls/data/tst_textfield.qml b/tests/auto/controls/data/tst_textfield.qml
index a35b4a3a..38bb7297 100644
--- a/tests/auto/controls/data/tst_textfield.qml
+++ b/tests/auto/controls/data/tst_textfield.qml
@@ -93,11 +93,17 @@ TestCase {
control.horizontalAlignment = TextField.AlignRight
compare(control.horizontalAlignment, TextField.AlignRight)
- compare(control.placeholder.horizontalAlignment, Text.AlignRight)
+ for (var i = 0; i < control.children.length; ++i) {
+ if (control.children[i].hasOwnProperty("horizontalAlignment"))
+ compare(control.children[i].horizontalAlignment, Text.AlignRight) // placeholder
+ }
control.verticalAlignment = TextField.AlignBottom
compare(control.verticalAlignment, TextField.AlignBottom)
- compare(control.placeholder.verticalAlignment, Text.AlignBottom)
+ for (var j = 0; j < control.children.length; ++j) {
+ if (control.children[j].hasOwnProperty("verticalAlignment"))
+ compare(control.children[j].verticalAlignment, Text.AlignBottom) // placeholder
+ }
control.destroy()
}
diff --git a/tests/auto/snippets/data/qtlabscontrols-textfield-placeholder.qml b/tests/auto/snippets/data/qtlabscontrols-textfield-placeholder.qml
deleted file mode 100644
index ef20c5e2..00000000
--- a/tests/auto/snippets/data/qtlabscontrols-textfield-placeholder.qml
+++ /dev/null
@@ -1,12 +0,0 @@
-import QtQuick 2.0
-import Qt.labs.controls 1.0
-
-TextField {
- width: 80
- text: "TextField"
- Rectangle {
- anchors.fill: placeholder
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/tests/manual/fonts/main.qml b/tests/manual/fonts/main.qml
index d59e9c1d..7bf9a0a7 100644
--- a/tests/manual/fonts/main.qml
+++ b/tests/manual/fonts/main.qml
@@ -80,8 +80,8 @@ ApplicationWindow {
text: "TabButton"
font.pointSize: control.font.pointSize
}
- TextField { placeholder.text: "TextField" }
- TextArea { placeholder.text: "TextArea" }
+ TextField { placeholderText: "TextField" }
+ TextArea { placeholderText: "TextArea" }
ToolButton { text: "ToolButton" }
Tumbler { model: 3 }
}