2 * Copyright (c) 2020 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.
18 #include <dali-test-suite-utils.h>
19 #include <dali/devel-api/common/addon-binder.h>
20 #include "dali-test-suite-utils/test-addon-manager.h"
22 struct DummyAddOn : public Dali::AddOn::AddOnBinder
24 DummyAddOn() : Dali::AddOn::AddOnBinder( "SampleAddOn" )
27 ~DummyAddOn() override = default;
29 ADDON_BIND_FUNCTION( DoSum, int(int, int) );
31 ADDON_BIND_FUNCTION( StringLen, int() );
34 int UtcDaliAddOnBinderP(void)
36 TestApplication application;
38 auto* addOnManager = new Dali::Test::AddOnManager();
40 tet_infoline("Testing Dali::AddOn::AddOnBinder");
44 // Test whether library handle is non-null
45 DALI_TEST_EQUALS( addon.GetHandle(), (void*)1, TEST_LOCATION );
47 // Test whether addon is valid
48 auto isValid = addon.IsValid();
49 DALI_TEST_EQUALS( isValid, true, TEST_LOCATION );
52 const auto& info = addon.GetAddOnInfo();
53 DALI_TEST_EQUALS( info.name, "SampleAddOn", TEST_LOCATION );
60 int UtcDaliAddOnManagerNotSupportedP(void)
62 TestApplication application;
64 tet_infoline("Testing Dali::AddOn::AddOnBinder when AddOnManager not supported");
67 using VoidPtr = void*;
68 DALI_TEST_EQUALS( VoidPtr(Dali::Integration::AddOnManager::Get()), VoidPtr(nullptr), TEST_LOCATION );
72 // Test whether library handle is non-null
73 DALI_TEST_EQUALS( addon.GetHandle(), (void*)0, TEST_LOCATION );
75 // Test whether addon is valid
76 auto isValid = addon.IsValid();
77 DALI_TEST_EQUALS( isValid, false, TEST_LOCATION );