1 #ifndef TEST_SYNC_IMPLEMENTATION_H
2 #define TEST_SYNC_IMPLEMENTATION_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
27 #include <dali/graphics-api/graphics-sync-object-create-info.h>
28 #include <dali/graphics-api/graphics-sync-object.h>
29 #include <dali/integration-api/core.h>
30 #include <dali/integration-api/graphics-sync-abstraction.h>
32 #include "test-trace-call-stack.h"
36 class TestGraphicsSyncImplementation;
38 class TestSyncObject : public Integration::GraphicsSyncAbstraction::SyncObject
41 TestSyncObject(TraceCallStack& trace);
42 ~TestSyncObject() override;
43 bool IsSynced() override;
45 TraceCallStack& mTrace;
49 * Class to emulate the gpu sync functions with tracing
51 class TestGraphicsSyncImplementation : public Integration::GraphicsSyncAbstraction
57 TestGraphicsSyncImplementation();
62 virtual ~TestGraphicsSyncImplementation();
65 * Initialize the sync objects
70 * Create a sync object that can be polled
72 GraphicsSyncAbstraction::SyncObject* CreateSyncObject() override;
75 * Destroy a sync object
77 void DestroySyncObject(GraphicsSyncAbstraction::SyncObject* syncObject) override;
79 public: // TEST FUNCTIONS
80 GraphicsSyncAbstraction::SyncObject* GetLastSyncObject();
83 * Test method to trigger the object sync behaviour.
85 * @param[in] sync The sync value to set
87 void SetObjectSynced(GraphicsSyncAbstraction::SyncObject* syncObject, bool sync);
92 void EnableTrace(bool enable);
95 * Reset the trace callstack
100 * Get the trace object (allows test case to find methods on it)
102 TraceCallStack& GetTrace();
105 * Get the number of sync objects
107 * @return the number of sync objects
109 int32_t GetNumberOfSyncObjects();
111 TestGraphicsSyncImplementation(const TestGraphicsSyncImplementation&) = delete;
112 TestGraphicsSyncImplementation& operator=(const TestGraphicsSyncImplementation&) = delete;
115 typedef std::vector<TestSyncObject*> SyncContainer;
116 typedef SyncContainer::iterator SyncIter;
117 SyncContainer mSyncObjects; ///< The sync objects
118 TraceCallStack mTrace{true, "gl"}; ///< the trace call stack for testing
123 #endif // TEST_GL_SYNC_ABSTRACTION_H