Debian Codegraph @

test/integration/init-done-test.cpp

raw symbols SCIP
1 /*
2 * %injeqt copyright begin%
3 * Copyright 2016 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 <injeqt/injector.h>cxx . . $ `<file>/include/injeqt/injector.h`/
22 #include <injeqt/module.h>cxx . . $ `<file>/include/injeqt/module.h`/
23
24 #include <QtTest/QtTest>
25
26 class default_objectcxx . . $ default_object#;
27 class ready_objectcxx . . $ ready_object#;
28 class factory_objectcxx . . $ factory_object#;
29 class by_factory_objectcxx . . $ by_factory_object#;
30
31 class common_objectcxx . . $ common_object# : public QObjectcxx . . $ QObject#
32 {
33 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
34
35 public:
36 common_objectcxx . . $ common_object#common_object(49f6e7a06ebc5aa8).()
37 {
38 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_init_called);
39 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_done_called);
40 };
41
42 virtual ~cxx . . $ common_object#`~common_object`(49f6e7a06ebc5aa8).common_objectcxx . . $ common_object#()
43 {
44 }
45
46 protected:
47 bool _common_init_calledcxx . . $ common_object#_common_init_called. = false;
48 bool _common_done_calledcxx . . $ common_object#_common_done_called. = false;
49
50 private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!:
51 INJEQT_INITcxx . . $ `include/injeqt/injeqt.h:32:11`! void initcxx . . $ common_object#init(49f6e7a06ebc5aa8).()
52 {
53 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_init_called);
54 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_done_called);
55 _common_init_calledcxx . . $ common_object#_common_init_called. = true;
56 }
57 INJEQT_DONEcxx . . $ `include/injeqt/injeqt.h:33:11`! void donecxx . . $ common_object#done(49f6e7a06ebc5aa8).()
58 {
59 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_common_init_called);
60 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_done_called);
61 _common_done_calledcxx . . $ common_object#_common_done_called. = true;
62 }
63 };
64
65 class default_objectcxx . . $ default_object# : public common_objectcxx . . $ common_object#
66 {
67 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
68
69 public:
70 Q_INVOKABLEcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:124:9`! default_objectcxx . . $ default_object#default_object(49f6e7a06ebc5aa8).()
71 {
72 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_init_called);
73 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_done_called);
74 };
75
76 virtual ~cxx . . $ default_object#`~default_object`(49f6e7a06ebc5aa8).default_objectcxx . . $ default_object#()
77 {
78 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_init_called);
79 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_done_called);
80 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_common_init_called);
81 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_common_done_called);
82 }
83
84 private:
85 QPointercxx . . $ QPointer#<ready_objectcxx . . $ ready_object#> _ready_objectcxx . . $ default_object#_ready_object.;
86 QPointercxx . . $ QPointer#<by_factory_objectcxx . . $ by_factory_object#> _by_factory_objectcxx . . $ default_object#_by_factory_object.;
87 bool _init_calledcxx . . $ default_object#_init_called. = false;
88 bool _done_calledcxx . . $ default_object#_done_called. = false;
89
90 private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!:
91 INJEQT_INITcxx . . $ `include/injeqt/injeqt.h:32:11`! void initcxx . . $ default_object#init(49f6e7a06ebc5aa8).()
92 {
93 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_ready_object);
94 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_by_factory_object);
95 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_common_init_called);
96 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_done_called);
97 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_init_called);
98 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_done_called);
99 _init_calledcxx . . $ default_object#_init_called. = true;
100 }
101 INJEQT_DONEcxx . . $ `include/injeqt/injeqt.h:33:11`! void donecxx . . $ default_object#done(49f6e7a06ebc5aa8).()
102 {
103 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_ready_object);
104 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_by_factory_object);
105 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_common_init_called);
106 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_done_called);
107 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_init_called);
108 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_done_called);
109 _done_calledcxx . . $ default_object#_done_called. = true;
110 }
111 INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_ready_objectcxx . . $ default_object#set_ready_object(fcbd1149624f30af).(ready_objectcxx . . $ ready_object# *x)
112 {
113 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_init_called);
114 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_done_called);
115 _ready_objectcxx . . $ default_object#_ready_object. =cxx . . $ QPointer#`operator=`(500fb76d9e491ab0). x;
116 }
117 INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_by_factory_objectcxx . . $ default_object#set_by_factory_object(670dddb311e862ae).(by_factory_objectcxx . . $ by_factory_object# *x)
118 {
119 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_init_called);
120 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_done_called);
121 _by_factory_objectcxx . . $ default_object#_by_factory_object. =cxx . . $ QPointer#`operator=`(500fb76d9e491ab0). x;
122 }
123
124 };
125
126 class by_factory_objectcxx . . $ by_factory_object# : public common_objectcxx . . $ common_object#
127 {
128 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
129
130 public:
131 Q_INVOKABLEcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:124:9`! by_factory_objectcxx . . $ by_factory_object#by_factory_object(49f6e7a06ebc5aa8).()
132 {
133 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_init_called);
134 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_done_called);
135 };
136
137 virtual ~cxx . . $ by_factory_object#`~by_factory_object`(49f6e7a06ebc5aa8).by_factory_objectcxx . . $ by_factory_object#()
138 {
139 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_init_called);
140 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_done_called);
141 }
142
143 private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!:
144 INJEQT_INITcxx . . $ `include/injeqt/injeqt.h:32:11`! void initcxx . . $ by_factory_object#init(49f6e7a06ebc5aa8).()
145 {
146 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(false);
147 }
148 INJEQT_DONEcxx . . $ `include/injeqt/injeqt.h:33:11`! void donecxx . . $ by_factory_object#done(49f6e7a06ebc5aa8).()
149 {
150 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(false);
151 }
152
153 };
154
155 class factorycxx . . $ factory# : public QObjectcxx . . $ QObject#
156 {
157 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
158
159 public:
160 Q_INVOKABLEcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:124:9`! factorycxx . . $ factory#factory(49f6e7a06ebc5aa8).() {}
161 Q_INVOKABLEcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:124:9`! by_factory_objectcxx . . $ by_factory_object# * create_by_factory_objectcxx . . $ factory#create_by_factory_object(b39377c9a5f93476).() const { return new by_factory_objectcxx . . $ by_factory_object#by_factory_object(49f6e7a06ebc5aa8).{}; }
162
163 };
164
165 class ready_objectcxx . . $ ready_object# : public common_objectcxx . . $ common_object#
166 {
167 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
168
169 public:
170 Q_INVOKABLEcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:124:9`! ready_objectcxx . . $ ready_object#ready_object(49f6e7a06ebc5aa8).()
171 {
172 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_init_called);
173 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_done_called);
174 };
175
176 virtual ~cxx . . $ ready_object#`~ready_object`(49f6e7a06ebc5aa8).ready_objectcxx . . $ ready_object#()
177 {
178 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_init_called);
179 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_done_called);
180 }
181
182 private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!:
183 INJEQT_INITcxx . . $ `include/injeqt/injeqt.h:32:11`! void initcxx . . $ ready_object#init(49f6e7a06ebc5aa8).()
184 {
185 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(false);
186 }
187 INJEQT_DONEcxx . . $ `include/injeqt/injeqt.h:33:11`! void donecxx . . $ ready_object#done(49f6e7a06ebc5aa8).()
188 {
189 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(false);
190 }
191
192 };
193
194 class injeqt_into_objectcxx . . $ injeqt_into_object# : public common_objectcxx . . $ common_object#
195 {
196 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
197
198 public:
199 Q_INVOKABLEcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:124:9`! injeqt_into_objectcxx . . $ injeqt_into_object#injeqt_into_object(49f6e7a06ebc5aa8).()
200 {
201 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_init_called);
202 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_done_called);
203 };
204
205 virtual ~cxx . . $ injeqt_into_object#`~injeqt_into_object`(49f6e7a06ebc5aa8).injeqt_into_objectcxx . . $ injeqt_into_object#()
206 {
207 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_init_called);
208 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_common_init_called);
209 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_done_called);
210 }
211
212 private:
213 QPointercxx . . $ QPointer#<default_objectcxx . . $ default_object#> _default_objectcxx . . $ injeqt_into_object#_default_object.;
214 QPointercxx . . $ QPointer#<ready_objectcxx . . $ ready_object#> _ready_objectcxx . . $ injeqt_into_object#_ready_object.;
215 QPointercxx . . $ QPointer#<by_factory_objectcxx . . $ by_factory_object#> _by_factory_objectcxx . . $ injeqt_into_object#_by_factory_object.;
216 bool _init_calledcxx . . $ injeqt_into_object#_init_called. = false;
217
218 private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!:
219 INJEQT_INITcxx . . $ `include/injeqt/injeqt.h:32:11`! void initcxx . . $ injeqt_into_object#init(49f6e7a06ebc5aa8).()
220 {
221 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_default_object);
222 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_ready_object);
223 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_by_factory_object);
224 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(_common_init_called);
225 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_done_called);
226 _init_calledcxx . . $ injeqt_into_object#_init_called. = true;
227 }
228 INJEQT_DONEcxx . . $ `include/injeqt/injeqt.h:33:11`! void donecxx . . $ injeqt_into_object#done(49f6e7a06ebc5aa8).()
229 {
230 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(false);
231 }
232 INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_default_objectcxx . . $ injeqt_into_object#set_default_object(75f80fd9820803e8).(default_objectcxx . . $ default_object# *x)
233 {
234 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_init_called);
235 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_init_called);
236 _default_objectcxx . . $ injeqt_into_object#_default_object. =cxx . . $ QPointer#`operator=`(500fb76d9e491ab0). x;
237 }
238 INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_ready_objectcxx . . $ injeqt_into_object#set_ready_object(fcbd1149624f30af).(ready_objectcxx . . $ ready_object# *x)
239 {
240 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_init_called);
241 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_init_called);
242 _ready_objectcxx . . $ injeqt_into_object#_ready_object. =cxx . . $ QPointer#`operator=`(500fb76d9e491ab0). x;
243 }
244 INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_by_factory_objectcxx . . $ injeqt_into_object#set_by_factory_object(670dddb311e862ae).(by_factory_objectcxx . . $ by_factory_object# *x)
245 {
246 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_init_called);
247 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!_common_init_called);
248 _by_factory_objectcxx . . $ injeqt_into_object#_by_factory_object. =cxx . . $ QPointer#`operator=`(500fb76d9e491ab0). x;
249 }
250
251 };
252
253 class init_done_testcxx . . $ init_done_test# : public QObjectcxx . . $ QObject#
254 {
255 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
256
257 private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!:
258 void should_properly_call_init_and_donecxx . . $ init_done_test#should_properly_call_init_and_done(49f6e7a06ebc5aa8).();
259
260 };
261
262 void init_done_testcxx . . $ init_done_test#::should_properly_call_init_and_donecxx . . $ init_done_test#should_properly_call_init_and_done(49f6e7a06ebc5aa8).()
263 {
264 class mcxx . . $ init_done_test#should_properly_call_init_and_done(49f6e7a06ebc5aa8).m# : public injeqtcxx . . $ injeqt/::modulecxx . . $ injeqt/v1/module#
265 {
266 public:
267 mcxx . . $ init_done_test#should_properly_call_init_and_done(49f6e7a06ebc5aa8).m#m(49f6e7a06ebc5aa8).()
268 {
269 _ready_objectcxx . . $ init_done_test#should_properly_call_init_and_done(49f6e7a06ebc5aa8).m#_ready_object. =cxx . . $ std/unique_ptr#`operator=`(1b63e42eaa758a73). stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<ready_objectcxx . . $ ready_object#>(new ready_objectcxx . . $ ready_object#ready_object(49f6e7a06ebc5aa8).{});
270 add_typecxx . . $ injeqt/v1/module#add_type(49f6e7a06ebc5aa8).<default_objectcxx . . $ default_object#>();
271 add_typecxx . . $ injeqt/v1/module#add_type(49f6e7a06ebc5aa8).<factorycxx . . $ factory#>();
272 add_factorycxx . . $ injeqt/v1/module#add_factory(49f6e7a06ebc5aa8).<by_factory_objectcxx . . $ by_factory_object#, factorycxx . . $ factory#>();
273 add_ready_objectcxx . . $ injeqt/v1/module#add_ready_object(749de1b6ae65bddd).<ready_objectcxx . . $ ready_object#>(_ready_objectcxx . . $ init_done_test#should_properly_call_init_and_done(49f6e7a06ebc5aa8).m#_ready_object..getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).());
274 }
275 virtual ~cxx . . $ init_done_test#should_properly_call_init_and_done(49f6e7a06ebc5aa8).m#`~m`(49f6e7a06ebc5aa8).mcxx . . $ init_done_test#should_properly_call_init_and_done(49f6e7a06ebc5aa8).m#() {}
276 private:
277 stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<ready_objectcxx . . $ ready_object#> _ready_objectcxx . . $ init_done_test#should_properly_call_init_and_done(49f6e7a06ebc5aa8).m#_ready_object.;
278 };
279
280 auto modules = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<injeqtcxx . . $ injeqt/::modulecxx . . $ injeqt/v1/module#>>{};
281 modules.emplace_backcxx . . $ std/vector#emplace_back(b3d147e3bb711c35).(stdcxx . . $ std/unique_ptr#unique_ptr(57bc6b0441bf5294).::unique_ptrcxx . . $ std/unique_ptr#<mcxx . . $ init_done_test#should_properly_call_init_and_done(49f6e7a06ebc5aa8).m#>{new mcxx . . $ init_done_test#should_properly_call_init_and_done(49f6e7a06ebc5aa8).m#{}});
282 auto injector = injeqtcxx . . $ injeqt/v1/injector#injector(2c113f511709706a).::injectorcxx . . $ injeqt/v1/injector#{stdcxx . . $ std/vector#vector(b1ea180184b47f03).::movecxx . . $ std/move(e7c6c0c8363dcc46).(modules)};
283
284 injector.getcxx . . $ injeqt/v1/injector#get(155dc7f103cdb9db).<default_objectcxx . . $ default_object#>();
285 injector.getcxx . . $ injeqt/v1/injector#get(155dc7f103cdb9db).<by_factory_objectcxx . . $ by_factory_object#>();
286 injector.getcxx . . $ injeqt/v1/injector#get(155dc7f103cdb9db).<ready_objectcxx . . $ ready_object#>();
287
288 injeqt_into_objectcxx . . $ injeqt_into_object# objectcxx . . $ injeqt_into_object#injeqt_into_object(49f6e7a06ebc5aa8).{};
289 injector.inject_intocxx . . $ injeqt/v1/injector#inject_into(749de1b6ae65bddd).(&object);
290 }
291
292 QTEST_APPLESS_MAINcxx . . $ `<external>/4204159469433502174/qtest.h:442:9`!(init_done_test)
293 #include "init-done-test.moc"cxx . . $ `<file>/build/test/init-done-test_autogen/include/init-done-test.moc`/