simpletest.cpp 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. /*
  2. * MIT License
  3. *
  4. * Copyright (c) 2019 Alexey Edelev <semlanik@gmail.com>
  5. *
  6. * This file is part of qtprotobuf project https://git.semlanik.org/semlanik/qtprotobuf
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy of this
  9. * software and associated documentation files (the "Software"), to deal in the Software
  10. * without restriction, including without limitation the rights to use, copy, modify,
  11. * merge, publish, distribute, sublicense, and/or sell copies of the Software, and
  12. * to permit persons to whom the Software is furnished to do so, subject to the following
  13. * conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in all copies
  16. * or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  19. * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  20. * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  21. * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  22. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  23. * DEALINGS IN THE SOFTWARE.
  24. */
  25. #include "simpletest.h"
  26. #include "stepchildenummessage.h"
  27. #include "simpleboolmessage.h"
  28. #include "simpleintmessage.h"
  29. #include "simplesintmessage.h"
  30. #include "simpleuintmessage.h"
  31. #include "simpleint64message.h"
  32. #include "simplesint64message.h"
  33. #include "simpleuint64message.h"
  34. #include "simplefixedint32message.h"
  35. #include "simplefixedint64message.h"
  36. #include "simplesfixedint32message.h"
  37. #include "simplesfixedint64message.h"
  38. #include "simplestringmessage.h"
  39. #include "simplefloatmessage.h"
  40. #include "simpledoublemessage.h"
  41. #include "simpleenummessage.h"
  42. #include "simplefileenummessage.h"
  43. #include "simpleexternalenummessage.h"
  44. #include "externalcomplexmessage.h"
  45. #include "complexmessage.h"
  46. #include "simplebytesmessage.h"
  47. #include "repeatedintmessage.h"
  48. #include "repeatedbytesmessage.h"
  49. #include "repeateddoublemessage.h"
  50. #include "repeatedcomplexmessage.h"
  51. #include "repeatedfloatmessage.h"
  52. #include "repeatedsintmessage.h"
  53. #include "repeatedstringmessage.h"
  54. #include "repeateduintmessage.h"
  55. #include "repeatedint64message.h"
  56. #include "repeatedsint64message.h"
  57. #include "repeateduint64message.h"
  58. #include "repeatedfixedintmessage.h"
  59. #include "repeatedsfixedintmessage.h"
  60. #include "repeatedfixedint64message.h"
  61. #include "repeatedsfixedint64message.h"
  62. #include "repeatedexternalcomplexmessage.h"
  63. #include "globalenums.h"
  64. #include "qtprotobuf.h"
  65. #include <QVariantList>
  66. #include <QMetaProperty>
  67. using namespace qtprotobufnamespace::tests;
  68. using namespace qtprotobuf::tests;
  69. using namespace qtprotobuf;
  70. SimpleTest::SimpleTest()
  71. {
  72. QtProtobuf::init();
  73. }
  74. TEST_F(SimpleTest, SimpleBoolMessageTest)
  75. {
  76. const char* propertyName = "testFieldBool";
  77. SimpleBoolMessage test;
  78. int propertyNumber = SimpleBoolMessage::propertyOrdering.at(1); //See simpletest.proto
  79. ASSERT_STREQ(SimpleBoolMessage::staticMetaObject.property(propertyNumber).typeName(), "bool");
  80. ASSERT_EQ(SimpleBoolMessage::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<bool>());
  81. ASSERT_STREQ(SimpleBoolMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  82. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(true)));
  83. ASSERT_EQ(test.property(propertyName).toBool(), true);
  84. ASSERT_EQ(test.testFieldBool(), true);
  85. }
  86. TEST_F(SimpleTest, SimpleIntMessageTest)
  87. {
  88. const char* propertyName = "testFieldInt";
  89. SimpleIntMessage test;
  90. int propertyNumber = SimpleIntMessage::propertyOrdering.at(1); //See simpletest.proto
  91. ASSERT_STREQ(SimpleIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::int32");
  92. ASSERT_EQ(SimpleIntMessage::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<int32>());
  93. ASSERT_STREQ(SimpleIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  94. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  95. ASSERT_EQ(test.property(propertyName).toInt(), 1);
  96. ASSERT_EQ(test.testFieldInt(), 1);
  97. }
  98. TEST_F(SimpleTest, SimpleSIntMessageTest)
  99. {
  100. const char* propertyName = "testFieldInt";
  101. SimpleSIntMessage test;
  102. int propertyNumber = SimpleSIntMessage::propertyOrdering.at(1); //See simpletest.proto
  103. ASSERT_STREQ(SimpleSIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sint32");
  104. ASSERT_EQ(SimpleSIntMessage::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<sint32>());
  105. ASSERT_STREQ(SimpleSIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  106. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  107. ASSERT_EQ(test.property(propertyName).toInt(), 1);
  108. ASSERT_EQ(test.testFieldInt(), 1);
  109. }
  110. TEST_F(SimpleTest, SimpleUIntMessageTest)
  111. {
  112. const char* propertyName = "testFieldInt";
  113. SimpleUIntMessage test;
  114. int propertyNumber = SimpleUIntMessage::propertyOrdering.at(1); //See simpletest.proto
  115. ASSERT_STREQ(SimpleUIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::uint32");
  116. ASSERT_EQ(SimpleUIntMessage::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<uint32>());
  117. ASSERT_STREQ(SimpleUIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  118. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  119. ASSERT_EQ(test.property(propertyName).toInt(), 1);
  120. ASSERT_EQ(test.testFieldInt(), 1);
  121. }
  122. TEST_F(SimpleTest, SimpleInt64MessageTest)
  123. {
  124. const char* propertyName = "testFieldInt";
  125. SimpleInt64Message test;
  126. int propertyNumber = SimpleInt64Message::propertyOrdering.at(1); //See simpletest.proto
  127. ASSERT_STREQ(SimpleInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::int64");
  128. ASSERT_EQ(SimpleInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<int64>());
  129. ASSERT_STREQ(SimpleInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  130. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  131. ASSERT_EQ(test.property(propertyName).toInt(), 1);
  132. ASSERT_EQ(test.testFieldInt(), 1);
  133. }
  134. TEST_F(SimpleTest, SimpleSInt64MessageTest)
  135. {
  136. const char* propertyName = "testFieldInt";
  137. SimpleSInt64Message test;
  138. int propertyNumber = SimpleSInt64Message::propertyOrdering.at(1); //See simpletest.proto
  139. ASSERT_STREQ(SimpleSInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sint64");
  140. ASSERT_EQ(SimpleSInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<sint64>());
  141. ASSERT_STREQ(SimpleSInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  142. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  143. ASSERT_EQ(test.property(propertyName).toInt(), 1);
  144. ASSERT_EQ(test.testFieldInt(), 1);
  145. }
  146. TEST_F(SimpleTest, SimpleUInt64MessageTest)
  147. {
  148. const char* propertyName = "testFieldInt";
  149. SimpleUInt64Message test;
  150. int propertyNumber = SimpleUInt64Message::propertyOrdering.at(1); //See simpletest.proto
  151. ASSERT_STREQ(SimpleUInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::uint64");
  152. ASSERT_EQ(SimpleUInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<uint64>());
  153. ASSERT_STREQ(SimpleUInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  154. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  155. ASSERT_EQ(test.property(propertyName).toInt(), 1);
  156. ASSERT_EQ(test.testFieldInt(), 1);
  157. }
  158. TEST_F(SimpleTest, SimpleFixedInt32MessageTest)
  159. {
  160. const char* propertyName = "testFieldFixedInt32";
  161. SimpleFixedInt32Message test;
  162. int propertyNumber = SimpleFixedInt32Message::propertyOrdering.at(1); //See simpletest.proto
  163. ASSERT_EQ(SimpleFixedInt32Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<fint32>());
  164. ASSERT_STREQ(SimpleFixedInt32Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::fint32");
  165. ASSERT_STREQ(SimpleFixedInt32Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  166. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  167. ASSERT_EQ(test.property(propertyName).value<fint32>(), 1);
  168. ASSERT_EQ(test.testFieldFixedInt32(), 1);
  169. }
  170. TEST_F(SimpleTest, SimpleFixedInt64MessageTest)
  171. {
  172. const char* propertyName = "testFieldFixedInt64";
  173. SimpleFixedInt64Message test;
  174. int propertyNumber = SimpleFixedInt64Message::propertyOrdering.at(1); //See simpletest.proto
  175. ASSERT_EQ(SimpleFixedInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<fint64>());
  176. ASSERT_STREQ(SimpleFixedInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::fint64");
  177. ASSERT_STREQ(SimpleFixedInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  178. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  179. ASSERT_EQ(test.property(propertyName).value<fint64>(), 1);
  180. ASSERT_EQ(test.testFieldFixedInt64(), 1);
  181. }
  182. TEST_F(SimpleTest, SimpleSFixedInt32MessageTest)
  183. {
  184. const char* propertyName = "testFieldFixedInt32";
  185. SimpleSFixedInt32Message test;
  186. int propertyNumber = SimpleSFixedInt32Message::propertyOrdering.at(1); //See simpletest.proto
  187. ASSERT_EQ(SimpleSFixedInt32Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<sfint32>());
  188. ASSERT_STREQ(SimpleSFixedInt32Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sfint32");
  189. ASSERT_STREQ(SimpleSFixedInt32Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  190. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  191. ASSERT_EQ(test.property(propertyName).value<fint32>(), 1);
  192. ASSERT_EQ(test.testFieldFixedInt32(), 1);
  193. }
  194. TEST_F(SimpleTest, SimpleSFixedInt64MessageTest)
  195. {
  196. const char* propertyName = "testFieldFixedInt64";
  197. SimpleSFixedInt64Message test;
  198. int propertyNumber = SimpleSFixedInt64Message::propertyOrdering.at(1); //See simpletest.proto
  199. ASSERT_EQ(SimpleSFixedInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<sfint64>());
  200. ASSERT_STREQ(SimpleSFixedInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sfint64");
  201. ASSERT_STREQ(SimpleSFixedInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  202. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  203. ASSERT_EQ(test.property(propertyName).value<fint64>(), 1);
  204. ASSERT_EQ(test.testFieldFixedInt64(), 1);
  205. }
  206. TEST_F(SimpleTest, SimpleStringMessageTest)
  207. {
  208. const char* propertyName = "testFieldString";
  209. SimpleStringMessage test;
  210. int propertyNumber = SimpleStringMessage::propertyOrdering.at(6); //See simpletest.proto
  211. ASSERT_EQ(SimpleStringMessage::staticMetaObject.property(propertyNumber).type(), QMetaType::QString);
  212. ASSERT_STREQ(SimpleStringMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  213. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(QString("test1"))));
  214. ASSERT_STREQ(test.property(propertyName).toString().toStdString().c_str(), "test1");
  215. ASSERT_STREQ(test.testFieldString().toStdString().c_str(), "test1");
  216. }
  217. TEST_F(SimpleTest, SimpleFloatMessageTest)
  218. {
  219. const char* propertyName = "testFieldFloat";
  220. SimpleFloatMessage test;
  221. int propertyNumber = SimpleFloatMessage::propertyOrdering.at(7); //See simpletest.proto
  222. ASSERT_EQ(SimpleFloatMessage::staticMetaObject.property(propertyNumber).type(), QMetaType::Float);
  223. ASSERT_STREQ(SimpleFloatMessage::staticMetaObject.property(propertyNumber).name(), "testFieldFloat");
  224. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<float>(1.55f)));
  225. ASSERT_TRUE(qFuzzyCompare(test.property(propertyName).toFloat(), 1.55f));
  226. ASSERT_TRUE(qFuzzyCompare(test.testFieldFloat(), 1.55f));
  227. }
  228. TEST_F(SimpleTest, SimpleDoubleMessageTest)
  229. {
  230. const char* propertyName = "testFieldDouble";
  231. SimpleDoubleMessage test;
  232. int propertyNumber = SimpleDoubleMessage::propertyOrdering.at(8); //See simpletest.proto
  233. ASSERT_EQ(SimpleDoubleMessage::staticMetaObject.property(propertyNumber).type(), QMetaType::Double);
  234. ASSERT_STREQ(SimpleDoubleMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  235. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<double>(0.55)));
  236. ASSERT_FLOAT_EQ(test.property(propertyName).toDouble(), 0.55);
  237. ASSERT_FLOAT_EQ(test.testFieldDouble(), 0.55);
  238. }
  239. TEST_F(SimpleTest, SimpleLocalEnumsTest)
  240. {
  241. ASSERT_GT(SimpleEnumMessage::staticMetaObject.enumeratorCount(), 0);
  242. QMetaEnum simpleEnum;
  243. for (int i = 0; i < SimpleEnumMessage::staticMetaObject.enumeratorCount(); i++) {
  244. QMetaEnum tmp = SimpleEnumMessage::staticMetaObject.enumerator(i);
  245. if (QString(tmp.name()) == QString("LocalEnum")) {
  246. simpleEnum = tmp;
  247. break;
  248. }
  249. }
  250. ASSERT_TRUE(simpleEnum.isValid());
  251. ASSERT_STREQ(simpleEnum.key(0), "LOCAL_ENUM_VALUE0");
  252. ASSERT_STREQ(simpleEnum.key(1), "LOCAL_ENUM_VALUE1");
  253. ASSERT_STREQ(simpleEnum.key(2), "LOCAL_ENUM_VALUE2");
  254. ASSERT_STREQ(simpleEnum.key(3), "LOCAL_ENUM_VALUE3");
  255. ASSERT_EQ(simpleEnum.value(0), 0);
  256. ASSERT_EQ(simpleEnum.value(1), 1);
  257. ASSERT_EQ(simpleEnum.value(2), 2);
  258. ASSERT_EQ(simpleEnum.value(3), 3);
  259. const char* propertyName = "localEnumList";
  260. SimpleEnumMessage test;
  261. int propertyNumber = SimpleEnumMessage::propertyOrdering.at(2); //See simpletest.proto
  262. ASSERT_STREQ(SimpleEnumMessage::staticMetaObject.property(propertyNumber).typeName(), "LocalEnumList");
  263. ASSERT_EQ(SimpleEnumMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<SimpleEnumMessage::LocalEnumList>());
  264. ASSERT_STREQ(SimpleEnumMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  265. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<SimpleEnumMessage::LocalEnumList>({SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  266. SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  267. SimpleEnumMessage::LOCAL_ENUM_VALUE1,
  268. SimpleEnumMessage::LOCAL_ENUM_VALUE3})));
  269. ASSERT_TRUE(test.property(propertyName).value<SimpleEnumMessage::LocalEnum>() == QVariant::fromValue<SimpleEnumMessage::LocalEnumList>({SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  270. SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  271. SimpleEnumMessage::LOCAL_ENUM_VALUE1,
  272. SimpleEnumMessage::LOCAL_ENUM_VALUE3}));
  273. ASSERT_TRUE(test.localEnumList() == SimpleEnumMessage::LocalEnumList({SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  274. SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  275. SimpleEnumMessage::LOCAL_ENUM_VALUE1,
  276. SimpleEnumMessage::LOCAL_ENUM_VALUE3}));
  277. }
  278. TEST_F(SimpleTest, SimpleExternalEnumMessageTest)
  279. {
  280. const char* propertyName = "externalEnum";
  281. using ExternalGlobalEnums = qtprotobufnamespace1::externaltests::GlobalEnums;
  282. SimpleExternalEnumMessage test;
  283. int propertyNumber = SimpleExternalEnumMessage::propertyOrdering.at(1); //See externalpackagetest.proto
  284. ASSERT_STREQ(SimpleExternalEnumMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobufnamespace1::externaltests::GlobalEnums::ExternalTestEnum");
  285. ASSERT_EQ(SimpleExternalEnumMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<ExternalGlobalEnums::ExternalTestEnum>());
  286. ASSERT_STREQ(SimpleExternalEnumMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  287. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<ExternalGlobalEnums::ExternalTestEnum>(ExternalGlobalEnums::EXTERNAL_TEST_ENUM_VALUE4)));
  288. ASSERT_TRUE(test.property(propertyName).value<ExternalGlobalEnums::ExternalTestEnum>() == QVariant::fromValue<ExternalGlobalEnums::ExternalTestEnum>(ExternalGlobalEnums::EXTERNAL_TEST_ENUM_VALUE4));
  289. ASSERT_TRUE(test.externalEnum() == QVariant::fromValue<ExternalGlobalEnums::ExternalTestEnum>(ExternalGlobalEnums::EXTERNAL_TEST_ENUM_VALUE4));
  290. }
  291. TEST_F(SimpleTest, SimpleEnumsTest)
  292. {
  293. ASSERT_GT(GlobalEnums::staticMetaObject.enumeratorCount(), 0);
  294. QMetaEnum simpleEnum;
  295. for (int i = 0; i < GlobalEnums::staticMetaObject.enumeratorCount(); i++) {
  296. QMetaEnum tmp = GlobalEnums::staticMetaObject.enumerator(i);
  297. if (QString(tmp.name()) == QString("TestEnum")) {
  298. simpleEnum = tmp;
  299. break;
  300. }
  301. }
  302. ASSERT_TRUE(simpleEnum.isValid());
  303. ASSERT_STREQ(simpleEnum.key(0), "TEST_ENUM_VALUE0");
  304. ASSERT_STREQ(simpleEnum.key(1), "TEST_ENUM_VALUE1");
  305. ASSERT_STREQ(simpleEnum.key(2), "TEST_ENUM_VALUE2");
  306. ASSERT_STREQ(simpleEnum.key(3), "TEST_ENUM_VALUE3");
  307. ASSERT_STREQ(simpleEnum.key(4), "TEST_ENUM_VALUE4");
  308. ASSERT_EQ(simpleEnum.value(0), 0);
  309. ASSERT_EQ(simpleEnum.value(1), 1);
  310. ASSERT_EQ(simpleEnum.value(2), 2);
  311. ASSERT_EQ(simpleEnum.value(3), 4);
  312. ASSERT_EQ(simpleEnum.value(4), 3);
  313. }
  314. TEST_F(SimpleTest, SimpleFileEnumsTest)
  315. {
  316. const char* propertyName = "globalEnumList";
  317. SimpleFileEnumMessage test;
  318. int propertyNumber = SimpleFileEnumMessage::propertyOrdering.at(2); //See simpletest.proto
  319. ASSERT_STREQ(SimpleFileEnumMessage::staticMetaObject.property(propertyNumber).typeName(), "GlobalEnums::TestEnumList");
  320. ASSERT_EQ(SimpleFileEnumMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<GlobalEnums::TestEnumList>());
  321. ASSERT_STREQ(SimpleFileEnumMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  322. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<GlobalEnums::TestEnumList>({GlobalEnums::TEST_ENUM_VALUE1,
  323. GlobalEnums::TEST_ENUM_VALUE3,
  324. GlobalEnums::TEST_ENUM_VALUE4,
  325. GlobalEnums::TEST_ENUM_VALUE2,
  326. GlobalEnums::TEST_ENUM_VALUE1})));
  327. ASSERT_TRUE(test.property(propertyName).value<GlobalEnums::TestEnum>() == QVariant::fromValue<GlobalEnums::TestEnumList>({GlobalEnums::TEST_ENUM_VALUE1,
  328. GlobalEnums::TEST_ENUM_VALUE3,
  329. GlobalEnums::TEST_ENUM_VALUE4,
  330. GlobalEnums::TEST_ENUM_VALUE2,
  331. GlobalEnums::TEST_ENUM_VALUE1}));
  332. ASSERT_TRUE(test.globalEnumList() == GlobalEnums::TestEnumList({GlobalEnums::TEST_ENUM_VALUE1,
  333. GlobalEnums::TEST_ENUM_VALUE3,
  334. GlobalEnums::TEST_ENUM_VALUE4,
  335. GlobalEnums::TEST_ENUM_VALUE2,
  336. GlobalEnums::TEST_ENUM_VALUE1}));
  337. }
  338. TEST_F(SimpleTest, ComplexMessageTest)
  339. {
  340. ComplexMessage msg;
  341. }
  342. TEST_F(SimpleTest, SimpleBytesMessageTest)
  343. {
  344. const char* propertyName = "testFieldBytes";
  345. SimpleBytesMessage test;
  346. int propertyNumber = SimpleBytesMessage::propertyOrdering.at(1); //See simpletest.proto
  347. ASSERT_EQ(SimpleBytesMessage::staticMetaObject.property(propertyNumber).type(), QMetaType::QByteArray);
  348. ASSERT_STREQ(SimpleBytesMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  349. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<QByteArray>("\x01\x02\x03\x04\x05")));
  350. ASSERT_TRUE(test.property(propertyName).toByteArray() == QByteArray("\x01\x02\x03\x04\x05"));
  351. ASSERT_TRUE(test.testFieldBytes() == QByteArray("\x01\x02\x03\x04\x05"));
  352. }
  353. TEST_F(SimpleTest, SimpleExternalComplexMessageTest)
  354. {
  355. const char* propertyName = "localList";
  356. qtprotobufnamespace1::externaltests::SimpleExternalMessage test;
  357. int propertyNumber = qtprotobufnamespace1::externaltests::SimpleExternalMessage::propertyOrdering.at(1);
  358. ASSERT_STREQ(qtprotobufnamespace1::externaltests::SimpleExternalMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::int32List");
  359. ASSERT_EQ(qtprotobufnamespace1::externaltests::SimpleExternalMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::int32List>());
  360. ASSERT_STREQ(qtprotobufnamespace1::externaltests::SimpleExternalMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  361. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int32List>({1, 2, 3, 4, 5})));
  362. ASSERT_TRUE(test.property(propertyName).value<int32List>() == int32List({1, 2, 3, 4, 5}));
  363. ASSERT_TRUE(test.localList() == int32List({1, 2, 3, 4, 5}));
  364. }
  365. TEST_F(SimpleTest, RepeatedExternalComplexMessageTest)
  366. {
  367. const char* propertyName = "testExternalComplex";
  368. RepeatedExternalComplexMessage test;
  369. int propertyNumber = RepeatedExternalComplexMessage::propertyOrdering.at(1); //See simpletest.proto
  370. ASSERT_STREQ(RepeatedExternalComplexMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobufnamespace1::externaltests::ExternalComplexMessageList");
  371. ASSERT_EQ(RepeatedExternalComplexMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobufnamespace1::externaltests::ExternalComplexMessageList>());
  372. ASSERT_STREQ(RepeatedExternalComplexMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  373. qtprotobufnamespace1::externaltests::SimpleExternalMessage complexMessage;
  374. complexMessage.setLocalList({1, 2, 3, 4, 5});
  375. qtprotobufnamespace1::externaltests::ExternalComplexMessage externalMessage;
  376. externalMessage.setTestFieldInt(complexMessage);
  377. qtprotobufnamespace1::externaltests::ExternalComplexMessageList complexMessageList;
  378. complexMessageList << externalMessage;
  379. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(complexMessageList)));
  380. ASSERT_TRUE(test.property(propertyName).value<qtprotobufnamespace1::externaltests::ExternalComplexMessageList>() == complexMessageList);
  381. ASSERT_TRUE(test.testExternalComplex() == complexMessageList);
  382. }
  383. TEST_F(SimpleTest, RepeatedStringMessageTest)
  384. {
  385. const char* propertyName = "testRepeatedString";
  386. RepeatedStringMessage test;
  387. int propertyNumber = RepeatedStringMessage::propertyOrdering.at(1); //See simpletest.proto
  388. ASSERT_STREQ(RepeatedStringMessage::staticMetaObject.property(propertyNumber).typeName(), "QStringList");
  389. ASSERT_EQ(RepeatedStringMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<QStringList>());
  390. ASSERT_STREQ(RepeatedStringMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  391. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<QStringList>({"Text", "tryam"})));
  392. ASSERT_TRUE(test.property(propertyName).value<QStringList>() == QStringList({"Text", "tryam"}));
  393. ASSERT_TRUE(test.testRepeatedString() == QStringList({"Text", "tryam"}));
  394. }
  395. TEST_F(SimpleTest, RepeatedIntMessageTest)
  396. {
  397. const char* propertyName = "testRepeatedInt";
  398. RepeatedIntMessage test;
  399. int propertyNumber = RepeatedIntMessage::propertyOrdering.at(1); //See simpletest.proto
  400. ASSERT_STREQ(RepeatedIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::int32List");
  401. ASSERT_EQ(RepeatedIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::int32List>());
  402. ASSERT_STREQ(RepeatedIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  403. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int32List>({1, 2, 3, 4, 5})));
  404. ASSERT_TRUE(test.property(propertyName).value<int32List>() == int32List({1, 2, 3, 4, 5}));
  405. ASSERT_TRUE(test.testRepeatedInt() == int32List({1, 2, 3, 4, 5}));
  406. }
  407. TEST_F(SimpleTest, RepeatedDoubleMessageTest)
  408. {
  409. const char* propertyName = "testRepeatedDouble";
  410. RepeatedDoubleMessage test;
  411. int propertyNumber = RepeatedDoubleMessage::propertyOrdering.at(1); //See simpletest.proto
  412. ASSERT_STREQ(RepeatedDoubleMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::DoubleList");
  413. ASSERT_EQ(RepeatedDoubleMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::DoubleList>());
  414. ASSERT_STREQ(RepeatedDoubleMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  415. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<qtprotobuf::DoubleList>({1.0, 2.3, 3, 4.7, 5.9})));
  416. ASSERT_TRUE(test.property(propertyName).value<qtprotobuf::DoubleList>() == qtprotobuf::DoubleList({1.0, 2.3, 3, 4.7, 5.9}));
  417. ASSERT_TRUE(test.testRepeatedDouble() == qtprotobuf::DoubleList({1.0, 2.3, 3, 4.7, 5.9}));
  418. }
  419. TEST_F(SimpleTest, RepeatedFloatMessageTest)
  420. {
  421. const char* propertyName = "testRepeatedFloat";
  422. RepeatedFloatMessage test;
  423. int propertyNumber = RepeatedFloatMessage::propertyOrdering.at(1); //See simpletest.proto
  424. ASSERT_STREQ(RepeatedFloatMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::FloatList");
  425. ASSERT_EQ(RepeatedFloatMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::FloatList>());
  426. ASSERT_STREQ(RepeatedFloatMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  427. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<qtprotobuf::FloatList>({1.0f, 2.3f, 3, 4.7f, 5.9f})));
  428. ASSERT_TRUE(test.property(propertyName).value<qtprotobuf::FloatList>() == qtprotobuf::FloatList({1.0f, 2.3f, 3, 4.7f, 5.9f}));
  429. ASSERT_TRUE(test.testRepeatedFloat() == qtprotobuf::FloatList({1.0f, 2.3f, 3, 4.7f, 5.9f}));
  430. }
  431. TEST_F(SimpleTest, RepeatedBytesMessageTest)
  432. {
  433. const char* propertyName = "testRepeatedBytes";
  434. RepeatedBytesMessage test;
  435. int propertyNumber = RepeatedBytesMessage::propertyOrdering.at(1); //See simpletest.proto
  436. ASSERT_STREQ(RepeatedBytesMessage::staticMetaObject.property(propertyNumber).typeName(), "QByteArrayList");
  437. ASSERT_EQ(RepeatedBytesMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<QByteArrayList>());
  438. ASSERT_STREQ(RepeatedBytesMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  439. QByteArrayList bList;
  440. bList << "\x01\x02\x03\x04\x05";
  441. bList << "\x01\x05\x03\x04\x03";
  442. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<QByteArrayList>(bList)));
  443. ASSERT_TRUE(test.property(propertyName).value<QByteArrayList>() == bList);
  444. ASSERT_TRUE(test.testRepeatedBytes() == bList);
  445. }
  446. TEST_F(SimpleTest, RepeatedSIntMessageTest)
  447. {
  448. const char* propertyName = "testRepeatedInt";
  449. RepeatedSIntMessage test;
  450. int propertyNumber = RepeatedSIntMessage::propertyOrdering.at(1); //See simpletest.proto
  451. ASSERT_STREQ(RepeatedSIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sint32List");
  452. ASSERT_EQ(RepeatedSIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::sint32List>());
  453. ASSERT_STREQ(RepeatedSIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  454. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sint32List>({1, 2, 3, 4, 5})));
  455. ASSERT_TRUE(test.property(propertyName).value<sint32List>() == sint32List({1, 2, 3, 4, 5}));
  456. ASSERT_TRUE(test.testRepeatedInt() == sint32List({1, 2, 3, 4, 5}));
  457. }
  458. TEST_F(SimpleTest, RepeatedUIntMessageTest)
  459. {
  460. const char* propertyName = "testRepeatedInt";
  461. RepeatedUIntMessage test;
  462. int propertyNumber = RepeatedUIntMessage::propertyOrdering.at(1); //See simpletest.proto
  463. ASSERT_STREQ(RepeatedUIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::uint32List");
  464. ASSERT_EQ(RepeatedUIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::uint32List>());
  465. ASSERT_STREQ(RepeatedUIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  466. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<uint32List>({1, 2, 3, 4, 5})));
  467. ASSERT_TRUE(test.property(propertyName).value<uint32List>() == uint32List({1, 2, 3, 4, 5}));
  468. ASSERT_TRUE(test.testRepeatedInt() == uint32List({1, 2, 3, 4, 5}));
  469. }
  470. TEST_F(SimpleTest, RepeatedInt64MessageTest)
  471. {
  472. const char* propertyName = "testRepeatedInt";
  473. RepeatedInt64Message test;
  474. int propertyNumber = RepeatedInt64Message::propertyOrdering.at(1); //See simpletest.proto
  475. ASSERT_STREQ(RepeatedInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::int64List");
  476. ASSERT_EQ(RepeatedInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::int64List>());
  477. ASSERT_STREQ(RepeatedInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  478. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int64List>({1, 2, 3, 4, 5})));
  479. ASSERT_TRUE(test.property(propertyName).value<int64List>() == int64List({1, 2, 3, 4, 5}));
  480. ASSERT_TRUE(test.testRepeatedInt() == int64List({1, 2, 3, 4, 5}));
  481. }
  482. TEST_F(SimpleTest, RepeatedSInt64MessageTest)
  483. {
  484. const char* propertyName = "testRepeatedInt";
  485. RepeatedSInt64Message test;
  486. int propertyNumber = RepeatedSInt64Message::propertyOrdering.at(1); //See simpletest.proto
  487. ASSERT_STREQ(RepeatedSInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sint64List");
  488. ASSERT_EQ(RepeatedSInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::sint64List>());
  489. ASSERT_STREQ(RepeatedSInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  490. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sint64List>({1, 2, 3, 4, 5})));
  491. ASSERT_TRUE(test.property(propertyName).value<sint64List>() == sint64List({1, 2, 3, 4, 5}));
  492. ASSERT_TRUE(test.testRepeatedInt() == sint64List({1, 2, 3, 4, 5}));
  493. }
  494. TEST_F(SimpleTest, RepeatedUInt64MessageTest)
  495. {
  496. const char* propertyName = "testRepeatedInt";
  497. RepeatedUInt64Message test;
  498. int propertyNumber = RepeatedUInt64Message::propertyOrdering.at(1); //See simpletest.proto
  499. ASSERT_STREQ(RepeatedUInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::uint64List");
  500. ASSERT_EQ(RepeatedUInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::uint64List>());
  501. ASSERT_STREQ(RepeatedUInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  502. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<uint64List>({1, 2, 3, 4, 5})));
  503. ASSERT_TRUE(test.property(propertyName).value<uint64List>() == uint64List({1, 2, 3, 4, 5}));
  504. ASSERT_TRUE(test.testRepeatedInt() == uint64List({1, 2, 3, 4, 5}));
  505. }
  506. TEST_F(SimpleTest, RepeatedFixedIntMessageTest)
  507. {
  508. const char* propertyName = "testRepeatedInt";
  509. RepeatedFixedIntMessage test;
  510. int propertyNumber = RepeatedFixedIntMessage::propertyOrdering.at(1); //See simpletest.proto
  511. ASSERT_STREQ(RepeatedFixedIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::fint32List");
  512. ASSERT_EQ(RepeatedFixedIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::fint32List>());
  513. ASSERT_STREQ(RepeatedFixedIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  514. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<fint32List>({1, 2, 3, 4, 5})));
  515. ASSERT_TRUE(test.property(propertyName).value<fint32List>() == fint32List({1, 2, 3, 4, 5}));
  516. ASSERT_TRUE(test.testRepeatedInt() == fint32List({1, 2, 3, 4, 5}));
  517. }
  518. TEST_F(SimpleTest, RepeatedFixedInt64MessageTest)
  519. {
  520. const char* propertyName = "testRepeatedInt";
  521. RepeatedFixedInt64Message test;
  522. int propertyNumber = RepeatedFixedInt64Message::propertyOrdering.at(1); //See simpletest.proto
  523. ASSERT_STREQ(RepeatedFixedInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::fint64List");
  524. ASSERT_EQ(RepeatedFixedInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::fint64List>());
  525. ASSERT_STREQ(RepeatedFixedInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  526. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<fint64List>({1, 2, 3, 4, 5})));
  527. ASSERT_TRUE(test.property(propertyName).value<fint64List>() == fint64List({1, 2, 3, 4, 5}));
  528. ASSERT_TRUE(test.testRepeatedInt() == fint64List({1, 2, 3, 4, 5}));
  529. }
  530. TEST_F(SimpleTest, RepeatedSFixedIntMessageTest)
  531. {
  532. const char* propertyName = "testRepeatedInt";
  533. RepeatedSFixedIntMessage test;
  534. int propertyNumber = RepeatedSFixedIntMessage::propertyOrdering.at(1); //See simpletest.proto
  535. ASSERT_STREQ(RepeatedSFixedIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sfint32List");
  536. ASSERT_EQ(RepeatedSFixedIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::sfint32List>());
  537. ASSERT_STREQ(RepeatedSFixedIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  538. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sfint32List>({1, 2, 3, 4, 5})));
  539. ASSERT_TRUE(test.property(propertyName).value<sfint32List>() == sfint32List({1, 2, 3, 4, 5}));
  540. ASSERT_TRUE(test.testRepeatedInt() == sfint32List({1, 2, 3, 4, 5}));
  541. }
  542. TEST_F(SimpleTest, RepeatedSFixedInt64MessageTest)
  543. {
  544. const char* propertyName = "testRepeatedInt";
  545. RepeatedSFixedInt64Message test;
  546. int propertyNumber = RepeatedSFixedInt64Message::propertyOrdering.at(1); //See simpletest.proto
  547. ASSERT_STREQ(RepeatedSFixedInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sfint64List");
  548. ASSERT_EQ(RepeatedSFixedInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::sfint64List>());
  549. ASSERT_STREQ(RepeatedSFixedInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  550. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sfint64List>({1, 2, 3, 4, 5})));
  551. ASSERT_TRUE(test.property(propertyName).value<sfint64List>() == sfint64List({1, 2, 3, 4, 5}));
  552. ASSERT_TRUE(test.testRepeatedInt() == sfint64List({1, 2, 3, 4, 5}));
  553. }
  554. TEST_F(SimpleTest, StepChildEnumMessageTest)
  555. {
  556. const char* propertyName = "localStepChildEnum";
  557. StepChildEnumMessage test;
  558. int propertyNumber = StepChildEnumMessage::propertyOrdering.at(1); //See simpletest.proto
  559. ASSERT_STREQ(StepChildEnumMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnum");
  560. ASSERT_EQ(StepChildEnumMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<SimpleEnumMessage::LocalEnum>());
  561. ASSERT_STREQ(StepChildEnumMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  562. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnum>(SimpleEnumMessage::LOCAL_ENUM_VALUE2)));
  563. ASSERT_TRUE(test.property(propertyName).value<SimpleEnumMessage::LocalEnum>() == SimpleEnumMessage::LOCAL_ENUM_VALUE2);
  564. ASSERT_TRUE(test.localStepChildEnum() == SimpleEnumMessage::LOCAL_ENUM_VALUE2);
  565. }
  566. TEST_F(SimpleTest, StepChildEnumListMessageTest)
  567. {
  568. const char* propertyName = "localStepChildList";
  569. StepChildEnumMessage test;
  570. int propertyNumber = StepChildEnumMessage::propertyOrdering.at(2); //See simpletest.proto
  571. ASSERT_STREQ(StepChildEnumMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnumList");
  572. ASSERT_EQ(StepChildEnumMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnumList>());
  573. ASSERT_STREQ(StepChildEnumMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  574. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnumList>({SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  575. SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  576. SimpleEnumMessage::LOCAL_ENUM_VALUE1,
  577. SimpleEnumMessage::LOCAL_ENUM_VALUE3})));
  578. ASSERT_TRUE(test.property(propertyName).value<SimpleEnumMessage::LocalEnum>() == QVariant::fromValue<SimpleEnumMessage::LocalEnumList>({SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  579. SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  580. SimpleEnumMessage::LOCAL_ENUM_VALUE1,
  581. SimpleEnumMessage::LOCAL_ENUM_VALUE3}));
  582. ASSERT_TRUE(test.localStepChildList() == SimpleEnumMessage::LocalEnumList({SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  583. SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  584. SimpleEnumMessage::LOCAL_ENUM_VALUE1,
  585. SimpleEnumMessage::LOCAL_ENUM_VALUE3}));
  586. }