| 1 | /* |
| 2 | * %injeqt copyright begin% |
| 3 | * Copyright 2014 Rafał Malinowski ([email protected]) |
| 4 | * %injeqt copyright end% |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #include "expect.h"cxx . . $ `<file>/test/unit/expect.h`/ |
| 22 | #include "utils.h"cxx . . $ `<file>/test/unit/utils.h`/ |
| 23 | |
| 24 | #include "internal/type-role.h"cxx . . $ `<file>/src/internal/type-role.h`/ |
| 25 | |
| 26 | #include <QtTest/QtTest> |
| 27 | #include <string> |
| 28 | |
| 29 | using namespace injeqtcxx . . $ injeqt/::internal; |
| 30 | using namespace injeqtcxx . . $ injeqt/::v1; |
| 31 | |
| 32 | #define ROLE_1cxx . . $ `test/unit/type-role-test.cpp:32:9`! "role1" |
| 33 | #define ROLE_2cxx . . $ `test/unit/type-role-test.cpp:33:9`! "role2" |
| 34 | |
| 35 | class no_role_typecxx . . $ no_role_type# : public QObjectcxx . . $ QObject# |
| 36 | { |
| 37 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 38 | }; |
| 39 | |
| 40 | class role_1_typecxx . . $ role_1_type# : public no_role_typecxx . . $ no_role_type# |
| 41 | { |
| 42 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 43 | INJEQT_TYPE_ROLEcxx . . $ `include/injeqt/injeqt.h:40:9`!(ROLE_1cxx . . $ `test/unit/type-role-test.cpp:32:9`!) |
| 44 | }; |
| 45 | |
| 46 | class role_1_inherited_typecxx . . $ role_1_inherited_type# : public role_1_typecxx . . $ role_1_type# |
| 47 | { |
| 48 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 49 | }; |
| 50 | |
| 51 | class role_1_double_typecxx . . $ role_1_double_type# : public no_role_typecxx . . $ no_role_type# |
| 52 | { |
| 53 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 54 | INJEQT_TYPE_ROLEcxx . . $ `include/injeqt/injeqt.h:40:9`!(ROLE_1cxx . . $ `test/unit/type-role-test.cpp:32:9`!) |
| 55 | INJEQT_TYPE_ROLEcxx . . $ `include/injeqt/injeqt.h:40:9`!(ROLE_1cxx . . $ `test/unit/type-role-test.cpp:32:9`!) |
| 56 | }; |
| 57 | |
| 58 | class role_2_inherited_from_role_1_typecxx . . $ role_2_inherited_from_role_1_type# : public role_1_typecxx . . $ role_1_type# |
| 59 | { |
| 60 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 61 | INJEQT_TYPE_ROLEcxx . . $ `include/injeqt/injeqt.h:40:9`!(ROLE_2cxx . . $ `test/unit/type-role-test.cpp:33:9`!) |
| 62 | }; |
| 63 | |
| 64 | class role_1_and_2_typecxx . . $ role_1_and_2_type# : public no_role_typecxx . . $ no_role_type# |
| 65 | { |
| 66 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 67 | INJEQT_TYPE_ROLEcxx . . $ `include/injeqt/injeqt.h:40:9`!(ROLE_1cxx . . $ `test/unit/type-role-test.cpp:32:9`!) |
| 68 | INJEQT_TYPE_ROLEcxx . . $ `include/injeqt/injeqt.h:40:9`!(ROLE_2cxx . . $ `test/unit/type-role-test.cpp:33:9`!) |
| 69 | }; |
| 70 | |
| 71 | class type_role_testcxx . . $ type_role_test# : public QObjectcxx . . $ QObject# |
| 72 | { |
| 73 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 74 | |
| 75 | private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 76 | void should_have_no_role_by_defaultcxx . . $ type_role_test#should_have_no_role_by_default(49f6e7a06ebc5aa8).(); |
| 77 | void should_have_one_role_when_directly_declaredcxx . . $ type_role_test#should_have_one_role_when_directly_declared(49f6e7a06ebc5aa8).(); |
| 78 | void should_have_one_role_when_declared_in_supertypecxx . . $ type_role_test#should_have_one_role_when_declared_in_supertype(49f6e7a06ebc5aa8).(); |
| 79 | void should_have_one_role_when_declared_twicecxx . . $ type_role_test#should_have_one_role_when_declared_twice(49f6e7a06ebc5aa8).(); |
| 80 | void should_have_two_roles_when_added_in_subtypecxx . . $ type_role_test#should_have_two_roles_when_added_in_subtype(49f6e7a06ebc5aa8).(); |
| 81 | void should_have_two_roles_when_directly_declaredcxx . . $ type_role_test#should_have_two_roles_when_directly_declared(49f6e7a06ebc5aa8).(); |
| 82 | |
| 83 | }; |
| 84 | |
| 85 | void type_role_testcxx . . $ type_role_test#::should_have_no_role_by_defaultcxx . . $ type_role_test#should_have_no_role_by_default(49f6e7a06ebc5aa8).() |
| 86 | { |
| 87 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!has_type_role<no_role_type>(ROLE_1cxx . . $ `test/unit/type-role-test.cpp:32:9`!)); |
| 88 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!has_type_role<no_role_type>(ROLE_2cxx . . $ `test/unit/type-role-test.cpp:33:9`!)); |
| 89 | } |
| 90 | |
| 91 | void type_role_testcxx . . $ type_role_test#::should_have_one_role_when_directly_declaredcxx . . $ type_role_test#should_have_one_role_when_directly_declared(49f6e7a06ebc5aa8).() |
| 92 | { |
| 93 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(has_type_role<role_1_type>(ROLE_1cxx . . $ `test/unit/type-role-test.cpp:32:9`!)); |
| 94 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!has_type_role<role_1_type>(ROLE_2cxx . . $ `test/unit/type-role-test.cpp:33:9`!)); |
| 95 | } |
| 96 | |
| 97 | void type_role_testcxx . . $ type_role_test#::should_have_one_role_when_declared_in_supertypecxx . . $ type_role_test#should_have_one_role_when_declared_in_supertype(49f6e7a06ebc5aa8).() |
| 98 | { |
| 99 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(has_type_role<role_1_inherited_type>(ROLE_1cxx . . $ `test/unit/type-role-test.cpp:32:9`!)); |
| 100 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!has_type_role<role_1_inherited_type>(ROLE_2cxx . . $ `test/unit/type-role-test.cpp:33:9`!)); |
| 101 | } |
| 102 | |
| 103 | void type_role_testcxx . . $ type_role_test#::should_have_one_role_when_declared_twicecxx . . $ type_role_test#should_have_one_role_when_declared_twice(49f6e7a06ebc5aa8).() |
| 104 | { |
| 105 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(has_type_role<role_1_double_type>(ROLE_1cxx . . $ `test/unit/type-role-test.cpp:32:9`!)); |
| 106 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!has_type_role<role_1_double_type>(ROLE_2cxx . . $ `test/unit/type-role-test.cpp:33:9`!)); |
| 107 | } |
| 108 | |
| 109 | void type_role_testcxx . . $ type_role_test#::should_have_two_roles_when_added_in_subtypecxx . . $ type_role_test#should_have_two_roles_when_added_in_subtype(49f6e7a06ebc5aa8).() |
| 110 | { |
| 111 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(has_type_role<role_2_inherited_from_role_1_type>(ROLE_1cxx . . $ `test/unit/type-role-test.cpp:32:9`!)); |
| 112 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(has_type_role<role_2_inherited_from_role_1_type>(ROLE_2cxx . . $ `test/unit/type-role-test.cpp:33:9`!)); |
| 113 | } |
| 114 | |
| 115 | void type_role_testcxx . . $ type_role_test#::should_have_two_roles_when_directly_declaredcxx . . $ type_role_test#should_have_two_roles_when_directly_declared(49f6e7a06ebc5aa8).() |
| 116 | { |
| 117 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(has_type_role<role_1_and_2_type>(ROLE_1cxx . . $ `test/unit/type-role-test.cpp:32:9`!)); |
| 118 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(has_type_role<role_1_and_2_type>(ROLE_2cxx . . $ `test/unit/type-role-test.cpp:33:9`!)); |
| 119 | } |
| 120 | |
| 121 | QTEST_APPLESS_MAINcxx . . $ `<external>/4204159469433502174/qtest.h:442:9`!(type_role_test) |
| 122 | #include "type-role-test.moc"cxx . . $ `<file>/build/test/type-role-test_autogen/include/type-role-test.moc`/ |