duplicatedmetatypestest.cpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * MIT License
  3. *
  4. * Copyright (c) 2020 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 <gtest/gtest.h>
  26. #include <qprotobufserializer.h>
  27. #include "duplicated_metatypes.qpb.h"
  28. #include "../testscommon.h"
  29. namespace QtProtobuf {
  30. namespace tests {
  31. class DuplicatedMetatypesTest : public ::testing::Test
  32. {
  33. public:
  34. DuplicatedMetatypesTest() = default;
  35. void SetUp() override;
  36. static void SetUpTestCase();
  37. };
  38. void DuplicatedMetatypesTest::SetUpTestCase()
  39. {
  40. //Register all types
  41. QtProtobuf::qRegisterProtobufTypes();
  42. }
  43. void DuplicatedMetatypesTest::SetUp()
  44. {
  45. }
  46. TEST_F(DuplicatedMetatypesTest, SimpleTest) {
  47. assertMessagePropertyRegistered<qtprotobufnamespace::duplicated_metatypes::Message1, qtprotobufnamespace::duplicated_metatypes::Message1::OptsEntry>(1, "qtprotobufnamespace::duplicated_metatypes::Message1::OptsEntry", "opts");
  48. assertMessagePropertyRegistered<qtprotobufnamespace::duplicated_metatypes::Message2, qtprotobufnamespace::duplicated_metatypes::Message2::OptsEntry>(1, "qtprotobufnamespace::duplicated_metatypes::Message2::OptsEntry", "opts");
  49. assertMessagePropertyRegistered<qtprotobufnamespace::duplicated_metatypes::Message3, qtprotobufnamespace::duplicated_metatypes::Message3::OptsEntry>(1, "qtprotobufnamespace::duplicated_metatypes::Message3::OptsEntry", "opts");
  50. assertMessagePropertyRegistered<qtprotobufnamespace::duplicated_metatypes::Message4, qtprotobufnamespace::duplicated_metatypes::Message4::OptsEntry>(1, "qtprotobufnamespace::duplicated_metatypes::Message4::OptsEntry", "opts");
  51. assertMessagePropertyRegistered<qtprotobufnamespace::duplicated_metatypes::Message5, qtprotobufnamespace::duplicated_metatypes::Message5::OptsEntry>(1, "qtprotobufnamespace::duplicated_metatypes::Message5::OptsEntry", "opts");
  52. assertMessagePropertyRegistered<qtprotobufnamespace::duplicated_metatypes::Message6, qtprotobufnamespace::duplicated_metatypes::Message6::OptsEntry>(1, "qtprotobufnamespace::duplicated_metatypes::Message6::OptsEntry", "opts");
  53. assertMessagePropertyRegistered<qtprotobufnamespace::duplicated_metatypes::Message7, qtprotobufnamespace::duplicated_metatypes::Message7::OptsEntry>(1, "qtprotobufnamespace::duplicated_metatypes::Message7::OptsEntry", "opts");
  54. assertMessagePropertyRegistered<qtprotobufnamespace::duplicated_metatypes::Message8, qtprotobufnamespace::duplicated_metatypes::Message8::OptsEntry>(1, "qtprotobufnamespace::duplicated_metatypes::Message8::OptsEntry", "opts");
  55. }
  56. }
  57. }