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>
21 #include "dali-test-suite-utils/test-addon-manager.h"
23 struct DummyAddOn : public Dali::AddOn::AddOnBinder
26 : Dali::AddOn::AddOnBinder("SampleAddOn")
30 ~DummyAddOn() override = default;
32 ADDON_BIND_FUNCTION(DoSum, int(int, int));
34 ADDON_BIND_FUNCTION(StringLen, int());
37 int UtcDaliAddOnBinderP(void)
39 TestApplication application;
41 auto* addOnManager = new Dali::Test::AddOnManager();
43 tet_infoline("Testing Dali::AddOn::AddOnBinder");
47 // Test whether library handle is non-null
48 DALI_TEST_EQUALS(addon.GetHandle(), (void*)1, TEST_LOCATION);
50 // Test whether addon is valid
51 auto isValid = addon.IsValid();
52 DALI_TEST_EQUALS(isValid, true, TEST_LOCATION);
55 const auto& info = addon.GetAddOnInfo();
56 DALI_TEST_EQUALS(info.name, "SampleAddOn", TEST_LOCATION);
63 int UtcDaliAddOnManagerNotSupportedP(void)
65 TestApplication application;
67 tet_infoline("Testing Dali::AddOn::AddOnBinder when AddOnManager not supported");
70 using VoidPtr = void*;
71 DALI_TEST_EQUALS(VoidPtr(Dali::Integration::AddOnManager::Get()), VoidPtr(nullptr), TEST_LOCATION);
75 // Test whether library handle is non-null
76 DALI_TEST_EQUALS(addon.GetHandle(), (void*)0, TEST_LOCATION);
78 // Test whether addon is valid
79 auto isValid = addon.IsValid();
80 DALI_TEST_EQUALS(isValid, false, TEST_LOCATION);