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/addons/addon-base.h>
24 bool gIsPaused = false;
27 int StringLen(const char* str)
32 int DoSum(int a, int b)
37 bool GetLifecycleStatus()
42 struct AddOnDataInstance
49 static int GetValueWithInstance(AddOnDataInstance* instance)
51 return instance->GetValue();
55 AddOnDataInstance* CreateInstance()
57 return new AddOnDataInstance();
60 class TestDummyAddOn : public Dali::AddOns::AddOnBase
63 void GetAddOnInfo(Dali::AddOnInfo& info) override
65 info.type = Dali::AddOnType::GENERIC;
66 info.name = "SampleAddOn";
67 info.version = Dali::DALI_ADDON_VERSION(1, 0, 0);
69 tet_printf("SampleAddOn: GetAddOnInfo() : name = %s\n", info.name.c_str());
73 * Dispatch table for global functions
76 Dali::AddOns::DispatchTable* GetGlobalDispatchTable() override
78 static Dali::AddOns::DispatchTable dispatchTable{};
79 if(dispatchTable.Empty())
81 dispatchTable["DoSum"] = DoSum;
82 dispatchTable["StringLen"] = StringLen;
83 dispatchTable["GetLifecycleStatus"] = GetLifecycleStatus;
84 dispatchTable["CreateInstance"] = CreateInstance;
86 return &dispatchTable;
92 void OnStart() override
97 void OnStop() override
102 void OnPause() override
107 void OnResume() override
113 * Dispatch table for instance functions
116 Dali::AddOns::DispatchTable* GetInstanceDispatchTable() override
118 static Dali::AddOns::DispatchTable dispatchTable{};
119 if(dispatchTable.Empty())
121 dispatchTable["InstanceCall"] = AddOnDataInstance::GetValueWithInstance;
123 return &dispatchTable;
127 REGISTER_ADDON_CLASS(TestDummyAddOn);