2018-07-22 16:07:46 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
import QtQuick 2.6
|
|
|
|
import QtTest 1.2
|
|
|
|
|
|
|
|
TestCase {
|
|
|
|
name: "qPrefDiveComputer"
|
|
|
|
|
|
|
|
function test_variables() {
|
2018-09-07 11:53:00 +00:00
|
|
|
var x1 = PrefDiveComputer.device
|
|
|
|
PrefDiveComputer.device = "my device"
|
|
|
|
compare(PrefDiveComputer.device, "my device")
|
2018-07-22 16:07:46 +00:00
|
|
|
|
2018-09-07 11:53:00 +00:00
|
|
|
var x2 = PrefDiveComputer.device_name
|
|
|
|
PrefDiveComputer.device_name = "my device name"
|
|
|
|
compare(PrefDiveComputer.device_name, "my device name")
|
2018-07-22 16:07:46 +00:00
|
|
|
|
2018-09-07 11:53:00 +00:00
|
|
|
var x4 = PrefDiveComputer.product
|
|
|
|
PrefDiveComputer.product = "my product"
|
|
|
|
compare(PrefDiveComputer.product, "my product")
|
2018-07-22 16:07:46 +00:00
|
|
|
|
2018-09-07 11:53:00 +00:00
|
|
|
var x5 = PrefDiveComputer.vendor
|
|
|
|
PrefDiveComputer.vendor = "my vendor"
|
|
|
|
compare(PrefDiveComputer.vendor, "my vendor")
|
2018-07-22 16:07:46 +00:00
|
|
|
}
|
2018-08-28 10:33:47 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: spyCatcher
|
|
|
|
|
|
|
|
property bool spy1 : false
|
|
|
|
property bool spy2 : false
|
|
|
|
property bool spy4 : false
|
|
|
|
property bool spy5 : false
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: PrefDiveComputer
|
|
|
|
onDeviceChanged: {spyCatcher.spy1 = true }
|
|
|
|
onDevice_nameChanged: {spyCatcher.spy2 = true }
|
|
|
|
onProductChanged: {spyCatcher.spy4 = true }
|
|
|
|
onVendorChanged: {spyCatcher.spy5 = true }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_signals() {
|
|
|
|
PrefDiveComputer.device = "qml"
|
|
|
|
PrefDiveComputer.device_name = "qml"
|
|
|
|
PrefDiveComputer.product = "qml"
|
|
|
|
PrefDiveComputer.vendor = "qml"
|
|
|
|
|
|
|
|
compare(spyCatcher.spy1, true)
|
|
|
|
compare(spyCatcher.spy2, true)
|
|
|
|
compare(spyCatcher.spy4, true)
|
|
|
|
compare(spyCatcher.spy5, true)
|
|
|
|
}
|
2018-07-22 16:07:46 +00:00
|
|
|
}
|
|
|
|
|