| 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 | |
| 23 | #include "internal/injector-core.h"cxx . . $ `<file>/src/internal/injector-core.h`/ |
| 24 | #include "internal/provider-ready.h"cxx . . $ `<file>/src/internal/provider-ready.h`/ |
| 25 | |
| 26 | #include <QtTest/QtTest> |
| 27 | #include <memory> |
| 28 | |
| 29 | using namespace injeqtcxx . . $ injeqt/::v1; |
| 30 | using namespace injeqtcxx . . $ injeqt/::internal; |
| 31 | |
| 32 | class ready_typecxx . . $ ready_type# : public QObjectcxx . . $ QObject# |
| 33 | { |
| 34 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 35 | }; |
| 36 | |
| 37 | class provider_ready_testcxx . . $ provider_ready_test# : public QObjectcxx . . $ QObject# |
| 38 | { |
| 39 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 40 | |
| 41 | private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 42 | void should_return_always_the_same_objectcxx . . $ provider_ready_test#should_return_always_the_same_object(49f6e7a06ebc5aa8).(); |
| 43 | |
| 44 | }; |
| 45 | |
| 46 | void provider_ready_testcxx . . $ provider_ready_test#::should_return_always_the_same_objectcxx . . $ provider_ready_test#should_return_always_the_same_object(49f6e7a06ebc5aa8).() |
| 47 | { |
| 48 | auto empty_injector1 = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{}; |
| 49 | auto empty_injector2 = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{}; |
| 50 | auto object = stdcxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).::unique_ptrcxx . . $ std/unique_ptr#<QObjectcxx . . $ QObject#>(new ready_typecxx . . $ ready_type#()); |
| 51 | auto i = implementationcxx . . $ injeqt/internal/implementation#implementation(9ea1470f0de69db5).{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<ready_typecxx . . $ ready_type#>(), object.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).()}; |
| 52 | auto p = provider_readycxx . . $ injeqt/internal/provider_ready#provider_ready(afe902e6a66e0301).{i}; |
| 53 | |
| 54 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(p.provided_type(), make_type<ready_type>()); |
| 55 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(p.required_types(), types{}); |
| 56 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(p.ready_implementation(), i); |
| 57 | |
| 58 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(p.provide(empty_injector1), object.get()); |
| 59 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(p.provide(empty_injector2), object.get()); |
| 60 | } |
| 61 | |
| 62 | QTEST_APPLESS_MAINcxx . . $ `<external>/4204159469433502174/qtest.h:442:9`!(provider_ready_test) |
| 63 | #include "provider-ready-test.moc"cxx . . $ `<file>/build/test/provider-ready-test_autogen/include/provider-ready-test.moc`/ |