diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2019-02-15 11:28:04 +0100 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2019-02-15 10:51:41 +0000 |
commit | 8926667c4c0c3025a029b958db1c34bef32e1f6d (patch) | |
tree | 4f64b035855a2e94a92383b409cdd5dcc4c88c4e /tests/auto | |
parent | 01e566e61a45561cff7d800ae310406c1792e494 (diff) | |
download | qtivi-8926667c4c0c3025a029b958db1c34bef32e1f6d.tar.gz |
ivigenerator: Properly support the datatype 'var'
Some checks in generate.py where wrong and cause pythong exceptions.
In addition some more conversion logic is needed to make sure most
types can also be handled from the yaml files.
Added the type to test qface files.
Change-Id: I72c9043102b958afa946b93cfcf4e9bbe8422aef
Fixes: AUTOSUITE-769
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
Diffstat (limited to 'tests/auto')
5 files changed, 22 insertions, 14 deletions
diff --git a/tests/auto/core/ivigenerator/org.example.echo.qface b/tests/auto/core/ivigenerator/org.example.echo.qface index ae6249c..b44381b 100644 --- a/tests/auto/core/ivigenerator/org.example.echo.qface +++ b/tests/auto/core/ivigenerator/org.example.echo.qface @@ -18,6 +18,7 @@ interface Echo { */ readonly string lastMessage; int intValue; + var varValue; @config_simulator: {minimum: 10.} real floatValue1; @config_simulator: {maximum: 10.} @@ -51,6 +52,7 @@ interface EchoZoned { */ readonly string lastMessage; int intValue; + var varValue; @config_simulator: {domain: ["one", "two", "three"]} string stringValue; string unsupportedValue; @@ -70,11 +72,13 @@ interface EchoZoned { string echo(string msg); string id(); + var varMethod(); Combo getCombo(); signal anotherChanged(AnotherStruct another); signal foobar(string foo); signal somethingHappened(); + signal newValueAvailable(var newValue); } /** @@ -111,6 +115,7 @@ struct Contact { string name; int age; bool isMarried; + var additionalData; } struct Combo { diff --git a/tests/auto/core/ivigenerator/org.example.echo.qtro.qface b/tests/auto/core/ivigenerator/org.example.echo.qtro.qface index 79d691b..3c09f1c 100644 --- a/tests/auto/core/ivigenerator/org.example.echo.qtro.qface +++ b/tests/auto/core/ivigenerator/org.example.echo.qtro.qface @@ -18,6 +18,7 @@ interface Echo { */ readonly string lastMessage; int intValue; + var varValue; @config_simulator: {minimum: 10.} real floatValue1; @config_simulator: {maximum: 10.} @@ -36,6 +37,7 @@ interface Echo { signal anotherChanged(AnotherStruct another); signal foobar(string foo); signal somethingHappened(); + signal newValueAvailable(var newValue); } enum WeekDay { @@ -53,6 +55,7 @@ struct Contact { string name; int age; bool isMarried; + var additionalData; } struct Combo { diff --git a/tests/auto/core/ivigenerator/org.example.echo.yaml b/tests/auto/core/ivigenerator/org.example.echo.yaml index f0d1769..10953f0 100644 --- a/tests/auto/core/ivigenerator/org.example.echo.yaml +++ b/tests/auto/core/ivigenerator/org.example.echo.yaml @@ -44,12 +44,12 @@ org.example.echo.Echo#intValue: org.example.echo.EchoZoned#contact: config_simulator: zoned: true - default: [ "foo", 23, true ] + default: [ "foo", 23, true, 1234 ] org.example.echo.EchoZoned#combo: config_simulator: zoned: true - default: [ [ "foo", 23, true ], WeekDay.Monday ] + default: [ [ "foo", 23, true, 1234 ], WeekDay.Monday ] org.example.echo.EchoZoned#intList: config_simulator: @@ -57,8 +57,8 @@ org.example.echo.EchoZoned#intList: org.example.echo.EchoZoned#comboList: config_simulator: - default: [[ [ "foo", 23, true ], WeekDay.Monday ], [ [ "bar", 21, false ], WeekDay.Tuesday ]] + default: [[ [ "foo", 23, true, 1234 ], WeekDay.Monday ], [ [ "bar", 21, false, "foo" ], WeekDay.Tuesday ]] org.example.echo.Echo#contactList: config_simulator: - default: [[ "foo", 23, true ], [ "bar", 12, false ]] + default: [[ "foo", 23, true, WeekDay.Monday ], [ "bar", 12, false, false ]] diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/echoservice.cpp b/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/echoservice.cpp index f24b359..4585019 100644 --- a/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/echoservice.cpp +++ b/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/echoservice.cpp @@ -30,7 +30,7 @@ #include "echoservice.h" EchoService::EchoService() - :m_testCombo(Contact(QStringLiteral("Antti"), 34, true), EchoModule::Friday), + :m_testCombo(Contact(QStringLiteral("Antti"), 34, true, QVariant()), EchoModule::Friday), m_testId(QStringLiteral("id123")) { diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/tst_echoqtro.cpp b/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/tst_echoqtro.cpp index 9cb5ef6..9ef15f7 100644 --- a/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/tst_echoqtro.cpp +++ b/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/tst_echoqtro.cpp @@ -80,9 +80,9 @@ void EchoQtroTest::testInit() float floatValue2TestValue(2.71); QString stringValueTestValue("test string"); QVariantList contactListTestValue( - { QVariant::fromValue<Contact>(Contact("Mr A.", 20, false)), - QVariant::fromValue<Contact>(Contact("Mr B.", 40, true)) }); - Contact contactTestValue("Nemo", 47, true); + { QVariant::fromValue<Contact>(Contact("Mr A.", 20, false, "foo")), + QVariant::fromValue<Contact>(Contact("Mr B.", 40, true, "bar")) }); + Contact contactTestValue("Nemo", 47, true, 1); EchoModule::WeekDay weekDayTestValue = EchoModule::Wednesday; @@ -209,8 +209,8 @@ void EchoQtroTest::testClient2Server() QSignalSpy contactListSpy(&server.m_service, SIGNAL(contactListChanged(QVariantList))); QVERIFY(contactListSpy.isValid()); QVariantList contactListTestValue( - { QVariant::fromValue<Contact>(Contact("Mr A.", 20, false)), - QVariant::fromValue<Contact>(Contact("Mr B.", 40, true)) }); + { QVariant::fromValue<Contact>(Contact("Mr A.", 20, false, "foo")), + QVariant::fromValue<Contact>(Contact("Mr B.", 40, true, "bar")) }); client.setContactList(contactListTestValue); WAIT_AND_COMPARE(contactListSpy, 1); QCOMPARE(server.m_service.contactList().count(),contactListTestValue.count()); @@ -222,7 +222,7 @@ void EchoQtroTest::testClient2Server() QSignalSpy contactSpy(&server.m_service, SIGNAL(contactChanged(Contact))); QVERIFY(contactSpy.isValid()); - Contact contactTestValue("Nemo", 47, true); + Contact contactTestValue("Nemo", 47, true, 1); client.setContact(contactTestValue); WAIT_AND_COMPARE(contactSpy, 1); QCOMPARE(server.m_service.contact(), contactTestValue); @@ -288,8 +288,8 @@ void EchoQtroTest::testServer2Client() QSignalSpy contactListSpy(&client, SIGNAL(contactListChanged(QVariantList))); QVERIFY(contactListSpy.isValid()); QVariantList contactListTestValue( - { QVariant::fromValue<Contact>(Contact("Mr A.", 20, false)), - QVariant::fromValue<Contact>(Contact("Mr B.", 40, true)) }); + { QVariant::fromValue<Contact>(Contact("Mr A.", 20, false, "foo")), + QVariant::fromValue<Contact>(Contact("Mr B.", 40, true, "bar")) }); server.m_service.setContactList(contactListTestValue); WAIT_AND_COMPARE(contactListSpy, 1); QCOMPARE(client.contactList().count(),contactListTestValue.count()); @@ -301,7 +301,7 @@ void EchoQtroTest::testServer2Client() QSignalSpy contactSpy(&client, SIGNAL(contactChanged(Contact))); QVERIFY(contactSpy.isValid()); - Contact contactTestValue("Nemo", 47, true); + Contact contactTestValue("Nemo", 47, true, 1); server.m_service.setContact(contactTestValue); WAIT_AND_COMPARE(contactSpy, 1); QCOMPARE(client.contact(), contactTestValue); |