mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Tests: remove testing of download_mode
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a20626a874
commit
a6e4de6b5e
2 changed files with 0 additions and 30 deletions
|
@ -23,13 +23,11 @@ void TestQPrefDiveComputer::test_struct_get()
|
|||
|
||||
prefs.dive_computer.device = copy_qstring("my device");
|
||||
prefs.dive_computer.device_name = copy_qstring("my device name");
|
||||
prefs.dive_computer.download_mode = 17;
|
||||
prefs.dive_computer.product = copy_qstring("my product");
|
||||
prefs.dive_computer.vendor = copy_qstring("my vendor");
|
||||
|
||||
QCOMPARE(tst->device(), QString(prefs.dive_computer.device));
|
||||
QCOMPARE(tst->device_name(), QString(prefs.dive_computer.device_name));
|
||||
QCOMPARE(tst->download_mode(), prefs.dive_computer.download_mode);
|
||||
QCOMPARE(tst->product(), QString(prefs.dive_computer.product));
|
||||
QCOMPARE(tst->vendor(), QString(prefs.dive_computer.vendor));
|
||||
}
|
||||
|
@ -42,13 +40,11 @@ void TestQPrefDiveComputer::test_set_struct()
|
|||
|
||||
tst->set_device("t2 device");
|
||||
tst->set_device_name("t2 device name");
|
||||
tst->set_download_mode(27);
|
||||
tst->set_product("t2 product");
|
||||
tst->set_vendor("t2 vendor");
|
||||
|
||||
QCOMPARE(QString(prefs.dive_computer.device), QString("t2 device"));
|
||||
QCOMPARE(QString(prefs.dive_computer.device_name), QString("t2 device name"));
|
||||
QCOMPARE(prefs.dive_computer.download_mode, 27);
|
||||
QCOMPARE(QString(prefs.dive_computer.product), QString("t2 product"));
|
||||
QCOMPARE(QString(prefs.dive_computer.vendor), QString("t2 vendor"));
|
||||
}
|
||||
|
@ -61,20 +57,17 @@ void TestQPrefDiveComputer::test_set_load_struct()
|
|||
|
||||
tst->set_device("t3 device");
|
||||
tst->set_device_name("t3 device name");
|
||||
tst->set_download_mode(37);
|
||||
tst->set_product("t3 product");
|
||||
tst->set_vendor("t3 vendor");
|
||||
|
||||
prefs.dive_computer.device = copy_qstring("error1");
|
||||
prefs.dive_computer.device_name = copy_qstring("error2");
|
||||
prefs.dive_computer.download_mode = 38;
|
||||
prefs.dive_computer.product = copy_qstring("error3");
|
||||
prefs.dive_computer.vendor = copy_qstring("error4");
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(QString(prefs.dive_computer.device), QString("t3 device"));
|
||||
QCOMPARE(QString(prefs.dive_computer.device_name), QString("t3 device name"));
|
||||
QCOMPARE(prefs.dive_computer.download_mode, 37);
|
||||
QCOMPARE(QString(prefs.dive_computer.product), QString("t3 product"));
|
||||
QCOMPARE(QString(prefs.dive_computer.vendor), QString("t3 vendor"));
|
||||
}
|
||||
|
@ -87,7 +80,6 @@ void TestQPrefDiveComputer::test_struct_disk()
|
|||
|
||||
prefs.dive_computer.device = copy_qstring("t4 device");
|
||||
prefs.dive_computer.device_name = copy_qstring("t4 device name");
|
||||
prefs.dive_computer.download_mode = 47;
|
||||
prefs.dive_computer.product = copy_qstring("t4 product");
|
||||
prefs.dive_computer.vendor = copy_qstring("t4 vendor");
|
||||
|
||||
|
@ -95,7 +87,6 @@ void TestQPrefDiveComputer::test_struct_disk()
|
|||
|
||||
prefs.dive_computer.device = copy_qstring("error");
|
||||
prefs.dive_computer.device_name = copy_qstring("error");
|
||||
prefs.dive_computer.download_mode = 48;
|
||||
prefs.dive_computer.product = copy_qstring("error");
|
||||
prefs.dive_computer.vendor = copy_qstring("error");
|
||||
|
||||
|
@ -103,7 +94,6 @@ void TestQPrefDiveComputer::test_struct_disk()
|
|||
|
||||
QCOMPARE(QString(prefs.dive_computer.device), QString("t4 device"));
|
||||
QCOMPARE(QString(prefs.dive_computer.device_name), QString("t4 device name"));
|
||||
QCOMPARE(prefs.dive_computer.download_mode, 47);
|
||||
QCOMPARE(QString(prefs.dive_computer.product), QString("t4 product"));
|
||||
QCOMPARE(QString(prefs.dive_computer.vendor), QString("t4 vendor"));
|
||||
}
|
||||
|
@ -112,15 +102,12 @@ void TestQPrefDiveComputer::test_multiple()
|
|||
{
|
||||
// test multiple instances have the same information
|
||||
auto tst_direct = new qPrefDiveComputer;
|
||||
prefs.dive_computer.download_mode = 57;
|
||||
|
||||
auto tst = qPrefDiveComputer::instance();
|
||||
prefs.dive_computer.device = copy_qstring("mine");
|
||||
|
||||
QCOMPARE(tst->device(), tst_direct->device());
|
||||
QCOMPARE(tst->device(), QString("mine"));
|
||||
QCOMPARE(tst->download_mode(), tst_direct->download_mode());
|
||||
QCOMPARE(tst->download_mode(), 57);
|
||||
}
|
||||
|
||||
#define TEST(METHOD, VALUE) \
|
||||
|
@ -138,11 +125,6 @@ void TestQPrefDiveComputer::test_oldPreferences()
|
|||
dc->set_device("Deepwater");
|
||||
TEST(dc->device(), QStringLiteral("Deepwater"));
|
||||
|
||||
dc->set_download_mode(0);
|
||||
TEST(dc->download_mode(), 0);
|
||||
dc->set_download_mode(1);
|
||||
TEST(dc->download_mode(), 1);
|
||||
|
||||
dc->set_product("Thingy1");
|
||||
TEST(dc->product(), QStringLiteral("Thingy1"));
|
||||
dc->set_product("Thingy2");
|
||||
|
@ -158,25 +140,21 @@ void TestQPrefDiveComputer::test_signals()
|
|||
{
|
||||
QSignalSpy spy1(qPrefDiveComputer::instance(), SIGNAL(deviceChanged(QString)));
|
||||
QSignalSpy spy2(qPrefDiveComputer::instance(), SIGNAL(device_nameChanged(QString)));
|
||||
QSignalSpy spy3(qPrefDiveComputer::instance(), SIGNAL(download_modeChanged(int)));
|
||||
QSignalSpy spy4(qPrefDiveComputer::instance(), SIGNAL(productChanged(QString)));
|
||||
QSignalSpy spy5(qPrefDiveComputer::instance(), SIGNAL(vendorChanged(QString)));
|
||||
|
||||
qPrefDiveComputer::set_device("t_signal device");
|
||||
qPrefDiveComputer::set_device_name("t_signal device name");
|
||||
qPrefDiveComputer::set_download_mode(-100);
|
||||
qPrefDiveComputer::set_product("t_signal product");
|
||||
qPrefDiveComputer::set_vendor("t_signal vendor");
|
||||
|
||||
QCOMPARE(spy1.count(), 1);
|
||||
QCOMPARE(spy2.count(), 1);
|
||||
QCOMPARE(spy3.count(), 1);
|
||||
QCOMPARE(spy4.count(), 1);
|
||||
QCOMPARE(spy5.count(), 1);
|
||||
|
||||
QVERIFY(spy1.takeFirst().at(0).toString() == "t_signal device");
|
||||
QVERIFY(spy2.takeFirst().at(0).toString() == "t_signal device name");
|
||||
QVERIFY(spy3.takeFirst().at(0).toInt() == -100);
|
||||
QVERIFY(spy4.takeFirst().at(0).toString() == "t_signal product");
|
||||
QVERIFY(spy5.takeFirst().at(0).toString() == "t_signal vendor");
|
||||
}
|
||||
|
|
|
@ -14,10 +14,6 @@ TestCase {
|
|||
PrefDiveComputer.device_name = "my device name"
|
||||
compare(PrefDiveComputer.device_name, "my device name")
|
||||
|
||||
var x3 = PrefDiveComputer.download_mode
|
||||
PrefDiveComputer.download_mode = 19
|
||||
compare(PrefDiveComputer.download_mode, 19)
|
||||
|
||||
var x4 = PrefDiveComputer.product
|
||||
PrefDiveComputer.product = "my product"
|
||||
compare(PrefDiveComputer.product, "my product")
|
||||
|
@ -32,7 +28,6 @@ TestCase {
|
|||
|
||||
property bool spy1 : false
|
||||
property bool spy2 : false
|
||||
property bool spy3 : false
|
||||
property bool spy4 : false
|
||||
property bool spy5 : false
|
||||
|
||||
|
@ -40,7 +35,6 @@ TestCase {
|
|||
target: PrefDiveComputer
|
||||
onDeviceChanged: {spyCatcher.spy1 = true }
|
||||
onDevice_nameChanged: {spyCatcher.spy2 = true }
|
||||
onDownload_modeChanged: {spyCatcher.spy3 = true }
|
||||
onProductChanged: {spyCatcher.spy4 = true }
|
||||
onVendorChanged: {spyCatcher.spy5 = true }
|
||||
}
|
||||
|
@ -49,13 +43,11 @@ TestCase {
|
|||
function test_signals() {
|
||||
PrefDiveComputer.device = "qml"
|
||||
PrefDiveComputer.device_name = "qml"
|
||||
PrefDiveComputer.download_mode = -19
|
||||
PrefDiveComputer.product = "qml"
|
||||
PrefDiveComputer.vendor = "qml"
|
||||
|
||||
compare(spyCatcher.spy1, true)
|
||||
compare(spyCatcher.spy2, true)
|
||||
compare(spyCatcher.spy3, true)
|
||||
compare(spyCatcher.spy4, true)
|
||||
compare(spyCatcher.spy5, true)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue