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.
19 #include <dali/devel-api/addons/addon-base.h>
20 #include <dali-test-suite-utils.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
64 void GetAddOnInfo( Dali::AddOnInfo& info ) override
66 info.type = Dali::AddOnType::GENERIC;
67 info.name = "SampleAddOn";
68 info.version = Dali::DALI_ADDON_VERSION( 1, 0, 0 );
70 tet_printf( "SampleAddOn: GetAddOnInfo() : name = %s\n", info.name.c_str());
74 * Dispatch table for global functions
77 Dali::AddOns::DispatchTable* GetGlobalDispatchTable() override
79 static Dali::AddOns::DispatchTable dispatchTable{};
80 if( dispatchTable.Empty() )
82 dispatchTable["DoSum"] = DoSum;
83 dispatchTable["StringLen"] = StringLen;
84 dispatchTable["GetLifecycleStatus"] = GetLifecycleStatus;
85 dispatchTable["CreateInstance"] = CreateInstance;
88 return &dispatchTable;
94 void OnStart() override
99 void OnStop() override
104 void OnPause() override
109 void OnResume() override
115 * Dispatch table for instance functions
118 Dali::AddOns::DispatchTable* GetInstanceDispatchTable() override
120 static Dali::AddOns::DispatchTable dispatchTable{};
121 if( dispatchTable.Empty() )
123 dispatchTable["InstanceCall"] = AddOnDataInstance::GetValueWithInstance;
125 return &dispatchTable;
129 REGISTER_ADDON_CLASS( TestDummyAddOn );