2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <dali-test-suite-utils.h>
29 class TestHandle : public BaseHandle
33 TestHandle( BaseObject* object ) : BaseHandle( object ) {}
36 class TestObject : public BaseObject
40 } // unnamed namespace
42 void utc_dali_singleton_service_startup(void)
44 test_return_value = TET_UNDEF;
47 void utc_dali_singleton_service_cleanup(void)
49 test_return_value = TET_PASS;
52 int UtcDaliSingletonServiceGet(void)
54 // Attempt to retrieve SingletonService before creating application
55 SingletonService singletonService;
56 singletonService = SingletonService::Get();
57 DALI_TEST_CHECK( !singletonService );
59 // Create Application class, should be able to retrieve SingletonService now
60 Application application = Application::New();
61 singletonService = SingletonService::Get();
62 DALI_TEST_CHECK( singletonService );
67 int UtcDaliSingletonServiceRegisterAndGetSingleton(void)
69 Application application = Application::New();
70 SingletonService singletonService( SingletonService::Get() );
72 // Attempt to register an empty handle
74 singletonService.Register( typeid( handle ), handle );
75 DALI_TEST_CHECK( !singletonService.GetSingleton( typeid( handle ) ) );
77 // Create an actor instance and retrieve, should be valid this time
78 handle = TestHandle( new TestObject );
79 singletonService.Register( typeid( handle ), handle );
80 DALI_TEST_CHECK( singletonService.GetSingleton( typeid( handle ) ) );