1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtTest
import QtQuick.Controls
TestCase {
id: testCase
width: 400
height: 400
visible: true
name: "ToolSeparator"
Component {
id: toolSeparator
ToolSeparator {}
}
function init() {
failOnWarning(/.?/)
}
function test_defaults() {
let control = createTemporaryObject(toolSeparator, testCase)
verify(control)
}
function test_size() {
let control = createTemporaryObject(toolSeparator, testCase);
verify(control);
verify(control.width > 1);
verify(control.height > 1);
}
Component {
id: signalSpyComponent
SignalSpy {}
}
function test_orientation() {
let control = createTemporaryObject(toolSeparator, testCase);
verify(control);
compare(control.horizontal, false);
compare(control.vertical, true);
let orientationSpy = signalSpyComponent.createObject(control, { target: control, signalName: "orientationChanged" });
let originalWidth = control.width;
let originalHeight = control.height;
control.orientation = Qt.Horizontal;
compare(control.orientation, Qt.Horizontal);
compare(control.width, originalHeight);
compare(control.height, originalWidth);
compare(control.horizontal, true);
compare(control.vertical, false);
compare(orientationSpy.count, 1);
control.orientation = Qt.Vertical;
compare(control.orientation, Qt.Vertical);
compare(control.width, originalWidth);
compare(control.height, originalHeight);
compare(control.horizontal, false);
compare(control.vertical, true);
compare(orientationSpy.count, 2);
}
}
|