simpletest.cpp 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  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 "simpleenumlistmessage.h"
  43. #include "simplefileenummessage.h"
  44. #include "simpleexternalenummessage.h"
  45. #include "externalcomplexmessage.h"
  46. #include "complexmessage.h"
  47. #include "simplebytesmessage.h"
  48. #include "repeatedintmessage.h"
  49. #include "repeatedbytesmessage.h"
  50. #include "repeateddoublemessage.h"
  51. #include "repeatedcomplexmessage.h"
  52. #include "repeatedfloatmessage.h"
  53. #include "repeatedsintmessage.h"
  54. #include "repeatedstringmessage.h"
  55. #include "repeateduintmessage.h"
  56. #include "repeatedint64message.h"
  57. #include "repeatedsint64message.h"
  58. #include "repeateduint64message.h"
  59. #include "repeatedfixedintmessage.h"
  60. #include "repeatedsfixedintmessage.h"
  61. #include "repeatedfixedint64message.h"
  62. #include "repeatedsfixedint64message.h"
  63. #include "repeatedexternalcomplexmessage.h"
  64. #include "globalenums.h"
  65. #include "qtprotobuf.h"
  66. #include <QVariantList>
  67. #include <QMetaProperty>
  68. using namespace qtprotobufnamespace::tests;
  69. using namespace qtprotobuf::tests;
  70. using namespace qtprotobuf;
  71. SimpleTest::SimpleTest()
  72. {
  73. QtProtobuf::init();
  74. }
  75. TEST_F(SimpleTest, SimpleBoolMessageTest)
  76. {
  77. const char* propertyName = "testFieldBool";
  78. SimpleBoolMessage test;
  79. int propertyNumber = SimpleBoolMessage::propertyOrdering.at(1); //See simpletest.proto
  80. ASSERT_STREQ(SimpleBoolMessage::staticMetaObject.property(propertyNumber).typeName(), "bool");
  81. ASSERT_EQ(SimpleBoolMessage::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<bool>());
  82. ASSERT_STREQ(SimpleBoolMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  83. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(true)));
  84. ASSERT_EQ(test.property(propertyName).toBool(), true);
  85. ASSERT_EQ(test.testFieldBool(), true);
  86. }
  87. TEST_F(SimpleTest, SimpleIntMessageTest)
  88. {
  89. const char* propertyName = "testFieldInt";
  90. SimpleIntMessage test;
  91. int propertyNumber = SimpleIntMessage::propertyOrdering.at(1); //See simpletest.proto
  92. ASSERT_STREQ(SimpleIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::int32");
  93. ASSERT_EQ(SimpleIntMessage::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<int32>());
  94. ASSERT_STREQ(SimpleIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  95. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  96. ASSERT_EQ(test.property(propertyName).toInt(), 1);
  97. ASSERT_EQ(test.testFieldInt(), 1);
  98. }
  99. TEST_F(SimpleTest, SimpleSIntMessageTest)
  100. {
  101. const char* propertyName = "testFieldInt";
  102. SimpleSIntMessage test;
  103. int propertyNumber = SimpleSIntMessage::propertyOrdering.at(1); //See simpletest.proto
  104. ASSERT_STREQ(SimpleSIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sint32");
  105. ASSERT_EQ(SimpleSIntMessage::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<sint32>());
  106. ASSERT_STREQ(SimpleSIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  107. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  108. ASSERT_EQ(test.property(propertyName).toInt(), 1);
  109. ASSERT_EQ(test.testFieldInt(), 1);
  110. }
  111. TEST_F(SimpleTest, SimpleUIntMessageTest)
  112. {
  113. const char* propertyName = "testFieldInt";
  114. SimpleUIntMessage test;
  115. int propertyNumber = SimpleUIntMessage::propertyOrdering.at(1); //See simpletest.proto
  116. ASSERT_STREQ(SimpleUIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::uint32");
  117. ASSERT_EQ(SimpleUIntMessage::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<uint32>());
  118. ASSERT_STREQ(SimpleUIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  119. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  120. ASSERT_EQ(test.property(propertyName).toInt(), 1);
  121. ASSERT_EQ(test.testFieldInt(), 1);
  122. }
  123. TEST_F(SimpleTest, SimpleInt64MessageTest)
  124. {
  125. const char* propertyName = "testFieldInt";
  126. SimpleInt64Message test;
  127. int propertyNumber = SimpleInt64Message::propertyOrdering.at(1); //See simpletest.proto
  128. ASSERT_STREQ(SimpleInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::int64");
  129. ASSERT_EQ(SimpleInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<int64>());
  130. ASSERT_STREQ(SimpleInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  131. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  132. ASSERT_EQ(test.property(propertyName).toInt(), 1);
  133. ASSERT_EQ(test.testFieldInt(), 1);
  134. }
  135. TEST_F(SimpleTest, SimpleSInt64MessageTest)
  136. {
  137. const char* propertyName = "testFieldInt";
  138. SimpleSInt64Message test;
  139. int propertyNumber = SimpleSInt64Message::propertyOrdering.at(1); //See simpletest.proto
  140. ASSERT_STREQ(SimpleSInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sint64");
  141. ASSERT_EQ(SimpleSInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<sint64>());
  142. ASSERT_STREQ(SimpleSInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  143. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  144. ASSERT_EQ(test.property(propertyName).toInt(), 1);
  145. ASSERT_EQ(test.testFieldInt(), 1);
  146. }
  147. TEST_F(SimpleTest, SimpleUInt64MessageTest)
  148. {
  149. const char* propertyName = "testFieldInt";
  150. SimpleUInt64Message test;
  151. int propertyNumber = SimpleUInt64Message::propertyOrdering.at(1); //See simpletest.proto
  152. ASSERT_STREQ(SimpleUInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::uint64");
  153. ASSERT_EQ(SimpleUInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<uint64>());
  154. ASSERT_STREQ(SimpleUInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  155. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  156. ASSERT_EQ(test.property(propertyName).toInt(), 1);
  157. ASSERT_EQ(test.testFieldInt(), 1);
  158. }
  159. TEST_F(SimpleTest, SimpleFixedInt32MessageTest)
  160. {
  161. const char* propertyName = "testFieldFixedInt32";
  162. SimpleFixedInt32Message test;
  163. int propertyNumber = SimpleFixedInt32Message::propertyOrdering.at(1); //See simpletest.proto
  164. ASSERT_EQ(SimpleFixedInt32Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<fint32>());
  165. ASSERT_STREQ(SimpleFixedInt32Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::fint32");
  166. ASSERT_STREQ(SimpleFixedInt32Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  167. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  168. ASSERT_EQ(test.property(propertyName).value<fint32>(), 1);
  169. ASSERT_EQ(test.testFieldFixedInt32(), 1);
  170. }
  171. TEST_F(SimpleTest, SimpleFixedInt64MessageTest)
  172. {
  173. const char* propertyName = "testFieldFixedInt64";
  174. SimpleFixedInt64Message test;
  175. int propertyNumber = SimpleFixedInt64Message::propertyOrdering.at(1); //See simpletest.proto
  176. ASSERT_EQ(SimpleFixedInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<fint64>());
  177. ASSERT_STREQ(SimpleFixedInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::fint64");
  178. ASSERT_STREQ(SimpleFixedInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  179. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  180. ASSERT_EQ(test.property(propertyName).value<fint64>(), 1);
  181. ASSERT_EQ(test.testFieldFixedInt64(), 1);
  182. }
  183. TEST_F(SimpleTest, SimpleSFixedInt32MessageTest)
  184. {
  185. const char* propertyName = "testFieldFixedInt32";
  186. SimpleSFixedInt32Message test;
  187. int propertyNumber = SimpleSFixedInt32Message::propertyOrdering.at(1); //See simpletest.proto
  188. ASSERT_EQ(SimpleSFixedInt32Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<sfint32>());
  189. ASSERT_STREQ(SimpleSFixedInt32Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sfint32");
  190. ASSERT_STREQ(SimpleSFixedInt32Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  191. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  192. ASSERT_EQ(test.property(propertyName).value<fint32>(), 1);
  193. ASSERT_EQ(test.testFieldFixedInt32(), 1);
  194. }
  195. TEST_F(SimpleTest, SimpleSFixedInt64MessageTest)
  196. {
  197. const char* propertyName = "testFieldFixedInt64";
  198. SimpleSFixedInt64Message test;
  199. int propertyNumber = SimpleSFixedInt64Message::propertyOrdering.at(1); //See simpletest.proto
  200. ASSERT_EQ(SimpleSFixedInt64Message::staticMetaObject.property(propertyNumber).type(), qMetaTypeId<sfint64>());
  201. ASSERT_STREQ(SimpleSFixedInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sfint64");
  202. ASSERT_STREQ(SimpleSFixedInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  203. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(1)));
  204. ASSERT_EQ(test.property(propertyName).value<fint64>(), 1);
  205. ASSERT_EQ(test.testFieldFixedInt64(), 1);
  206. }
  207. TEST_F(SimpleTest, SimpleStringMessageTest)
  208. {
  209. const char* propertyName = "testFieldString";
  210. SimpleStringMessage test;
  211. int propertyNumber = SimpleStringMessage::propertyOrdering.at(6); //See simpletest.proto
  212. ASSERT_EQ(SimpleStringMessage::staticMetaObject.property(propertyNumber).type(), QMetaType::QString);
  213. ASSERT_STREQ(SimpleStringMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  214. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(QString("test1"))));
  215. ASSERT_STREQ(test.property(propertyName).toString().toStdString().c_str(), "test1");
  216. ASSERT_STREQ(test.testFieldString().toStdString().c_str(), "test1");
  217. }
  218. TEST_F(SimpleTest, SimpleFloatMessageTest)
  219. {
  220. const char* propertyName = "testFieldFloat";
  221. SimpleFloatMessage test;
  222. int propertyNumber = SimpleFloatMessage::propertyOrdering.at(7); //See simpletest.proto
  223. ASSERT_EQ(SimpleFloatMessage::staticMetaObject.property(propertyNumber).type(), QMetaType::Float);
  224. ASSERT_STREQ(SimpleFloatMessage::staticMetaObject.property(propertyNumber).name(), "testFieldFloat");
  225. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<float>(1.55f)));
  226. ASSERT_TRUE(qFuzzyCompare(test.property(propertyName).toFloat(), 1.55f));
  227. ASSERT_TRUE(qFuzzyCompare(test.testFieldFloat(), 1.55f));
  228. }
  229. TEST_F(SimpleTest, SimpleDoubleMessageTest)
  230. {
  231. const char* propertyName = "testFieldDouble";
  232. SimpleDoubleMessage test;
  233. int propertyNumber = SimpleDoubleMessage::propertyOrdering.at(8); //See simpletest.proto
  234. ASSERT_EQ(SimpleDoubleMessage::staticMetaObject.property(propertyNumber).type(), QMetaType::Double);
  235. ASSERT_STREQ(SimpleDoubleMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  236. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<double>(0.55)));
  237. ASSERT_FLOAT_EQ(test.property(propertyName).toDouble(), 0.55);
  238. ASSERT_FLOAT_EQ(test.testFieldDouble(), 0.55);
  239. }
  240. TEST_F(SimpleTest, SimpleLocalEnumTest)
  241. {
  242. ASSERT_GT(SimpleEnumMessage::staticMetaObject.enumeratorCount(), 0);
  243. QMetaEnum simpleEnum;
  244. for (int i = 0; i < SimpleEnumMessage::staticMetaObject.enumeratorCount(); i++) {
  245. QMetaEnum tmp = SimpleEnumMessage::staticMetaObject.enumerator(i);
  246. if (QString(tmp.name()) == QString("LocalEnum")) {
  247. simpleEnum = tmp;
  248. break;
  249. }
  250. }
  251. ASSERT_TRUE(simpleEnum.isValid());
  252. ASSERT_STREQ(simpleEnum.key(0), "LOCAL_ENUM_VALUE0");
  253. ASSERT_STREQ(simpleEnum.key(1), "LOCAL_ENUM_VALUE1");
  254. ASSERT_STREQ(simpleEnum.key(2), "LOCAL_ENUM_VALUE2");
  255. ASSERT_STREQ(simpleEnum.key(3), "LOCAL_ENUM_VALUE3");
  256. ASSERT_EQ(simpleEnum.value(0), 0);
  257. ASSERT_EQ(simpleEnum.value(1), 1);
  258. ASSERT_EQ(simpleEnum.value(2), 2);
  259. ASSERT_EQ(simpleEnum.value(3), 3);
  260. }
  261. TEST_F(SimpleTest, SimpleLocalEnumListTest)
  262. {
  263. ASSERT_GT(SimpleEnumListMessage::staticMetaObject.enumeratorCount(), 0);
  264. const char* propertyName = "localEnumList";
  265. SimpleEnumListMessage test;
  266. int propertyNumber = SimpleEnumListMessage::propertyOrdering.at(2); //See simpletest.proto
  267. ASSERT_STREQ(SimpleEnumListMessage::staticMetaObject.property(propertyNumber).typeName(), "LocalEnumList");
  268. ASSERT_EQ(SimpleEnumListMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<SimpleEnumListMessage::LocalEnumList>());
  269. ASSERT_STREQ(SimpleEnumListMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  270. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<SimpleEnumListMessage::LocalEnumList>({SimpleEnumListMessage::LOCAL_ENUM_VALUE2,
  271. SimpleEnumListMessage::LOCAL_ENUM_VALUE2,
  272. SimpleEnumListMessage::LOCAL_ENUM_VALUE1,
  273. SimpleEnumListMessage::LOCAL_ENUM_VALUE3})));
  274. ASSERT_TRUE(test.property(propertyName).value<SimpleEnumListMessage::LocalEnum>() == QVariant::fromValue<SimpleEnumListMessage::LocalEnumList>({SimpleEnumListMessage::LOCAL_ENUM_VALUE2,
  275. SimpleEnumListMessage::LOCAL_ENUM_VALUE2,
  276. SimpleEnumListMessage::LOCAL_ENUM_VALUE1,
  277. SimpleEnumListMessage::LOCAL_ENUM_VALUE3}));
  278. ASSERT_TRUE(test.localEnumList() == SimpleEnumListMessage::LocalEnumList({SimpleEnumListMessage::LOCAL_ENUM_VALUE2,
  279. SimpleEnumListMessage::LOCAL_ENUM_VALUE2,
  280. SimpleEnumListMessage::LOCAL_ENUM_VALUE1,
  281. SimpleEnumListMessage::LOCAL_ENUM_VALUE3}));
  282. }
  283. TEST_F(SimpleTest, SimpleExternalEnumMessageTest)
  284. {
  285. const char* propertyName = "externalEnum";
  286. using ExternalGlobalEnums = qtprotobufnamespace1::externaltests::GlobalEnums;
  287. SimpleExternalEnumMessage test;
  288. int propertyNumber = SimpleExternalEnumMessage::propertyOrdering.at(1); //See externalpackagetest.proto
  289. ASSERT_STREQ(SimpleExternalEnumMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobufnamespace1::externaltests::GlobalEnums::ExternalTestEnum");
  290. ASSERT_EQ(SimpleExternalEnumMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<ExternalGlobalEnums::ExternalTestEnum>());
  291. ASSERT_STREQ(SimpleExternalEnumMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  292. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<ExternalGlobalEnums::ExternalTestEnum>(ExternalGlobalEnums::EXTERNAL_TEST_ENUM_VALUE4)));
  293. ASSERT_TRUE(test.property(propertyName).value<ExternalGlobalEnums::ExternalTestEnum>() == QVariant::fromValue<ExternalGlobalEnums::ExternalTestEnum>(ExternalGlobalEnums::EXTERNAL_TEST_ENUM_VALUE4));
  294. ASSERT_TRUE(test.externalEnum() == QVariant::fromValue<ExternalGlobalEnums::ExternalTestEnum>(ExternalGlobalEnums::EXTERNAL_TEST_ENUM_VALUE4));
  295. }
  296. TEST_F(SimpleTest, SimpleEnumsTest)
  297. {
  298. ASSERT_GT(GlobalEnums::staticMetaObject.enumeratorCount(), 0);
  299. QMetaEnum simpleEnum;
  300. for (int i = 0; i < GlobalEnums::staticMetaObject.enumeratorCount(); i++) {
  301. QMetaEnum tmp = GlobalEnums::staticMetaObject.enumerator(i);
  302. if (QString(tmp.name()) == QString("TestEnum")) {
  303. simpleEnum = tmp;
  304. break;
  305. }
  306. }
  307. ASSERT_TRUE(simpleEnum.isValid());
  308. ASSERT_STREQ(simpleEnum.key(0), "TEST_ENUM_VALUE0");
  309. ASSERT_STREQ(simpleEnum.key(1), "TEST_ENUM_VALUE1");
  310. ASSERT_STREQ(simpleEnum.key(2), "TEST_ENUM_VALUE2");
  311. ASSERT_STREQ(simpleEnum.key(3), "TEST_ENUM_VALUE3");
  312. ASSERT_STREQ(simpleEnum.key(4), "TEST_ENUM_VALUE4");
  313. ASSERT_EQ(simpleEnum.value(0), 0);
  314. ASSERT_EQ(simpleEnum.value(1), 1);
  315. ASSERT_EQ(simpleEnum.value(2), 2);
  316. ASSERT_EQ(simpleEnum.value(3), 4);
  317. ASSERT_EQ(simpleEnum.value(4), 3);
  318. }
  319. TEST_F(SimpleTest, SimpleFileEnumsTest)
  320. {
  321. const char* propertyName = "globalEnumList";
  322. SimpleFileEnumMessage test;
  323. int propertyNumber = SimpleFileEnumMessage::propertyOrdering.at(2); //See simpletest.proto
  324. ASSERT_STREQ(SimpleFileEnumMessage::staticMetaObject.property(propertyNumber).typeName(), "GlobalEnums::TestEnumList");
  325. ASSERT_EQ(SimpleFileEnumMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<GlobalEnums::TestEnumList>());
  326. ASSERT_STREQ(SimpleFileEnumMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  327. ASSERT_TRUE(test.setProperty(propertyName, 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.property(propertyName).value<GlobalEnums::TestEnum>() == QVariant::fromValue<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. ASSERT_TRUE(test.globalEnumList() == GlobalEnums::TestEnumList({GlobalEnums::TEST_ENUM_VALUE1,
  338. GlobalEnums::TEST_ENUM_VALUE3,
  339. GlobalEnums::TEST_ENUM_VALUE4,
  340. GlobalEnums::TEST_ENUM_VALUE2,
  341. GlobalEnums::TEST_ENUM_VALUE1}));
  342. }
  343. TEST_F(SimpleTest, ComplexMessageTest)
  344. {
  345. ComplexMessage msg;
  346. }
  347. TEST_F(SimpleTest, SimpleBytesMessageTest)
  348. {
  349. const char* propertyName = "testFieldBytes";
  350. SimpleBytesMessage test;
  351. int propertyNumber = SimpleBytesMessage::propertyOrdering.at(1); //See simpletest.proto
  352. ASSERT_EQ(SimpleBytesMessage::staticMetaObject.property(propertyNumber).type(), QMetaType::QByteArray);
  353. ASSERT_STREQ(SimpleBytesMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  354. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<QByteArray>("\x01\x02\x03\x04\x05")));
  355. ASSERT_TRUE(test.property(propertyName).toByteArray() == QByteArray("\x01\x02\x03\x04\x05"));
  356. ASSERT_TRUE(test.testFieldBytes() == QByteArray("\x01\x02\x03\x04\x05"));
  357. }
  358. TEST_F(SimpleTest, SimpleExternalComplexMessageTest)
  359. {
  360. const char* propertyName = "localList";
  361. qtprotobufnamespace1::externaltests::SimpleExternalMessage test;
  362. int propertyNumber = qtprotobufnamespace1::externaltests::SimpleExternalMessage::propertyOrdering.at(1);
  363. ASSERT_STREQ(qtprotobufnamespace1::externaltests::SimpleExternalMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::int32List");
  364. ASSERT_EQ(qtprotobufnamespace1::externaltests::SimpleExternalMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::int32List>());
  365. ASSERT_STREQ(qtprotobufnamespace1::externaltests::SimpleExternalMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  366. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int32List>({1, 2, 3, 4, 5})));
  367. ASSERT_TRUE(test.property(propertyName).value<int32List>() == int32List({1, 2, 3, 4, 5}));
  368. ASSERT_TRUE(test.localList() == int32List({1, 2, 3, 4, 5}));
  369. }
  370. TEST_F(SimpleTest, RepeatedExternalComplexMessageTest)
  371. {
  372. const char* propertyName = "testExternalComplex";
  373. RepeatedExternalComplexMessage test;
  374. int propertyNumber = RepeatedExternalComplexMessage::propertyOrdering.at(1); //See simpletest.proto
  375. ASSERT_STREQ(RepeatedExternalComplexMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobufnamespace1::externaltests::ExternalComplexMessageList");
  376. ASSERT_EQ(RepeatedExternalComplexMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobufnamespace1::externaltests::ExternalComplexMessageList>());
  377. ASSERT_STREQ(RepeatedExternalComplexMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  378. qtprotobufnamespace1::externaltests::SimpleExternalMessage complexMessage;
  379. complexMessage.setLocalList({1, 2, 3, 4, 5});
  380. qtprotobufnamespace1::externaltests::ExternalComplexMessage externalMessage;
  381. externalMessage.setTestFieldInt(complexMessage);
  382. qtprotobufnamespace1::externaltests::ExternalComplexMessageList complexMessageList;
  383. complexMessageList << externalMessage;
  384. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(complexMessageList)));
  385. ASSERT_TRUE(test.property(propertyName).value<qtprotobufnamespace1::externaltests::ExternalComplexMessageList>() == complexMessageList);
  386. ASSERT_TRUE(test.testExternalComplex() == complexMessageList);
  387. }
  388. TEST_F(SimpleTest, RepeatedStringMessageTest)
  389. {
  390. const char* propertyName = "testRepeatedString";
  391. RepeatedStringMessage test;
  392. int propertyNumber = RepeatedStringMessage::propertyOrdering.at(1); //See simpletest.proto
  393. ASSERT_STREQ(RepeatedStringMessage::staticMetaObject.property(propertyNumber).typeName(), "QStringList");
  394. ASSERT_EQ(RepeatedStringMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<QStringList>());
  395. ASSERT_STREQ(RepeatedStringMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  396. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<QStringList>({"Text", "tryam"})));
  397. ASSERT_TRUE(test.property(propertyName).value<QStringList>() == QStringList({"Text", "tryam"}));
  398. ASSERT_TRUE(test.testRepeatedString() == QStringList({"Text", "tryam"}));
  399. }
  400. TEST_F(SimpleTest, RepeatedIntMessageTest)
  401. {
  402. const char* propertyName = "testRepeatedInt";
  403. RepeatedIntMessage test;
  404. int propertyNumber = RepeatedIntMessage::propertyOrdering.at(1); //See simpletest.proto
  405. ASSERT_STREQ(RepeatedIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::int32List");
  406. ASSERT_EQ(RepeatedIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::int32List>());
  407. ASSERT_STREQ(RepeatedIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  408. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int32List>({1, 2, 3, 4, 5})));
  409. ASSERT_TRUE(test.property(propertyName).value<int32List>() == int32List({1, 2, 3, 4, 5}));
  410. ASSERT_TRUE(test.testRepeatedInt() == int32List({1, 2, 3, 4, 5}));
  411. }
  412. TEST_F(SimpleTest, RepeatedDoubleMessageTest)
  413. {
  414. const char* propertyName = "testRepeatedDouble";
  415. RepeatedDoubleMessage test;
  416. int propertyNumber = RepeatedDoubleMessage::propertyOrdering.at(1); //See simpletest.proto
  417. ASSERT_STREQ(RepeatedDoubleMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::DoubleList");
  418. ASSERT_EQ(RepeatedDoubleMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::DoubleList>());
  419. ASSERT_STREQ(RepeatedDoubleMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  420. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<qtprotobuf::DoubleList>({1.0, 2.3, 3, 4.7, 5.9})));
  421. ASSERT_TRUE(test.property(propertyName).value<qtprotobuf::DoubleList>() == qtprotobuf::DoubleList({1.0, 2.3, 3, 4.7, 5.9}));
  422. ASSERT_TRUE(test.testRepeatedDouble() == qtprotobuf::DoubleList({1.0, 2.3, 3, 4.7, 5.9}));
  423. }
  424. TEST_F(SimpleTest, RepeatedFloatMessageTest)
  425. {
  426. const char* propertyName = "testRepeatedFloat";
  427. RepeatedFloatMessage test;
  428. int propertyNumber = RepeatedFloatMessage::propertyOrdering.at(1); //See simpletest.proto
  429. ASSERT_STREQ(RepeatedFloatMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::FloatList");
  430. ASSERT_EQ(RepeatedFloatMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::FloatList>());
  431. ASSERT_STREQ(RepeatedFloatMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  432. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<qtprotobuf::FloatList>({1.0f, 2.3f, 3, 4.7f, 5.9f})));
  433. ASSERT_TRUE(test.property(propertyName).value<qtprotobuf::FloatList>() == qtprotobuf::FloatList({1.0f, 2.3f, 3, 4.7f, 5.9f}));
  434. ASSERT_TRUE(test.testRepeatedFloat() == qtprotobuf::FloatList({1.0f, 2.3f, 3, 4.7f, 5.9f}));
  435. }
  436. TEST_F(SimpleTest, RepeatedBytesMessageTest)
  437. {
  438. const char* propertyName = "testRepeatedBytes";
  439. RepeatedBytesMessage test;
  440. int propertyNumber = RepeatedBytesMessage::propertyOrdering.at(1); //See simpletest.proto
  441. ASSERT_STREQ(RepeatedBytesMessage::staticMetaObject.property(propertyNumber).typeName(), "QByteArrayList");
  442. ASSERT_EQ(RepeatedBytesMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<QByteArrayList>());
  443. ASSERT_STREQ(RepeatedBytesMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  444. QByteArrayList bList;
  445. bList << "\x01\x02\x03\x04\x05";
  446. bList << "\x01\x05\x03\x04\x03";
  447. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<QByteArrayList>(bList)));
  448. ASSERT_TRUE(test.property(propertyName).value<QByteArrayList>() == bList);
  449. ASSERT_TRUE(test.testRepeatedBytes() == bList);
  450. }
  451. TEST_F(SimpleTest, RepeatedSIntMessageTest)
  452. {
  453. const char* propertyName = "testRepeatedInt";
  454. RepeatedSIntMessage test;
  455. int propertyNumber = RepeatedSIntMessage::propertyOrdering.at(1); //See simpletest.proto
  456. ASSERT_STREQ(RepeatedSIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sint32List");
  457. ASSERT_EQ(RepeatedSIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::sint32List>());
  458. ASSERT_STREQ(RepeatedSIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  459. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sint32List>({1, 2, 3, 4, 5})));
  460. ASSERT_TRUE(test.property(propertyName).value<sint32List>() == sint32List({1, 2, 3, 4, 5}));
  461. ASSERT_TRUE(test.testRepeatedInt() == sint32List({1, 2, 3, 4, 5}));
  462. }
  463. TEST_F(SimpleTest, RepeatedUIntMessageTest)
  464. {
  465. const char* propertyName = "testRepeatedInt";
  466. RepeatedUIntMessage test;
  467. int propertyNumber = RepeatedUIntMessage::propertyOrdering.at(1); //See simpletest.proto
  468. ASSERT_STREQ(RepeatedUIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::uint32List");
  469. ASSERT_EQ(RepeatedUIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::uint32List>());
  470. ASSERT_STREQ(RepeatedUIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  471. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<uint32List>({1, 2, 3, 4, 5})));
  472. ASSERT_TRUE(test.property(propertyName).value<uint32List>() == uint32List({1, 2, 3, 4, 5}));
  473. ASSERT_TRUE(test.testRepeatedInt() == uint32List({1, 2, 3, 4, 5}));
  474. }
  475. TEST_F(SimpleTest, RepeatedInt64MessageTest)
  476. {
  477. const char* propertyName = "testRepeatedInt";
  478. RepeatedInt64Message test;
  479. int propertyNumber = RepeatedInt64Message::propertyOrdering.at(1); //See simpletest.proto
  480. ASSERT_STREQ(RepeatedInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::int64List");
  481. ASSERT_EQ(RepeatedInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::int64List>());
  482. ASSERT_STREQ(RepeatedInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  483. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int64List>({1, 2, 3, 4, 5})));
  484. ASSERT_TRUE(test.property(propertyName).value<int64List>() == int64List({1, 2, 3, 4, 5}));
  485. ASSERT_TRUE(test.testRepeatedInt() == int64List({1, 2, 3, 4, 5}));
  486. }
  487. TEST_F(SimpleTest, RepeatedSInt64MessageTest)
  488. {
  489. const char* propertyName = "testRepeatedInt";
  490. RepeatedSInt64Message test;
  491. int propertyNumber = RepeatedSInt64Message::propertyOrdering.at(1); //See simpletest.proto
  492. ASSERT_STREQ(RepeatedSInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sint64List");
  493. ASSERT_EQ(RepeatedSInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::sint64List>());
  494. ASSERT_STREQ(RepeatedSInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  495. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sint64List>({1, 2, 3, 4, 5})));
  496. ASSERT_TRUE(test.property(propertyName).value<sint64List>() == sint64List({1, 2, 3, 4, 5}));
  497. ASSERT_TRUE(test.testRepeatedInt() == sint64List({1, 2, 3, 4, 5}));
  498. }
  499. TEST_F(SimpleTest, RepeatedUInt64MessageTest)
  500. {
  501. const char* propertyName = "testRepeatedInt";
  502. RepeatedUInt64Message test;
  503. int propertyNumber = RepeatedUInt64Message::propertyOrdering.at(1); //See simpletest.proto
  504. ASSERT_STREQ(RepeatedUInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::uint64List");
  505. ASSERT_EQ(RepeatedUInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::uint64List>());
  506. ASSERT_STREQ(RepeatedUInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  507. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<uint64List>({1, 2, 3, 4, 5})));
  508. ASSERT_TRUE(test.property(propertyName).value<uint64List>() == uint64List({1, 2, 3, 4, 5}));
  509. ASSERT_TRUE(test.testRepeatedInt() == uint64List({1, 2, 3, 4, 5}));
  510. }
  511. TEST_F(SimpleTest, RepeatedFixedIntMessageTest)
  512. {
  513. const char* propertyName = "testRepeatedInt";
  514. RepeatedFixedIntMessage test;
  515. int propertyNumber = RepeatedFixedIntMessage::propertyOrdering.at(1); //See simpletest.proto
  516. ASSERT_STREQ(RepeatedFixedIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::fint32List");
  517. ASSERT_EQ(RepeatedFixedIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::fint32List>());
  518. ASSERT_STREQ(RepeatedFixedIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  519. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<fint32List>({1, 2, 3, 4, 5})));
  520. ASSERT_TRUE(test.property(propertyName).value<fint32List>() == fint32List({1, 2, 3, 4, 5}));
  521. ASSERT_TRUE(test.testRepeatedInt() == fint32List({1, 2, 3, 4, 5}));
  522. }
  523. TEST_F(SimpleTest, RepeatedFixedInt64MessageTest)
  524. {
  525. const char* propertyName = "testRepeatedInt";
  526. RepeatedFixedInt64Message test;
  527. int propertyNumber = RepeatedFixedInt64Message::propertyOrdering.at(1); //See simpletest.proto
  528. ASSERT_STREQ(RepeatedFixedInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::fint64List");
  529. ASSERT_EQ(RepeatedFixedInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::fint64List>());
  530. ASSERT_STREQ(RepeatedFixedInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  531. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<fint64List>({1, 2, 3, 4, 5})));
  532. ASSERT_TRUE(test.property(propertyName).value<fint64List>() == fint64List({1, 2, 3, 4, 5}));
  533. ASSERT_TRUE(test.testRepeatedInt() == fint64List({1, 2, 3, 4, 5}));
  534. }
  535. TEST_F(SimpleTest, RepeatedSFixedIntMessageTest)
  536. {
  537. const char* propertyName = "testRepeatedInt";
  538. RepeatedSFixedIntMessage test;
  539. int propertyNumber = RepeatedSFixedIntMessage::propertyOrdering.at(1); //See simpletest.proto
  540. ASSERT_STREQ(RepeatedSFixedIntMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sfint32List");
  541. ASSERT_EQ(RepeatedSFixedIntMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::sfint32List>());
  542. ASSERT_STREQ(RepeatedSFixedIntMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  543. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sfint32List>({1, 2, 3, 4, 5})));
  544. ASSERT_TRUE(test.property(propertyName).value<sfint32List>() == sfint32List({1, 2, 3, 4, 5}));
  545. ASSERT_TRUE(test.testRepeatedInt() == sfint32List({1, 2, 3, 4, 5}));
  546. }
  547. TEST_F(SimpleTest, RepeatedSFixedInt64MessageTest)
  548. {
  549. const char* propertyName = "testRepeatedInt";
  550. RepeatedSFixedInt64Message test;
  551. int propertyNumber = RepeatedSFixedInt64Message::propertyOrdering.at(1); //See simpletest.proto
  552. ASSERT_STREQ(RepeatedSFixedInt64Message::staticMetaObject.property(propertyNumber).typeName(), "qtprotobuf::sfint64List");
  553. ASSERT_EQ(RepeatedSFixedInt64Message::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobuf::sfint64List>());
  554. ASSERT_STREQ(RepeatedSFixedInt64Message::staticMetaObject.property(propertyNumber).name(), propertyName);
  555. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sfint64List>({1, 2, 3, 4, 5})));
  556. ASSERT_TRUE(test.property(propertyName).value<sfint64List>() == sfint64List({1, 2, 3, 4, 5}));
  557. ASSERT_TRUE(test.testRepeatedInt() == sfint64List({1, 2, 3, 4, 5}));
  558. }
  559. TEST_F(SimpleTest, StepChildEnumMessageTest)
  560. {
  561. const char* propertyName = "localStepChildEnum";
  562. StepChildEnumMessage test;
  563. int propertyNumber = StepChildEnumMessage::propertyOrdering.at(1); //See simpletest.proto
  564. ASSERT_STREQ(StepChildEnumMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnum");
  565. ASSERT_EQ(StepChildEnumMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<SimpleEnumMessage::LocalEnum>());
  566. ASSERT_STREQ(StepChildEnumMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  567. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnum>(SimpleEnumMessage::LOCAL_ENUM_VALUE2)));
  568. ASSERT_TRUE(test.property(propertyName).value<SimpleEnumMessage::LocalEnum>() == SimpleEnumMessage::LOCAL_ENUM_VALUE2);
  569. ASSERT_TRUE(test.localStepChildEnum() == SimpleEnumMessage::LOCAL_ENUM_VALUE2);
  570. }
  571. TEST_F(SimpleTest, StepChildEnumListMessageTest)
  572. {
  573. const char* propertyName = "localStepChildList";
  574. StepChildEnumMessage test;
  575. int propertyNumber = StepChildEnumMessage::propertyOrdering.at(2); //See simpletest.proto
  576. ASSERT_STREQ(StepChildEnumMessage::staticMetaObject.property(propertyNumber).typeName(), "qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnumList");
  577. ASSERT_EQ(StepChildEnumMessage::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnumList>());
  578. ASSERT_STREQ(StepChildEnumMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  579. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnumList>({SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  580. SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  581. SimpleEnumMessage::LOCAL_ENUM_VALUE1,
  582. SimpleEnumMessage::LOCAL_ENUM_VALUE3})));
  583. ASSERT_TRUE(test.property(propertyName).value<SimpleEnumMessage::LocalEnum>() == QVariant::fromValue<SimpleEnumMessage::LocalEnumList>({SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  584. SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  585. SimpleEnumMessage::LOCAL_ENUM_VALUE1,
  586. SimpleEnumMessage::LOCAL_ENUM_VALUE3}));
  587. ASSERT_TRUE(test.localStepChildList() == SimpleEnumMessage::LocalEnumList({SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  588. SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  589. SimpleEnumMessage::LOCAL_ENUM_VALUE1,
  590. SimpleEnumMessage::LOCAL_ENUM_VALUE3}));
  591. }