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
name: "AbstractButton"
Component {
id: defaultComponent
AbstractButton {}
}
Component {
id: button
AbstractButton {
@ -36,6 +42,13 @@ TestCase {
SignalSpy { }
}
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(defaultComponent, testCase)
verify(control)
}
function test_text() {
var control = createTemporaryObject(button, testCase);
verify(control);

View File

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

View File

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

View File

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

View File

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

View File

@ -47,6 +47,8 @@ TestCase {
}
function test_defaults() {
failOnWarning(/.?/)
var group = createTemporaryObject(buttonGroup, testCase)
verify(group)
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() {
var control = createTemporaryObject(checkBox, testCase)
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?
function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(checkDelegate, testCase);
verify(control);
verify(!control.checked);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,6 +25,13 @@ TestCase {
}
}
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(radioButton, testCase)
verify(control)
}
function test_text() {
var control = createTemporaryObject(radioButton, testCase)
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?
function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(radioDelegate, testCase);
verify(control);
verify(!control.checked);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,6 +28,13 @@ TestCase {
SignalSpy { }
}
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(swipeView, testCase)
verify(control)
}
function test_current() {
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() {
var control = createTemporaryObject(swtch, testCase)
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?
function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(switchDelegate, testCase);
verify(control);
verify(!control.checked);

View File

@ -54,6 +54,8 @@ TestCase {
}
function test_defaults() {
failOnWarning(/.?/)
var control = createTemporaryObject(tabBar, testCase)
verify(control)
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() {
var container = createTemporaryObject(repeater, testCase)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,6 +37,13 @@ TestCase {
target: ToolTip.toolTip
}
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(toolTip, testCase)
verify(control)
}
function test_properties_data() {
return [
{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
property Item tumblerView: null
Component {
id: defaultTumbler
Tumbler {}
}
Component {
id: tumblerComponent
@ -107,6 +113,13 @@ TestCase {
text: modelData
}
function test_defaults() {
failOnWarning(/.?/)
let control = createTemporaryObject(defaultTumbler, testCase)
verify(control)
}
function test_wrapWithoutAttachedProperties() {
createTumbler();
verify(tumbler.wrap);

View File

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