aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/accessibility/tst_accessibility.cpp14
-rw-r--r--tests/auto/calendar/data/tst_monthgrid.qml9
-rw-r--r--tests/auto/calendar/data/tst_weeknumbercolumn.qml8
-rw-r--r--tests/auto/controls/data/tst_combobox.qml66
-rw-r--r--tests/auto/controls/data/tst_scrollbar.qml5
-rw-r--r--tests/auto/controls/default/BLACKLIST3
-rw-r--r--tests/auto/sanity/tst_sanity.cpp4
7 files changed, 89 insertions, 20 deletions
diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp
index 868b4413..0c2f2e74 100644
--- a/tests/auto/accessibility/tst_accessibility.cpp
+++ b/tests/auto/accessibility/tst_accessibility.cpp
@@ -132,10 +132,10 @@ void tst_accessibility::a11y()
QString fn = name;
#if !QT_CONFIG(accessibility)
- if (name == QLatin1Literal("dayofweekrow")
- || name == QLatin1Literal("monthgrid")
- || name == QLatin1Literal("weeknumbercolumn"))
- fn += QLatin1Literal("-2");
+ if (name == QLatin1String("dayofweekrow")
+ || name == QLatin1String("monthgrid")
+ || name == QLatin1String("weeknumbercolumn"))
+ fn += QLatin1String("-2");
#endif
QQmlComponent component(&engine);
@@ -154,9 +154,9 @@ void tst_accessibility::a11y()
#if QT_CONFIG(accessibility)
QQuickAccessibleAttached *acc = QQuickAccessibleAttached::attachedProperties(item);
- if (name != QLatin1Literal("dayofweekrow")
- && name != QLatin1Literal("monthgrid")
- && name != QLatin1Literal("weeknumbercolumn")) {
+ if (name != QLatin1String("dayofweekrow")
+ && name != QLatin1String("monthgrid")
+ && name != QLatin1String("weeknumbercolumn")) {
if (QAccessible::isActive()) {
QVERIFY(acc);
} else {
diff --git a/tests/auto/calendar/data/tst_monthgrid.qml b/tests/auto/calendar/data/tst_monthgrid.qml
index 25c8378b..6d125712 100644
--- a/tests/auto/calendar/data/tst_monthgrid.qml
+++ b/tests/auto/calendar/data/tst_monthgrid.qml
@@ -148,28 +148,29 @@ TestCase {
control.month = 0
compare(control.month, 0)
- ignoreWarning(Qt.resolvedUrl("tst_monthgrid.qml") + ":65:9: QML AbstractMonthGrid: month -1 is out of range [0...11]")
+
+ ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: month -1 is out of range \[0...11\]$/)
control.month = -1
compare(control.month, 0)
control.month = 11
compare(control.month, 11)
- ignoreWarning(Qt.resolvedUrl("tst_monthgrid.qml") + ":65:9: QML AbstractMonthGrid: month 12 is out of range [0...11]")
+ ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: month 12 is out of range \[0...11\]$/)
control.month = 12
compare(control.month, 11)
control.year = -271820
compare(control.year, -271820)
- ignoreWarning(Qt.resolvedUrl("tst_monthgrid.qml") + ":65:9: QML AbstractMonthGrid: year -271821 is out of range [-271820...275759]")
+ ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: year -271821 is out of range \[-271820...275759\]$/)
control.year = -271821
compare(control.year, -271820)
control.year = 275759
compare(control.year, 275759)
- ignoreWarning(Qt.resolvedUrl("tst_monthgrid.qml") + ":65:9: QML AbstractMonthGrid: year 275760 is out of range [-271820...275759]")
+ ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: year 275760 is out of range \[-271820...275759\]$/)
control.year = 275760
compare(control.year, 275759)
diff --git a/tests/auto/calendar/data/tst_weeknumbercolumn.qml b/tests/auto/calendar/data/tst_weeknumbercolumn.qml
index f94fed43..d1b50339 100644
--- a/tests/auto/calendar/data/tst_weeknumbercolumn.qml
+++ b/tests/auto/calendar/data/tst_weeknumbercolumn.qml
@@ -93,28 +93,28 @@ TestCase {
control.month = 0
compare(control.month, 0)
- ignoreWarning(Qt.resolvedUrl("tst_weeknumbercolumn.qml") + ":65:9: QML AbstractWeekNumberColumn: month -1 is out of range [0...11]")
+ ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: month -1 is out of range \[0...11\]$/)
control.month = -1
compare(control.month, 0)
control.month = 11
compare(control.month, 11)
- ignoreWarning(Qt.resolvedUrl("tst_weeknumbercolumn.qml") + ":65:9: QML AbstractWeekNumberColumn: month 12 is out of range [0...11]")
+ ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: month 12 is out of range \[0...11\]$/)
control.month = 12
compare(control.month, 11)
control.year = -271820
compare(control.year, -271820)
- ignoreWarning(Qt.resolvedUrl("tst_weeknumbercolumn.qml") + ":65:9: QML AbstractWeekNumberColumn: year -271821 is out of range [-271820...275759]")
+ ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: year -271821 is out of range \[-271820...275759\]$/)
control.year = -271821
compare(control.year, -271820)
control.year = 275759
compare(control.year, 275759)
- ignoreWarning(Qt.resolvedUrl("tst_weeknumbercolumn.qml") + ":65:9: QML AbstractWeekNumberColumn: year 275760 is out of range [-271820...275759]")
+ ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: year 275760 is out of range \[-271820...275759\]$/)
control.year = 275760
compare(control.year, 275759)
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index f8f06679..2cf71f73 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -384,9 +384,73 @@ TestCase {
compare(control.find(data.term, data.flags), data.index)
}
+ function test_valueRole_data() {
+ return [
+ { tag: "ListModel", model: fruitmodel },
+ { tag: "ObjectArray", model: fruitarray }
+ ]
+ }
+
+ function test_valueRole(data) {
+ var control = createTemporaryObject(emptyBox, testCase,
+ { model: data.model, valueRole: "color" })
+ verify(control)
+ compare(control.count, 3)
+ compare(control.currentIndex, 0)
+ compare(control.currentValue, "red")
+
+ control.valueRole = "name"
+ compare(control.currentValue, "Apple")
+
+ control.currentIndex = 1
+ compare(control.currentIndex, 1)
+ compare(control.currentValue, "Orange")
+
+ control.valueRole = "color"
+ compare(control.currentValue, "orange")
+
+ control.model = null
+ compare(control.currentIndex, -1)
+ // An invalid QVariant is represented as undefined.
+ compare(control.currentValue, undefined)
+
+ control.valueRole = ""
+ compare(control.currentValue, undefined)
+ }
+
+ function test_valueAt() {
+ var control = createTemporaryObject(comboBox, testCase,
+ { model: fruitmodel, textRole: "name", valueRole: "color" })
+ verify(control)
+
+ compare(control.valueAt(0), "red")
+ compare(control.valueAt(1), "orange")
+ compare(control.valueAt(2), "yellow")
+ compare(control.valueAt(-1), undefined)
+ compare(control.valueAt(5), undefined)
+ }
+
+ function test_indexOfValue_data() {
+ return [
+ { tag: "red", expectedIndex: 0 },
+ { tag: "orange", expectedIndex: 1 },
+ { tag: "yellow", expectedIndex: 2 },
+ { tag: "brown", expectedIndex: -1 },
+ ]
+ }
+
+ function test_indexOfValue(data) {
+ var control = createTemporaryObject(comboBox, testCase,
+ { model: fruitmodel, textRole: "name", valueRole: "color" })
+ verify(control)
+
+ compare(control.indexOfValue(data.tag), data.expectedIndex)
+ }
+
function test_arrowKeys() {
- var control = createTemporaryObject(comboBox, testCase, {model: 3})
+ var control = createTemporaryObject(comboBox, testCase,
+ { model: fruitmodel, textRole: "name", valueRole: "color" })
verify(control)
var activatedSpy = signalSpy.createObject(control, {target: control, signalName: "activated"})
diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml
index 0051b785..9d21fa8b 100644
--- a/tests/auto/controls/data/tst_scrollbar.qml
+++ b/tests/auto/controls/data/tst_scrollbar.qml
@@ -67,7 +67,10 @@ TestCase {
Component {
id: scrollBar
- ScrollBar { padding: 0 }
+ ScrollBar {
+ padding: 0
+ minimumSize: 0
+ }
}
Component {
diff --git a/tests/auto/controls/default/BLACKLIST b/tests/auto/controls/default/BLACKLIST
deleted file mode 100644
index 1e63fcb0..00000000
--- a/tests/auto/controls/default/BLACKLIST
+++ /dev/null
@@ -1,3 +0,0 @@
-[Popup::test_shortcut]
-opensuse ci
-opensuse-leap ci
diff --git a/tests/auto/sanity/tst_sanity.cpp b/tests/auto/sanity/tst_sanity.cpp
index 62a1f574..bfa1ecf1 100644
--- a/tests/auto/sanity/tst_sanity.cpp
+++ b/tests/auto/sanity/tst_sanity.cpp
@@ -122,7 +122,11 @@ public:
if (!parser.parse()) {
const auto diagnosticMessages = parser.diagnosticMessages();
for (const QQmlJS::DiagnosticMessage &msg : diagnosticMessages)
+#if Q_QML_PRIVATE_API_VERSION < 5
m_errors += QString("%s:%d : %s").arg(m_fileName).arg(msg.loc.startLine).arg(msg.message);
+#else
+ m_errors += QString("%s:%d : %s").arg(m_fileName).arg(msg.line).arg(msg.message);
+#endif
return false;
}