simpletest.cpp.inc 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. /*
  2. * MIT License
  3. *
  4. * Copyright (c) 2019 Alexey Edelev <semlanik@gmail.com>, Viktor Kopp <vifactor@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 <QVariantList>
  26. #include <QMetaProperty>
  27. #include <QSignalSpy>
  28. #include <gtest/gtest.h>
  29. #include "qtprotobuf_global.pb.h"
  30. using namespace qtprotobufnamespace::tests;
  31. namespace QtProtobuf {
  32. namespace tests {
  33. class SimpleTest : public ::testing::Test
  34. {
  35. public:
  36. // see simpletest.proto for property names and their field indices
  37. SimpleTest()
  38. {
  39. }
  40. template<typename MessageType, typename PropertyType>
  41. static void assertMessagePropertyRegistered(int fieldIndex, const char *propertyTypeName, const char *propertyName)
  42. {
  43. // TODO: there should be(?) a mapping avaialble: PropertyType -> propertyTypeName
  44. const int propertyNumber = MessageType::propertyOrdering.at(fieldIndex);
  45. ASSERT_STREQ(MessageType::staticMetaObject.property(propertyNumber).typeName(), propertyTypeName);
  46. ASSERT_EQ(MessageType::staticMetaObject.property(propertyNumber).userType(), qMetaTypeId<PropertyType>());
  47. ASSERT_STREQ(MessageType::staticMetaObject.property(propertyNumber).name(), propertyName);
  48. }
  49. static void SetUpTestCase();
  50. };
  51. void SimpleTest::SetUpTestCase()
  52. {
  53. QtProtobuf::qRegisterProtobufTypes();
  54. qtprotobufnamespace::tests::qRegisterProtobufTypes();
  55. qtprotobufnamespace1::externaltests::qRegisterProtobufTypes();
  56. qtprotobufnamespace::tests::globalenums::qRegisterProtobufTypes();
  57. }
  58. TEST_F(SimpleTest, SimpleBoolMessageTest)
  59. {
  60. const char *propertyName = "testFieldBool";
  61. assertMessagePropertyRegistered<SimpleBoolMessage, bool>(1, "bool", propertyName);
  62. SimpleBoolMessage test;
  63. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(true)));
  64. ASSERT_EQ(test.property(propertyName).value<bool>(), true);
  65. ASSERT_EQ(test.testFieldBool(), true);
  66. }
  67. TEST_F(SimpleTest, SimpleIntMessageTest)
  68. {
  69. const char *propertyName = "testFieldInt";
  70. assertMessagePropertyRegistered<SimpleIntMessage, int32>(1, "QtProtobuf::int32", propertyName);
  71. SimpleIntMessage test;
  72. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int32>(1)));
  73. ASSERT_EQ(test.property(propertyName).value<int32>(), 1);
  74. ASSERT_EQ(test.testFieldInt(), 1);
  75. }
  76. TEST_F(SimpleTest, SimpleSIntMessageTest)
  77. {
  78. const char *propertyName = "testFieldInt";
  79. assertMessagePropertyRegistered<SimpleSIntMessage, sint32>(1, "QtProtobuf::sint32", propertyName);
  80. SimpleSIntMessage test;
  81. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sint32>(1)));
  82. ASSERT_EQ(test.property(propertyName).value<sint32>(), 1);
  83. ASSERT_EQ(test.testFieldInt(), 1);
  84. }
  85. TEST_F(SimpleTest, SimpleUIntMessageTest)
  86. {
  87. const char *propertyName = "testFieldInt";
  88. assertMessagePropertyRegistered<SimpleUIntMessage, uint32>(1, "QtProtobuf::uint32", propertyName);
  89. SimpleUIntMessage test;
  90. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<uint32>(1)));
  91. ASSERT_EQ(test.property(propertyName).value<uint32>(), 1);
  92. ASSERT_EQ(test.testFieldInt(), 1);
  93. }
  94. TEST_F(SimpleTest, SimpleInt64MessageTest)
  95. {
  96. const char *propertyName = "testFieldInt";
  97. assertMessagePropertyRegistered<SimpleInt64Message, int64>(1, "QtProtobuf::int64", propertyName);
  98. SimpleInt64Message test;
  99. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int64>(1)));
  100. ASSERT_EQ(test.property(propertyName).value<int64>(), 1);
  101. ASSERT_EQ(test.testFieldInt(), 1);
  102. }
  103. TEST_F(SimpleTest, SimpleSInt64MessageTest)
  104. {
  105. const char *propertyName = "testFieldInt";
  106. assertMessagePropertyRegistered<SimpleSInt64Message, sint64>(1, "QtProtobuf::sint64", propertyName);
  107. SimpleSInt64Message test;
  108. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sint64>(1)));
  109. ASSERT_EQ(test.property(propertyName).value<sint64>(), 1);
  110. ASSERT_EQ(test.testFieldInt(), 1);
  111. }
  112. TEST_F(SimpleTest, SimpleUInt64MessageTest)
  113. {
  114. const char *propertyName = "testFieldInt";
  115. assertMessagePropertyRegistered<SimpleUInt64Message, uint64>(1, "QtProtobuf::uint64", propertyName);
  116. SimpleUInt64Message test;
  117. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<uint64>(1)));
  118. ASSERT_EQ(test.property(propertyName).value<uint64>(), 1);
  119. ASSERT_EQ(test.testFieldInt(), 1);
  120. }
  121. TEST_F(SimpleTest, SimpleFixedInt32MessageTest)
  122. {
  123. const char *propertyName = "testFieldFixedInt32";
  124. assertMessagePropertyRegistered<SimpleFixedInt32Message, fixed32>(1, "QtProtobuf::fixed32", propertyName);
  125. SimpleFixedInt32Message test;
  126. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<fixed32>(1)));
  127. ASSERT_EQ(test.property(propertyName).value<fixed32>(), 1);
  128. ASSERT_EQ(test.testFieldFixedInt32(), 1);
  129. }
  130. TEST_F(SimpleTest, SimpleFixedInt64MessageTest)
  131. {
  132. const char *propertyName = "testFieldFixedInt64";
  133. assertMessagePropertyRegistered<SimpleFixedInt64Message, fixed64>(1, "QtProtobuf::fixed64", propertyName);
  134. SimpleFixedInt64Message test;
  135. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<fixed64>(1)));
  136. ASSERT_EQ(test.property(propertyName).value<fixed64>(), 1);
  137. ASSERT_EQ(test.testFieldFixedInt64(), 1);
  138. }
  139. TEST_F(SimpleTest, SimpleSFixedInt32MessageTest)
  140. {
  141. const char *propertyName = "testFieldFixedInt32";
  142. assertMessagePropertyRegistered<SimpleSFixedInt32Message, sfixed32>(1, "QtProtobuf::sfixed32", propertyName);
  143. SimpleSFixedInt32Message test;
  144. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sfixed32>(1)));
  145. ASSERT_EQ(test.property(propertyName).value<sfixed32>(), 1);
  146. ASSERT_EQ(test.testFieldFixedInt32(), 1);
  147. }
  148. TEST_F(SimpleTest, SimpleSFixedInt64MessageTest)
  149. {
  150. const char *propertyName = "testFieldFixedInt64";
  151. assertMessagePropertyRegistered<SimpleSFixedInt64Message, sfixed64>(1, "QtProtobuf::sfixed64", propertyName);
  152. SimpleSFixedInt64Message test;
  153. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sfixed64>(1)));
  154. ASSERT_EQ(test.property(propertyName).value<sfixed64>(), 1);
  155. ASSERT_EQ(test.testFieldFixedInt64(), 1);
  156. }
  157. TEST_F(SimpleTest, SimpleStringMessageTest)
  158. {
  159. const char *propertyName = "testFieldString";
  160. SimpleStringMessage test;
  161. int propertyNumber = SimpleStringMessage::propertyOrdering.at(6); //See simpletest.proto
  162. ASSERT_EQ(SimpleStringMessage::staticMetaObject.property(propertyNumber).type(), QMetaType::QString);
  163. ASSERT_STREQ(SimpleStringMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  164. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(QString("test1"))));
  165. ASSERT_STREQ(test.property(propertyName).toString().toStdString().c_str(), "test1");
  166. ASSERT_STREQ(test.testFieldString().toStdString().c_str(), "test1");
  167. }
  168. TEST_F(SimpleTest, SimpleFloatMessageTest)
  169. {
  170. const char *propertyName = "testFieldFloat";
  171. SimpleFloatMessage test;
  172. int propertyNumber = SimpleFloatMessage::propertyOrdering.at(7); //See simpletest.proto
  173. ASSERT_EQ(SimpleFloatMessage::staticMetaObject.property(propertyNumber).type(), QMetaType::Float);
  174. ASSERT_STREQ(SimpleFloatMessage::staticMetaObject.property(propertyNumber).name(), "testFieldFloat");
  175. float assignedValue = 1.55f;
  176. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<float>(assignedValue)));
  177. ASSERT_FLOAT_EQ(test.property(propertyName).toFloat(), assignedValue);
  178. ASSERT_FLOAT_EQ(test.testFieldFloat(), assignedValue);
  179. }
  180. TEST_F(SimpleTest, SimpleDoubleMessageTest)
  181. {
  182. const char *propertyName = "testFieldDouble";
  183. SimpleDoubleMessage test;
  184. int propertyNumber = SimpleDoubleMessage::propertyOrdering.at(8); //See simpletest.proto
  185. ASSERT_EQ(SimpleDoubleMessage::staticMetaObject.property(propertyNumber).type(), QMetaType::Double);
  186. ASSERT_STREQ(SimpleDoubleMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  187. double assignedValue = 0.55;
  188. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<double>(assignedValue)));
  189. ASSERT_DOUBLE_EQ(test.property(propertyName).toDouble(), assignedValue);
  190. ASSERT_DOUBLE_EQ(test.testFieldDouble(), assignedValue);
  191. }
  192. TEST_F(SimpleTest, SimpleLocalEnumTest)
  193. {
  194. ASSERT_GT(SimpleEnumMessage::staticMetaObject.enumeratorCount(), 0);
  195. QMetaEnum simpleEnum;
  196. for (int i = 0; i < SimpleEnumMessage::staticMetaObject.enumeratorCount(); i++) {
  197. QMetaEnum tmp = SimpleEnumMessage::staticMetaObject.enumerator(i);
  198. if (QString(tmp.name()) == QString("LocalEnum")) {
  199. simpleEnum = tmp;
  200. break;
  201. }
  202. }
  203. ASSERT_TRUE(simpleEnum.isValid());
  204. ASSERT_STREQ(simpleEnum.key(0), "LOCAL_ENUM_VALUE0");
  205. ASSERT_STREQ(simpleEnum.key(1), "LOCAL_ENUM_VALUE1");
  206. ASSERT_STREQ(simpleEnum.key(2), "LOCAL_ENUM_VALUE2");
  207. ASSERT_STREQ(simpleEnum.key(3), "LOCAL_ENUM_VALUE3");
  208. ASSERT_EQ(simpleEnum.value(0), 0);
  209. ASSERT_EQ(simpleEnum.value(1), 1);
  210. ASSERT_EQ(simpleEnum.value(2), 2);
  211. ASSERT_EQ(simpleEnum.value(3), 3);
  212. }
  213. TEST_F(SimpleTest, SimpleLocalEnumListTest)
  214. {
  215. ASSERT_GT(SimpleEnumListMessage::staticMetaObject.enumeratorCount(), 0);
  216. const char *propertyName = "localEnumList";
  217. assertMessagePropertyRegistered<SimpleEnumListMessage, SimpleEnumListMessage::LocalEnumRepeated>(1, "SimpleEnumListMessage::LocalEnumRepeated", propertyName);
  218. SimpleEnumListMessage::LocalEnumRepeated value({SimpleEnumListMessage::LOCAL_ENUM_VALUE2,
  219. SimpleEnumListMessage::LOCAL_ENUM_VALUE2,
  220. SimpleEnumListMessage::LOCAL_ENUM_VALUE1,
  221. SimpleEnumListMessage::LOCAL_ENUM_VALUE3});
  222. SimpleEnumListMessage test;
  223. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<SimpleEnumListMessage::LocalEnumRepeated>(value)));
  224. ASSERT_TRUE(test.property(propertyName).value<SimpleEnumListMessage::LocalEnumRepeated>() == value);
  225. ASSERT_TRUE(test.localEnumList() == value);
  226. }
  227. TEST_F(SimpleTest, SimpleExternalEnumMessageTest)
  228. {
  229. using ExternalGlobalEnums = qtprotobufnamespace1::externaltests::GlobalEnums;
  230. const char *propertyName = "externalEnum";
  231. assertMessagePropertyRegistered<SimpleExternalEnumMessage, ExternalGlobalEnums::ExternalTestEnum>(1, "qtprotobufnamespace1::externaltests::GlobalEnums::ExternalTestEnum", propertyName);
  232. SimpleExternalEnumMessage test;
  233. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<ExternalGlobalEnums::ExternalTestEnum>(ExternalGlobalEnums::EXTERNAL_TEST_ENUM_VALUE4)));
  234. ASSERT_TRUE(test.property(propertyName).value<ExternalGlobalEnums::ExternalTestEnum>() == QVariant::fromValue<ExternalGlobalEnums::ExternalTestEnum>(ExternalGlobalEnums::EXTERNAL_TEST_ENUM_VALUE4));
  235. ASSERT_TRUE(test.externalEnum() == QVariant::fromValue<ExternalGlobalEnums::ExternalTestEnum>(ExternalGlobalEnums::EXTERNAL_TEST_ENUM_VALUE4));
  236. }
  237. TEST_F(SimpleTest, SimpleEnumsTest)
  238. {
  239. EXPECT_GT(GlobalEnums::staticMetaObject.enumeratorCount(), 0);
  240. QMetaEnum testEnum;
  241. for (int i = 0; i < GlobalEnums::staticMetaObject.enumeratorCount(); i++) {
  242. QMetaEnum tmp = GlobalEnums::staticMetaObject.enumerator(i);
  243. if (QString(tmp.name()) == QString("TestEnum")) {
  244. testEnum = tmp;
  245. break;
  246. }
  247. }
  248. ASSERT_TRUE(testEnum.isValid());
  249. ASSERT_STREQ(testEnum.key(0), "TEST_ENUM_VALUE0");
  250. ASSERT_STREQ(testEnum.key(1), "TEST_ENUM_VALUE1");
  251. ASSERT_STREQ(testEnum.key(2), "TEST_ENUM_VALUE2");
  252. ASSERT_STREQ(testEnum.key(3), "TEST_ENUM_VALUE3");
  253. ASSERT_STREQ(testEnum.key(4), "TEST_ENUM_VALUE4");
  254. ASSERT_EQ(testEnum.value(0), 0);
  255. ASSERT_EQ(testEnum.value(1), 1);
  256. ASSERT_EQ(testEnum.value(2), 2);
  257. ASSERT_EQ(testEnum.value(3), 4);
  258. ASSERT_EQ(testEnum.value(4), 3);
  259. for (int i = 0; i < GlobalEnums::staticMetaObject.enumeratorCount(); i++) {
  260. QMetaEnum tmp = GlobalEnums::staticMetaObject.enumerator(i);
  261. if (QString(tmp.name()) == QString("TestEnumSecondInFile")) {
  262. testEnum = tmp;
  263. break;
  264. }
  265. }
  266. ASSERT_TRUE(testEnum.isValid());
  267. ASSERT_STREQ(testEnum.key(0), "TEST_ENUM_SIF_VALUE0");
  268. ASSERT_STREQ(testEnum.key(1), "TEST_ENUM_SIF_VALUE1");
  269. ASSERT_STREQ(testEnum.key(2), "TEST_ENUM_SIF_VALUE2");
  270. ASSERT_EQ(testEnum.value(0), 0);
  271. ASSERT_EQ(testEnum.value(1), 1);
  272. ASSERT_EQ(testEnum.value(2), 2);
  273. }
  274. TEST_F(SimpleTest, SimpleFileEnumsTest)
  275. {
  276. const char *propertyName = "globalEnumList";
  277. assertMessagePropertyRegistered<SimpleFileEnumMessage, GlobalEnums::TestEnumRepeated>(2, "qtprotobufnamespace::tests::GlobalEnums::TestEnumRepeated", propertyName);
  278. GlobalEnums::TestEnumRepeated value({GlobalEnums::TEST_ENUM_VALUE1,
  279. GlobalEnums::TEST_ENUM_VALUE3,
  280. GlobalEnums::TEST_ENUM_VALUE4,
  281. GlobalEnums::TEST_ENUM_VALUE2,
  282. GlobalEnums::TEST_ENUM_VALUE1});
  283. SimpleFileEnumMessage test;
  284. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<GlobalEnums::TestEnumRepeated>(value)));
  285. ASSERT_TRUE(test.property(propertyName).value<GlobalEnums::TestEnumRepeated>() == value);
  286. ASSERT_TRUE(test.globalEnumList() == value);
  287. }
  288. TEST_F(SimpleTest, ComplexMessageTest)
  289. {
  290. ComplexMessage msg;
  291. }
  292. TEST_F(SimpleTest, SimpleBytesMessageTest)
  293. {
  294. const char *propertyName = "testFieldBytes";
  295. SimpleBytesMessage test;
  296. int propertyNumber = SimpleBytesMessage::propertyOrdering.at(1); //See simpletest.proto
  297. ASSERT_EQ(SimpleBytesMessage::staticMetaObject.property(propertyNumber).type(), QMetaType::QByteArray);
  298. ASSERT_STREQ(SimpleBytesMessage::staticMetaObject.property(propertyNumber).name(), propertyName);
  299. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<QByteArray>("\x01\x02\x03\x04\x05")));
  300. ASSERT_TRUE(test.property(propertyName).toByteArray() == QByteArray("\x01\x02\x03\x04\x05"));
  301. ASSERT_TRUE(test.testFieldBytes() == QByteArray("\x01\x02\x03\x04\x05"));
  302. }
  303. TEST_F(SimpleTest, SimpleExternalComplexMessageTest)
  304. {
  305. const char *propertyName = "localList";
  306. assertMessagePropertyRegistered<qtprotobufnamespace1::externaltests::SimpleExternalMessage, int32List>(
  307. 1, "QtProtobuf::int32List", propertyName);
  308. qtprotobufnamespace1::externaltests::SimpleExternalMessage test;
  309. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int32List>({1, 2, 3, 4, 5})));
  310. ASSERT_TRUE(test.property(propertyName).value<int32List>() == int32List({1, 2, 3, 4, 5}));
  311. ASSERT_TRUE(test.localList() == int32List({1, 2, 3, 4, 5}));
  312. }
  313. TEST_F(SimpleTest, RepeatedExternalComplexMessageTest)
  314. {
  315. const char *propertyName = "testExternalComplex";
  316. assertMessagePropertyRegistered<RepeatedExternalComplexMessage, qtprotobufnamespace1::externaltests::ExternalComplexMessageRepeated>(
  317. 1, "qtprotobufnamespace1::externaltests::ExternalComplexMessageRepeated", propertyName);
  318. qtprotobufnamespace1::externaltests::SimpleExternalMessage complexMessage;
  319. complexMessage.setLocalList({1, 2, 3, 4, 5});
  320. QSharedPointer<qtprotobufnamespace1::externaltests::ExternalComplexMessage> externalMessage(new qtprotobufnamespace1::externaltests::ExternalComplexMessage);
  321. externalMessage->setTestFieldInt(complexMessage);
  322. qtprotobufnamespace1::externaltests::ExternalComplexMessageRepeated complexMessageList;
  323. complexMessageList << externalMessage;
  324. RepeatedExternalComplexMessage test;
  325. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue(complexMessageList)));
  326. ASSERT_TRUE(test.property(propertyName).value<qtprotobufnamespace1::externaltests::ExternalComplexMessageRepeated>() == complexMessageList);
  327. ASSERT_TRUE(test.testExternalComplex() == complexMessageList);
  328. }
  329. TEST_F(SimpleTest, RepeatedStringMessageTest)
  330. {
  331. const char *propertyName = "testRepeatedString";
  332. assertMessagePropertyRegistered<RepeatedStringMessage, QStringList>(1, "QStringList", propertyName);
  333. RepeatedStringMessage test;
  334. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<QStringList>({"Text", "tryam"})));
  335. ASSERT_TRUE(test.property(propertyName).value<QStringList>() == QStringList({"Text", "tryam"}));
  336. ASSERT_TRUE(test.testRepeatedString() == QStringList({"Text", "tryam"}));
  337. }
  338. TEST_F(SimpleTest, RepeatedIntMessageTest)
  339. {
  340. const char *propertyName = "testRepeatedInt";
  341. assertMessagePropertyRegistered<RepeatedIntMessage, int32List>(1, "QtProtobuf::int32List", propertyName);
  342. RepeatedIntMessage test;
  343. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int32List>({1, 2, 3, 4, 5})));
  344. ASSERT_TRUE(test.property(propertyName).value<int32List>() == int32List({1, 2, 3, 4, 5}));
  345. ASSERT_TRUE(test.testRepeatedInt() == int32List({1, 2, 3, 4, 5}));
  346. test.testRepeatedInt().append(66);
  347. ASSERT_TRUE(test.testRepeatedInt() == int32List({1, 2, 3, 4, 5, 66}));
  348. test.testRepeatedInt().pop_back();
  349. ASSERT_TRUE(test.testRepeatedInt() == int32List({1, 2, 3, 4, 5}));
  350. }
  351. TEST_F(SimpleTest, RepeatedDoubleMessageTest)
  352. {
  353. const char *propertyName = "testRepeatedDouble";
  354. assertMessagePropertyRegistered<RepeatedDoubleMessage, DoubleList>(1, "QtProtobuf::DoubleList", propertyName);
  355. RepeatedDoubleMessage test;
  356. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<QtProtobuf::DoubleList>({1.0, 2.3, 3, 4.7, 5.9})));
  357. ASSERT_TRUE(test.property(propertyName).value<QtProtobuf::DoubleList>() == QtProtobuf::DoubleList({1.0, 2.3, 3, 4.7, 5.9}));
  358. ASSERT_TRUE(test.testRepeatedDouble() == QtProtobuf::DoubleList({1.0, 2.3, 3, 4.7, 5.9}));
  359. test.testRepeatedDouble().append(6.6);
  360. ASSERT_TRUE(test.testRepeatedDouble() == QtProtobuf::DoubleList({1.0, 2.3, 3, 4.7, 5.9, 6.6}));
  361. test.testRepeatedDouble().pop_back();
  362. ASSERT_TRUE(test.testRepeatedDouble() == QtProtobuf::DoubleList({1.0, 2.3, 3, 4.7, 5.9}));
  363. }
  364. TEST_F(SimpleTest, RepeatedFloatMessageTest)
  365. {
  366. const char *propertyName = "testRepeatedFloat";
  367. assertMessagePropertyRegistered<RepeatedFloatMessage, FloatList>(1, "QtProtobuf::FloatList", propertyName);
  368. RepeatedFloatMessage test;
  369. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<QtProtobuf::FloatList>({1.0f, 2.3f, 3, 4.7f, 5.9f})));
  370. ASSERT_TRUE(test.property(propertyName).value<QtProtobuf::FloatList>() == QtProtobuf::FloatList({1.0f, 2.3f, 3, 4.7f, 5.9f}));
  371. ASSERT_TRUE(test.testRepeatedFloat() == QtProtobuf::FloatList({1.0f, 2.3f, 3, 4.7f, 5.9f}));
  372. test.testRepeatedFloat().append(6.6f);
  373. ASSERT_TRUE(test.testRepeatedFloat() == QtProtobuf::FloatList({1.0f, 2.3f, 3, 4.7f, 5.9f, 6.6f}));
  374. test.testRepeatedFloat().pop_back();
  375. ASSERT_TRUE(test.testRepeatedFloat() == QtProtobuf::FloatList({1.0f, 2.3f, 3, 4.7f, 5.9f}));
  376. }
  377. TEST_F(SimpleTest, RepeatedBytesMessageTest)
  378. {
  379. const char *propertyName = "testRepeatedBytes";
  380. assertMessagePropertyRegistered<RepeatedBytesMessage, QByteArrayList>(1, "QByteArrayList", propertyName);
  381. QByteArrayList bList;
  382. bList << "\x01\x02\x03\x04\x05";
  383. bList << "\x01\x05\x03\x04\x03";
  384. RepeatedBytesMessage test;
  385. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<QByteArrayList>(bList)));
  386. ASSERT_TRUE(test.property(propertyName).value<QByteArrayList>() == bList);
  387. ASSERT_TRUE(test.testRepeatedBytes() == bList);
  388. bList << "\x01\x05\x03\x03";
  389. test.testRepeatedBytes() << "\x01\x05\x03\x03";
  390. ASSERT_TRUE(test.testRepeatedBytes() == bList);
  391. bList.pop_back();
  392. test.testRepeatedBytes().pop_back();
  393. ASSERT_TRUE(test.testRepeatedBytes() == bList);
  394. }
  395. TEST_F(SimpleTest, RepeatedSIntMessageTest)
  396. {
  397. const char *propertyName = "testRepeatedInt";
  398. assertMessagePropertyRegistered<RepeatedSIntMessage, sint32List>(1, "QtProtobuf::sint32List", propertyName);
  399. RepeatedSIntMessage test;
  400. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sint32List>({1, 2, 3, 4, 5})));
  401. ASSERT_TRUE(test.property(propertyName).value<sint32List>() == sint32List({1, 2, 3, 4, 5}));
  402. ASSERT_TRUE(test.testRepeatedInt() == sint32List({1, 2, 3, 4, 5}));
  403. test.testRepeatedInt() << 6;
  404. ASSERT_TRUE(test.testRepeatedInt() == sint32List({1, 2, 3, 4, 5, 6}));
  405. test.testRepeatedInt().pop_back();
  406. ASSERT_TRUE(test.testRepeatedInt() == sint32List({1, 2, 3, 4, 5}));
  407. }
  408. TEST_F(SimpleTest, RepeatedUIntMessageTest)
  409. {
  410. const char *propertyName = "testRepeatedInt";
  411. assertMessagePropertyRegistered<RepeatedUIntMessage, uint32List>(1, "QtProtobuf::uint32List", propertyName);
  412. RepeatedUIntMessage test;
  413. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<uint32List>({1, 2, 3, 4, 5})));
  414. ASSERT_TRUE(test.property(propertyName).value<uint32List>() == uint32List({1, 2, 3, 4, 5}));
  415. ASSERT_TRUE(test.testRepeatedInt() == uint32List({1, 2, 3, 4, 5}));
  416. test.testRepeatedInt().append(6);
  417. ASSERT_TRUE(test.testRepeatedInt() == uint32List({1, 2, 3, 4, 5,6}));
  418. test.testRepeatedInt().pop_back();
  419. ASSERT_TRUE(test.testRepeatedInt() == uint32List({1, 2, 3, 4, 5}));
  420. }
  421. TEST_F(SimpleTest, RepeatedInt64MessageTest)
  422. {
  423. const char *propertyName = "testRepeatedInt";
  424. assertMessagePropertyRegistered<RepeatedInt64Message, int64List>(1, "QtProtobuf::int64List", propertyName);
  425. RepeatedInt64Message test;
  426. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<int64List>({1, 2, 3, 4, 5})));
  427. ASSERT_TRUE(test.property(propertyName).value<int64List>() == int64List({1, 2, 3, 4, 5}));
  428. ASSERT_TRUE(test.testRepeatedInt() == int64List({1, 2, 3, 4, 5}));
  429. test.testRepeatedInt().append(69);
  430. ASSERT_TRUE(test.testRepeatedInt() == int64List({1, 2, 3, 4, 5, 69}));
  431. test.testRepeatedInt().pop_back();
  432. ASSERT_TRUE(test.testRepeatedInt() == int64List({1, 2, 3, 4, 5}));
  433. }
  434. TEST_F(SimpleTest, RepeatedSInt64MessageTest)
  435. {
  436. const char *propertyName = "testRepeatedInt";
  437. assertMessagePropertyRegistered<RepeatedSInt64Message, sint64List>(1, "QtProtobuf::sint64List", propertyName);
  438. RepeatedSInt64Message test;
  439. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sint64List>({1, 2, 3, 4, 5})));
  440. ASSERT_TRUE(test.property(propertyName).value<sint64List>() == sint64List({1, 2, 3, 4, 5}));
  441. ASSERT_TRUE(test.testRepeatedInt() == sint64List({1, 2, 3, 4, 5}));
  442. test.testRepeatedInt() << 96;
  443. ASSERT_TRUE(test.testRepeatedInt() == sint64List({1, 2, 3, 4, 5, 96}));
  444. test.testRepeatedInt().pop_back();
  445. ASSERT_TRUE(test.testRepeatedInt() == sint64List({1, 2, 3, 4, 5}));
  446. }
  447. TEST_F(SimpleTest, RepeatedUInt64MessageTest)
  448. {
  449. const char *propertyName = "testRepeatedInt";
  450. assertMessagePropertyRegistered<RepeatedUInt64Message, uint64List>(1, "QtProtobuf::uint64List", propertyName);
  451. RepeatedUInt64Message test;
  452. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<uint64List>({1, 2, 3, 4, 5})));
  453. ASSERT_TRUE(test.property(propertyName).value<uint64List>() == uint64List({1, 2, 3, 4, 5}));
  454. ASSERT_TRUE(test.testRepeatedInt() == uint64List({1, 2, 3, 4, 5}));
  455. test.testRepeatedInt().append(96);
  456. ASSERT_TRUE(test.testRepeatedInt() == uint64List({1, 2, 3, 4, 5, 96}));
  457. test.testRepeatedInt().pop_back();
  458. ASSERT_TRUE(test.testRepeatedInt() == uint64List({1, 2, 3, 4, 5}));
  459. }
  460. TEST_F(SimpleTest, RepeatedFixedIntMessageTest)
  461. {
  462. const char *propertyName = "testRepeatedInt";
  463. assertMessagePropertyRegistered<RepeatedFixedIntMessage, fixed32List>(1, "QtProtobuf::fixed32List", propertyName);
  464. RepeatedFixedIntMessage test;
  465. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<fixed32List>({1, 2, 3, 4, 5})));
  466. ASSERT_TRUE(test.property(propertyName).value<fixed32List>() == fixed32List({1, 2, 3, 4, 5}));
  467. ASSERT_TRUE(test.testRepeatedInt() == fixed32List({1, 2, 3, 4, 5}));
  468. test.testRepeatedInt() << 0;
  469. ASSERT_TRUE(test.testRepeatedInt() == fixed32List({1, 2, 3, 4, 5, 0}));
  470. test.testRepeatedInt().pop_back();
  471. ASSERT_TRUE(test.testRepeatedInt() == fixed32List({1, 2, 3, 4, 5}));
  472. }
  473. TEST_F(SimpleTest, RepeatedFixedInt64MessageTest)
  474. {
  475. const char *propertyName = "testRepeatedInt";
  476. assertMessagePropertyRegistered<RepeatedFixedInt64Message, fixed64List>(1, "QtProtobuf::fixed64List", propertyName);
  477. RepeatedFixedInt64Message test;
  478. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<fixed64List>({1, 2, 3, 4, 5})));
  479. ASSERT_TRUE(test.property(propertyName).value<fixed64List>() == fixed64List({1, 2, 3, 4, 5}));
  480. ASSERT_TRUE(test.testRepeatedInt() == fixed64List({1, 2, 3, 4, 5}));
  481. test.testRepeatedInt() << 0;
  482. ASSERT_TRUE(test.testRepeatedInt() == fixed64List({1, 2, 3, 4, 5, 0}));
  483. test.testRepeatedInt().pop_back();
  484. ASSERT_TRUE(test.testRepeatedInt() == fixed64List({1, 2, 3, 4, 5}));
  485. }
  486. TEST_F(SimpleTest, RepeatedSFixedIntMessageTest)
  487. {
  488. const char *propertyName = "testRepeatedInt";
  489. assertMessagePropertyRegistered<RepeatedSFixedIntMessage, sfixed32List>(1, "QtProtobuf::sfixed32List", propertyName);
  490. RepeatedSFixedIntMessage test;
  491. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sfixed32List>({1, 2, 3, 4, 5})));
  492. ASSERT_TRUE(test.property(propertyName).value<sfixed32List>() == sfixed32List({1, 2, 3, 4, 5}));
  493. ASSERT_TRUE(test.testRepeatedInt() == sfixed32List({1, 2, 3, 4, 5}));
  494. test.testRepeatedInt() << 0;
  495. ASSERT_TRUE(test.testRepeatedInt() == sfixed32List({1, 2, 3, 4, 5, 0}));
  496. test.testRepeatedInt().pop_back();
  497. ASSERT_TRUE(test.testRepeatedInt() == sfixed32List({1, 2, 3, 4, 5}));
  498. }
  499. TEST_F(SimpleTest, RepeatedSFixedInt64MessageTest)
  500. {
  501. const char *propertyName = "testRepeatedInt";
  502. assertMessagePropertyRegistered<RepeatedSFixedInt64Message, QtProtobuf::sfixed64List>(1, "QtProtobuf::sfixed64List", propertyName);
  503. RepeatedSFixedInt64Message test;
  504. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<sfixed64List>({1, 2, 3, 4, 5})));
  505. ASSERT_TRUE(test.property(propertyName).value<sfixed64List>() == sfixed64List({1, 2, 3, 4, 5}));
  506. ASSERT_TRUE(test.testRepeatedInt() == sfixed64List({1, 2, 3, 4, 5}));
  507. test.testRepeatedInt() << 0;
  508. ASSERT_TRUE(test.testRepeatedInt() == sfixed64List({1, 2, 3, 4, 5, 0}));
  509. test.testRepeatedInt().pop_back();
  510. ASSERT_TRUE(test.testRepeatedInt() == sfixed64List({1, 2, 3, 4, 5}));
  511. }
  512. TEST_F(SimpleTest, StepChildEnumMessageTest)
  513. {
  514. const char *propertyName = "localStepChildEnum";
  515. assertMessagePropertyRegistered<StepChildEnumMessage, SimpleEnumMessage::LocalEnum>(1, "qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnum", propertyName);
  516. StepChildEnumMessage test;
  517. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<SimpleEnumMessage::LocalEnum>(SimpleEnumMessage::LocalEnum::LOCAL_ENUM_VALUE2)));
  518. ASSERT_TRUE(test.property(propertyName).value<SimpleEnumMessage::LocalEnum>() == SimpleEnumMessage::LocalEnum::LOCAL_ENUM_VALUE2);
  519. ASSERT_TRUE(test.localStepChildEnum() == SimpleEnumMessage::LocalEnum::LOCAL_ENUM_VALUE2);
  520. }
  521. TEST_F(SimpleTest, StepChildEnumListMessageTest)
  522. {
  523. const char *propertyName = "localStepChildList";
  524. assertMessagePropertyRegistered<StepChildEnumMessage, SimpleEnumMessage::LocalEnumRepeated>(2, "qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnumRepeated", propertyName);
  525. SimpleEnumMessage::LocalEnumRepeated value({SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  526. SimpleEnumMessage::LOCAL_ENUM_VALUE2,
  527. SimpleEnumMessage::LOCAL_ENUM_VALUE1,
  528. SimpleEnumMessage::LOCAL_ENUM_VALUE3});
  529. StepChildEnumMessage test;
  530. ASSERT_TRUE(test.setProperty(propertyName, QVariant::fromValue<qtprotobufnamespace::tests::SimpleEnumMessage::LocalEnumRepeated>(value)));
  531. ASSERT_TRUE(test.property(propertyName).value<SimpleEnumMessage::LocalEnumRepeated>() == value);
  532. ASSERT_TRUE(test.localStepChildList() == value);
  533. }
  534. TEST_F(SimpleTest, SimpleSInt32StringMapMessageTest)
  535. {
  536. const char *propertyName = "mapField";
  537. assertMessagePropertyRegistered<SimpleSInt32StringMapMessage, SimpleSInt32StringMapMessage::MapFieldEntry>(1, "SimpleSInt32StringMapMessage::MapFieldEntry", propertyName);
  538. ASSERT_TRUE(QMetaType::isRegistered(qMetaTypeId<SimpleSInt32StringMapMessage::MapFieldEntry>()));
  539. SimpleSInt32StringMapMessage::MapFieldEntry testMap = {{10, {"Some 10"}}, {0, {"Some 0"}}, {44, {"Some 44"}}};
  540. SimpleSInt32StringMapMessage test;
  541. test.setMapField(testMap);
  542. ASSERT_TRUE(test.property(propertyName).value<SimpleSInt32StringMapMessage::MapFieldEntry>() == testMap);
  543. ASSERT_TRUE(test.mapField() == testMap);
  544. ASSERT_STREQ(test.mapField()[10].toStdString().c_str(), "Some 10");
  545. ASSERT_STREQ(test.mapField()[0].toStdString().c_str(), "Some 0");
  546. ASSERT_STREQ(test.mapField()[44].toStdString().c_str(), "Some 44");
  547. test.mapField()[66] = "Some 66";
  548. ASSERT_STREQ(test.mapField()[66].toStdString().c_str(), "Some 66");
  549. test.mapField()[66] = "Some default";
  550. ASSERT_STREQ(test.mapField()[66].toStdString().c_str(), "Some default");
  551. }
  552. TEST_F(SimpleTest, SimpleStringStringMapMessageTest)
  553. {
  554. const char *propertyName = "mapField";
  555. assertMessagePropertyRegistered<SimpleStringStringMapMessage, SimpleStringStringMapMessage::MapFieldEntry>(13, "SimpleStringStringMapMessage::MapFieldEntry", propertyName);
  556. ASSERT_TRUE(QMetaType::isRegistered(qMetaTypeId<SimpleStringStringMapMessage::MapFieldEntry>()));
  557. SimpleStringStringMapMessage::MapFieldEntry testMap = {{"key 10", "Some 10"}, {"key 0", "Some 0"}, {"key 44", "Some 44"}};
  558. SimpleStringStringMapMessage test;
  559. test.setMapField(testMap);
  560. ASSERT_TRUE(test.property(propertyName).value<SimpleStringStringMapMessage::MapFieldEntry>() == testMap);
  561. ASSERT_TRUE(test.mapField() == testMap);
  562. ASSERT_STREQ(test.mapField()["key 10"].toStdString().c_str(), "Some 10");
  563. ASSERT_STREQ(test.mapField()["key 0"].toStdString().c_str(), "Some 0");
  564. ASSERT_STREQ(test.mapField()["key 44"].toStdString().c_str(), "Some 44");
  565. test.mapField()["key 66"] = "Some 66";
  566. ASSERT_STREQ(test.mapField()["key 66"].toStdString().c_str(), "Some 66");
  567. test.mapField()["key 66"] = "Some default";
  568. ASSERT_STREQ(test.mapField()["key 66"].toStdString().c_str(), "Some default");
  569. }
  570. TEST_F(SimpleTest, EmptyMessageTest)
  571. {
  572. ASSERT_EQ(EmptyMessage::propertyOrdering.size(), 0);
  573. ASSERT_EQ(EmptyMessage::staticMetaObject.propertyCount(), 1);
  574. }
  575. TEST_F(SimpleTest, NullPointerMessageTest)
  576. {
  577. ComplexMessage msg(0, {QString("not null")});
  578. msg.setTestComplexField_p(nullptr);
  579. ASSERT_TRUE(msg.testComplexField().testFieldString().isEmpty());
  580. }
  581. TEST_F(SimpleTest, AssignmentOperatorTest)
  582. {
  583. const char *propertyName = "testFieldInt";
  584. SimpleIntMessage test;
  585. SimpleIntMessage test2{35};
  586. QSignalSpy updateSpy(&test, &SimpleIntMessage::testFieldIntChanged);
  587. test.setProperty(propertyName, QVariant::fromValue<int32>(15));
  588. test.setTestFieldInt(25);
  589. test = test2;
  590. test = test;
  591. test = test2;
  592. ASSERT_EQ(test2.testFieldInt(), test.testFieldInt());
  593. ASSERT_EQ(3, updateSpy.count());
  594. }
  595. TEST_F(SimpleTest, MoveOperatorTest)
  596. {
  597. const char *propertyName = "testFieldInt";
  598. SimpleIntMessage test;
  599. SimpleIntMessage test2{35};
  600. QSignalSpy updateSpy(&test, &SimpleIntMessage::testFieldIntChanged);
  601. QSignalSpy movedUpdateSpy(&test2, &SimpleIntMessage::testFieldIntChanged);
  602. SimpleIntMessage test3(std::move(test2));
  603. test2.setTestFieldInt(35);
  604. test.setProperty(propertyName, QVariant::fromValue<int32>(15));
  605. test.setTestFieldInt(25);
  606. test = std::move(test2);
  607. ASSERT_EQ(35, test.testFieldInt());
  608. ASSERT_EQ(0, test2.testFieldInt());
  609. ASSERT_EQ(3, updateSpy.count());
  610. ASSERT_EQ(3, movedUpdateSpy.count());
  611. }
  612. TEST_F(SimpleTest, UnderscoresTest)
  613. {
  614. //Sanity compilation checks
  615. Message_Uderscore_name msg1;
  616. MessageUderscorename msg2;
  617. MessageUnderscoreField msg3;
  618. PriorMessageUnderscoreField msg4;
  619. FollowingMessageUnderscoreField msg5;
  620. CombinedMessageUnderscoreField msg6;
  621. assertMessagePropertyRegistered<MessageUnderscoreField, sint32>(1, "QtProtobuf::sint32", "underScore_Message_field");
  622. assertMessagePropertyRegistered<PriorMessageUnderscoreField, sint32>(1, "QtProtobuf::sint32", "_underScoreMessageField");
  623. assertMessagePropertyRegistered<PriorMessageUnderscoreField, sint32>(1, "QtProtobuf::sint32", "_underScoreMessageField");
  624. assertMessagePropertyRegistered<FollowingMessageUnderscoreField , sint32>(1, "QtProtobuf::sint32", "underScoreMessageField_");
  625. assertMessagePropertyRegistered<CombinedMessageUnderscoreField , sint32>(1, "QtProtobuf::sint32", "_underScoreMessage_Field_");
  626. }
  627. TEST_F(SimpleTest, SequenceTest)
  628. {
  629. assertMessagePropertyRegistered<sequence::TestMessageSequence, sequence::TestMessageSequence2*>(1, "TestMessageSequence2*", "testField");
  630. assertMessagePropertyRegistered<sequence::TestMessageSequence2, bool>(1, "bool", "testField");
  631. }
  632. TEST_F(SimpleTest, CyclingTest)
  633. {
  634. assertMessagePropertyRegistered<sequence::CyclingFirstDependency, sequence::CyclingSecondDependency*>(1, "CyclingSecondDependency*", "testField");
  635. assertMessagePropertyRegistered<sequence::CyclingSecondDependency, sequence::CyclingFirstDependency*>(1, "CyclingFirstDependency*", "testField");
  636. }
  637. TEST_F(SimpleTest, UpperCaseTest)
  638. {
  639. assertMessagePropertyRegistered<MessageUpperCase, sint32>(1, "QtProtobuf::sint32", "testField");
  640. assertMessagePropertyRegistered<MessageUpperCase, sint32>(2, "QtProtobuf::sint32", "propertyProto");
  641. assertMessagePropertyRegistered<MessageUpperCase, sint32>(3, "QtProtobuf::sint32", "idProto");
  642. }
  643. } // tests
  644. } // qtprotobuf