diff options
author | Nikita Krupenko <krnekit@gmail.com> | 2015-10-22 18:44:20 +0300 |
---|---|---|
committer | Nikita Krupenko <krnekit@gmail.com> | 2015-10-26 11:14:17 +0000 |
commit | d3dbbe4781c4a7137ada0324e6ec5b14fed5c859 (patch) | |
tree | 2e4c18f5d36d33542ef1dc55ff5e53aa56a4cbd4 /tests | |
parent | 32d11f2d679b811c9af349fe9f0b0b29d4f598c0 (diff) | |
download | qtquickcontrols-d3dbbe4781c4a7137ada0324e6ec5b14fed5c859.tar.gz |
Allow ComboBox to select items with empty text
ComboBox checks selected text like a boolean value. This check is
unnecessary and prevents from item with empty text could be selected.
[ChangeLog][ComboBox] ComboBox is now able to select
items with empty text.
Task-number: QTBUG-42127
Change-Id: Ifaa0598d17c85cee099c88f4e03092137ba17c70
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_combobox.qml | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index da8c79f8..cecc3928 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -682,6 +682,25 @@ TestCase { return index } + function test_emptyTextItem() { + var comboBox = Qt.createQmlObject('import QtQuick.Controls 1.2 ; ComboBox { }', testCase, ''); + comboBox.model = [ + "1", + "", + "3" + ] + compare(comboBox.currentIndex, 0) + compare(comboBox.currentText, "1") + comboBox.currentIndex = 1 + compare(comboBox.currentIndex, 1) + compare(comboBox.currentText, "") + comboBox.currentIndex = 2 + compare(comboBox.currentIndex, 2) + compare(comboBox.currentText, "3") + compare(comboBox.find(""), 1) + comboBox.destroy() + } + function test_minusOneIndexResetsSelection_QTBUG_35794() { var qmlObjects = ['import QtQuick.Controls 1.2 ; ComboBox { model: ["A", "B", "C"] }', 'import QtQuick.Controls 1.2 ; ComboBox { editable: true; model: ["A", "B", "C"] }'] |