Fail on warnings for simple "default" controls tests

This patch:

- Adds a simple, "default-constructed" (i.e. little or no properties
  set) test function for each control where one was missing.
- Causes those tests to fail on any warning.

It would be simpler to just call failOnWarnings(/.?/) in the
initTestCase() of each test, but there are too marning warnings to fix
right now.

Task-number: QTBUG-98718
Change-Id: Ia3aa901feab5db534925824528caf25297e02760
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Mitch Curtis 2022-11-25 16:11:57 +08:00
parent 20e745bbd8
commit 0765c176e7
53 changed files with 307 additions and 0 deletions

View File

@ -13,6 +13,12 @@ TestCase {
when: windowShown when: windowShown
name: "AbstractButton" name: "AbstractButton"
Component {
id: defaultComponent
AbstractButton {}
}
Component { Component {
id: button id: button
AbstractButton { AbstractButton {
@ -36,6 +42,13 @@ TestCase {
SignalSpy { } SignalSpy { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(defaultComponent, testCase)
verify(control)
}
function test_text() { function test_text() {
var control = createTemporaryObject(button, testCase); var control = createTemporaryObject(button, testCase);
verify(control); verify(control);

View File

@ -24,6 +24,13 @@ TestCase {
SignalSpy { } SignalSpy { }
} }
function test_empty() {
failOnWarning(/.?/)
let control = createTemporaryObject(component, testCase)
verify(control)
}
function test_enabled() { function test_enabled() {
var action = createTemporaryObject(component, testCase) var action = createTemporaryObject(component, testCase)
verify(action) verify(action)

View File

@ -51,6 +51,8 @@ TestCase {
} }
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var group = createTemporaryObject(actionGroup, testCase) var group = createTemporaryObject(actionGroup, testCase)
verify(group) verify(group)
compare(group.actions.length, 0) compare(group.actions.length, 0)

View File

@ -23,6 +23,14 @@ TestCase {
MouseArea { } MouseArea { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(busyIndicator, testCase)
verify(control)
compare(control.running, true)
}
function test_running() { function test_running() {
var control = createTemporaryObject(busyIndicator, testCase) var control = createTemporaryObject(busyIndicator, testCase)
verify(control) verify(control)

View File

@ -30,6 +30,15 @@ TestCase {
SignalSpy { } SignalSpy { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(button, testCase)
verify(control)
compare(control.highlighted, false)
compare(control.flat, false)
}
function test_text() { function test_text() {
var control = createTemporaryObject(button, testCase) var control = createTemporaryObject(button, testCase)
verify(control) verify(control)

View File

@ -47,6 +47,8 @@ TestCase {
} }
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var group = createTemporaryObject(buttonGroup, testCase) var group = createTemporaryObject(buttonGroup, testCase)
verify(group) verify(group)
compare(group.buttons.length, 0) compare(group.buttons.length, 0)

View File

@ -25,6 +25,15 @@ TestCase {
} }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(checkBox, testCase)
verify(control)
compare(control.tristate, false)
compare(control.checkState, Qt.Unchecked)
}
function test_text() { function test_text() {
var control = createTemporaryObject(checkBox, testCase) var control = createTemporaryObject(checkBox, testCase)
verify(control) verify(control)

View File

@ -21,6 +21,8 @@ TestCase {
// TODO: data-fy tst_checkbox (rename to tst_check?) so we don't duplicate its tests here? // TODO: data-fy tst_checkbox (rename to tst_check?) so we don't duplicate its tests here?
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(checkDelegate, testCase); var control = createTemporaryObject(checkDelegate, testCase);
verify(control); verify(control);
verify(!control.checked); verify(!control.checked);

View File

@ -98,6 +98,8 @@ TestCase {
} }
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(comboBox, testCase) var control = createTemporaryObject(comboBox, testCase)
verify(control) verify(control)

View File

@ -24,6 +24,14 @@ TestCase {
Rectangle { } Rectangle { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(container, testCase)
verify(control)
compare(control.count, 0)
}
function test_implicitSize() { function test_implicitSize() {
var control = createTemporaryObject(container, testCase) var control = createTemporaryObject(container, testCase)
verify(control) verify(control)

View File

@ -34,6 +34,15 @@ TestCase {
SignalSpy { } SignalSpy { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(component, testCase)
verify(control)
compare(control.background, null)
compare(control.contentItem, null)
}
function test_padding() { function test_padding() {
var control = createTemporaryObject(component, testCase) var control = createTemporaryObject(component, testCase)
verify(control) verify(control)

View File

@ -18,6 +18,13 @@ TestCase {
DayOfWeekRow { } DayOfWeekRow { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(component, testCase)
verify(control)
}
function test_locale() { function test_locale() {
var control = component.createObject(testCase) var control = component.createObject(testCase)

View File

@ -13,6 +13,12 @@ TestCase {
when: windowShown when: windowShown
name: "DelayButton" name: "DelayButton"
Component {
id: defaultComponent
DelayButton {}
}
Component { Component {
id: delayButton id: delayButton
DelayButton { DelayButton {
@ -32,6 +38,13 @@ TestCase {
SignalSpy { } SignalSpy { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(defaultComponent, testCase)
verify(control)
}
function test_mouse() { function test_mouse() {
var control = createTemporaryObject(delayButton, testCase) var control = createTemporaryObject(delayButton, testCase)
verify(control) verify(control)

View File

@ -28,6 +28,8 @@ TestCase {
} }
function test_instance() { function test_instance() {
failOnWarning(/.?/)
var dial = createTemporaryObject(dialComponent, testCase); var dial = createTemporaryObject(dialComponent, testCase);
verify(dial); verify(dial);
compare(dial.value, 0.0); compare(dial.value, 0.0);

View File

@ -43,6 +43,8 @@ TestCase {
} }
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(dialog, testCase) var control = createTemporaryObject(dialog, testCase)
verify(control) verify(control)
verify(control.header) verify(control.header)

View File

@ -29,6 +29,8 @@ TestCase {
} }
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(buttonBox, testCase) var control = createTemporaryObject(buttonBox, testCase)
verify(control) verify(control)
compare(control.count, 0) compare(control.count, 0)

View File

@ -53,6 +53,8 @@ TestCase {
} }
function test_empty() { function test_empty() {
failOnWarning(/.?/)
var control = createTemporaryObject(frame, testCase) var control = createTemporaryObject(frame, testCase)
verify(control) verify(control)

View File

@ -53,6 +53,8 @@ TestCase {
} }
function test_empty() { function test_empty() {
failOnWarning(/.?/)
var control = createTemporaryObject(groupBox, testCase) var control = createTemporaryObject(groupBox, testCase)
verify(control) verify(control)

View File

@ -18,6 +18,13 @@ TestCase {
ItemDelegate { } ItemDelegate { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(itemDelegate, testCase)
verify(control)
}
function test_baseline() { function test_baseline() {
var control = createTemporaryObject(itemDelegate, testCase) var control = createTemporaryObject(itemDelegate, testCase)
verify(control) verify(control)

View File

@ -36,6 +36,8 @@ TestCase {
} }
function test_creation() { function test_creation() {
failOnWarning(/.?/)
var control = createTemporaryObject(label, testCase) var control = createTemporaryObject(label, testCase)
verify(control) verify(control)
} }

View File

@ -23,6 +23,13 @@ TestCase {
Menu { } Menu { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(menuItem, testCase)
verify(control)
}
function test_baseline() { function test_baseline() {
var control = createTemporaryObject(menuItem, testCase) var control = createTemporaryObject(menuItem, testCase)
verify(control) verify(control)

View File

@ -37,6 +37,13 @@ TestCase {
SignalSpy { } SignalSpy { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(defaultGrid, testCase)
verify(control)
}
function test_locale() { function test_locale() {
var control = delegateGrid.createObject(testCase, {month: 0, year: 2013}) var control = delegateGrid.createObject(testCase, {month: 0, year: 2013})

View File

@ -70,6 +70,8 @@ TestCase {
} }
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(page, testCase) var control = createTemporaryObject(page, testCase)
verify(control) verify(control)
@ -79,6 +81,8 @@ TestCase {
} }
function test_empty() { function test_empty() {
failOnWarning(/.?/)
var control = createTemporaryObject(page, testCase) var control = createTemporaryObject(page, testCase)
verify(control) verify(control)

View File

@ -23,6 +23,13 @@ TestCase {
MouseArea { } MouseArea { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(pageIndicator, testCase)
verify(control)
}
function test_count() { function test_count() {
var control = createTemporaryObject(pageIndicator, testCase) var control = createTemporaryObject(pageIndicator, testCase)
verify(control) verify(control)

View File

@ -66,6 +66,8 @@ TestCase {
} }
function test_empty() { function test_empty() {
failOnWarning(/.?/)
var control = createTemporaryObject(pane, testCase) var control = createTemporaryObject(pane, testCase)
verify(control) verify(control)

View File

@ -42,6 +42,13 @@ TestCase {
SignalSpy { } SignalSpy { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(popupControl, testCase)
verify(control)
}
function test_padding() { function test_padding() {
var control = createTemporaryObject(popupTemplate, testCase) var control = createTemporaryObject(popupTemplate, testCase)
verify(control) verify(control)

View File

@ -18,6 +18,13 @@ TestCase {
ProgressBar { } ProgressBar { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(progressBar, testCase)
verify(control)
}
function test_value() { function test_value() {
var control = createTemporaryObject(progressBar, testCase) var control = createTemporaryObject(progressBar, testCase)
verify(control) verify(control)

View File

@ -25,6 +25,13 @@ TestCase {
} }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(radioButton, testCase)
verify(control)
}
function test_text() { function test_text() {
var control = createTemporaryObject(radioButton, testCase) var control = createTemporaryObject(radioButton, testCase)
verify(control) verify(control)

View File

@ -21,6 +21,8 @@ TestCase {
// TODO: data-fy tst_radiobutton (rename to tst_radio?) so we don't duplicate its tests here? // TODO: data-fy tst_radiobutton (rename to tst_radio?) so we don't duplicate its tests here?
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(radioDelegate, testCase); var control = createTemporaryObject(radioDelegate, testCase);
verify(control); verify(control);
verify(!control.checked); verify(!control.checked);

View File

@ -43,6 +43,8 @@ TestCase {
} }
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(sliderComponent, testCase) var control = createTemporaryObject(sliderComponent, testCase)
verify(control) verify(control)

View File

@ -18,6 +18,13 @@ TestCase {
RoundButton { } RoundButton { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(roundButton, testCase)
verify(control)
}
function test_radius() { function test_radius() {
var control = createTemporaryObject(roundButton, testCase); var control = createTemporaryObject(roundButton, testCase);
verify(control); verify(control);

View File

@ -19,6 +19,12 @@ TestCase {
SignalSpy { } SignalSpy { }
} }
Component {
id: defaultScrollBar
ScrollBar {}
}
Component { Component {
id: scrollBar id: scrollBar
ScrollBar { ScrollBar {
@ -46,6 +52,13 @@ TestCase {
} }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(defaultScrollBar, testCase)
verify(control)
}
function test_attach() { function test_attach() {
var container = createTemporaryObject(flickable, testCase) var container = createTemporaryObject(flickable, testCase)
verify(container) verify(container)

View File

@ -35,6 +35,13 @@ TestCase {
} }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(scrollIndicator, testCase)
verify(control)
}
function test_attach() { function test_attach() {
var container = createTemporaryObject(flickable, testCase) var container = createTemporaryObject(flickable, testCase)
verify(container) verify(container)

View File

@ -156,6 +156,13 @@ TestCase {
} }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(scrollView, testCase)
verify(control)
}
function test_scrollBars() { function test_scrollBars() {
var control = createTemporaryObject(scrollView, testCase, {width: 200, height: 200}) var control = createTemporaryObject(scrollView, testCase, {width: 200, height: 200})
verify(control) verify(control)

View File

@ -19,6 +19,12 @@ TestCase {
property Item handle: null property Item handle: null
property bool handleWasDragged: false property bool handleWasDragged: false
Component {
id: defaultSelectionRectangle
SelectionRectangle {}
}
Component { Component {
id: handleComp id: handleComp
Rectangle { Rectangle {
@ -87,6 +93,13 @@ TestCase {
SignalSpy { } SignalSpy { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(defaultSelectionRectangle, testCase)
verify(control)
}
function test_set_target() { function test_set_target() {
let tableView = createTemporaryObject(tableviewComp, testCase) let tableView = createTemporaryObject(tableviewComp, testCase)
verify(tableView) verify(tableView)

View File

@ -24,6 +24,8 @@ TestCase {
} }
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(slider, testCase) var control = createTemporaryObject(slider, testCase)
verify(control) verify(control)

View File

@ -30,6 +30,8 @@ TestCase {
} }
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(spinBox, testCase) var control = createTemporaryObject(spinBox, testCase)
verify(control) verify(control)

View File

@ -111,6 +111,12 @@ TestCase {
} }
} }
Component {
id: defaultSplitView
SplitView {}
}
Component { Component {
id: splitViewComponent id: splitViewComponent
@ -126,6 +132,13 @@ TestCase {
Rectangle {} Rectangle {}
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(defaultSplitView, testCase)
verify(control)
}
function test_addItemsAfterCompletion() { function test_addItemsAfterCompletion() {
var control = createTemporaryObject(splitViewComponent, testCase) var control = createTemporaryObject(splitViewComponent, testCase)
verify(control) verify(control)

View File

@ -30,6 +30,13 @@ TestCase {
Component { id: withRequired; Item { required property int i }} Component { id: withRequired; Item { required property int i }}
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(stackView, testCase)
verify(control)
}
function test_initialItem() { function test_initialItem() {
var control1 = createTemporaryObject(stackView, testCase) var control1 = createTemporaryObject(stackView, testCase)
verify(control1) verify(control1)

View File

@ -244,6 +244,8 @@ TestCase {
} }
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(swipeDelegateComponent, testCase); var control = createTemporaryObject(swipeDelegateComponent, testCase);
verify(control); verify(control);

View File

@ -28,6 +28,13 @@ TestCase {
SignalSpy { } SignalSpy { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(swipeView, testCase)
verify(control)
}
function test_current() { function test_current() {
var control = createTemporaryObject(swipeView, testCase) var control = createTemporaryObject(swipeView, testCase)

View File

@ -25,6 +25,13 @@ TestCase {
} }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(swtch, testCase)
verify(control)
}
function test_text() { function test_text() {
var control = createTemporaryObject(swtch, testCase) var control = createTemporaryObject(swtch, testCase)
verify(control) verify(control)

View File

@ -28,6 +28,8 @@ TestCase {
// TODO: data-fy tst_checkbox (rename to tst_check?) so we don't duplicate its tests here? // TODO: data-fy tst_checkbox (rename to tst_check?) so we don't duplicate its tests here?
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(switchDelegate, testCase); var control = createTemporaryObject(switchDelegate, testCase);
verify(control); verify(control);
verify(!control.checked); verify(!control.checked);

View File

@ -54,6 +54,8 @@ TestCase {
} }
function test_defaults() { function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(tabBar, testCase) var control = createTemporaryObject(tabBar, testCase)
verify(control) verify(control)
compare(control.count, 0) compare(control.count, 0)

View File

@ -28,6 +28,13 @@ TestCase {
} }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(tabButton, testCase)
verify(control)
}
function test_autoExclusive() { function test_autoExclusive() {
var container = createTemporaryObject(repeater, testCase) var container = createTemporaryObject(repeater, testCase)

View File

@ -69,6 +69,8 @@ TestCase {
} }
function test_creation() { function test_creation() {
failOnWarning(/.?/)
var control = createTemporaryObject(textArea, testCase) var control = createTemporaryObject(textArea, testCase)
verify(control) verify(control)
} }

View File

@ -30,6 +30,8 @@ TestCase {
} }
function test_creation() { function test_creation() {
failOnWarning(/.?/)
var control = createTemporaryObject(textField, testCase) var control = createTemporaryObject(textField, testCase)
verify(control) verify(control)
} }

View File

@ -53,6 +53,8 @@ TestCase {
} }
function test_empty() { function test_empty() {
failOnWarning(/.?/)
var control = createTemporaryObject(toolBar, testCase) var control = createTemporaryObject(toolBar, testCase)
verify(control) verify(control)

View File

@ -23,6 +23,13 @@ TestCase {
ToolButton { } ToolButton { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(toolButton, testCase)
verify(control)
}
function test_text() { function test_text() {
var control = createTemporaryObject(toolButton, testCase) var control = createTemporaryObject(toolButton, testCase)
verify(control) verify(control)

View File

@ -17,6 +17,13 @@ TestCase {
ToolSeparator {} ToolSeparator {}
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(toolSeparator, testCase)
verify(control)
}
function test_size() { function test_size() {
var control = createTemporaryObject(toolSeparator, testCase); var control = createTemporaryObject(toolSeparator, testCase);
verify(control); verify(control);

View File

@ -37,6 +37,13 @@ TestCase {
target: ToolTip.toolTip target: ToolTip.toolTip
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(toolTip, testCase)
verify(control)
}
function test_properties_data() { function test_properties_data() {
return [ return [
{tag: "text", property: "text", defaultValue: "", setValue: "Hello", signalName: "textChanged"}, {tag: "text", property: "text", defaultValue: "", setValue: "Hello", signalName: "textChanged"},

View File

@ -21,6 +21,12 @@ TestCase {
readonly property real tumblerDelegateHeight: tumbler ? tumbler.availableHeight / tumbler.visibleItemCount : 0 readonly property real tumblerDelegateHeight: tumbler ? tumbler.availableHeight / tumbler.visibleItemCount : 0
property Item tumblerView: null property Item tumblerView: null
Component {
id: defaultTumbler
Tumbler {}
}
Component { Component {
id: tumblerComponent id: tumblerComponent
@ -107,6 +113,13 @@ TestCase {
text: modelData text: modelData
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(defaultTumbler, testCase)
verify(control)
}
function test_wrapWithoutAttachedProperties() { function test_wrapWithoutAttachedProperties() {
createTumbler(); createTumbler();
verify(tumbler.wrap); verify(tumbler.wrap);

View File

@ -18,6 +18,13 @@ TestCase {
WeekNumberColumn { } WeekNumberColumn { }
} }
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(component, testCase)
verify(control)
}
function test_locale() { function test_locale() {
var control = component.createObject(testCase) var control = component.createObject(testCase)