2 * Copyright (c) 2024 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/threading/thread.h>
20 #include <dali/public-api/dali-core.h>
22 using namespace std::chrono_literals;
25 #include <mesh-builder.h>
28 struct VertexBufferUpdater
34 void* lastPtr{nullptr};
36 size_t lastReturned{0};
39 VertexBufferUpdater() = default;
41 uint32_t UpdateVertices(void* ptr, size_t size)
43 diagnostics.success = true;
44 diagnostics.lastPtr = ptr;
45 diagnostics.lastSize = size;
46 diagnostics.lastReturned = returnSize;
47 diagnostics.counter++;
49 promise.set_value(diagnostics);
53 void SetCallbackReturnValue(size_t size)
60 promise = std::promise<Diagnostics>();
63 std::unique_ptr<VertexBufferUpdateCallback> CreateCallback()
65 return VertexBufferUpdateCallback::New(this, &VertexBufferUpdater::UpdateVertices);
68 Diagnostics GetValue()
70 auto value = promise.get_future().get();
72 // reset promise automatically
77 Diagnostics GetValueWithTimeout()
79 auto future = promise.get_future();
80 auto status = future.wait_for(1s);
81 if(status == std::future_status::ready)
84 return promise.get_future().get();
88 // reset promise automatically
89 Diagnostics failure{};
90 failure.success = false;
96 // fake-wait for two frames
97 auto status = promise.get_future().wait_for(32ms);
98 return status == std::future_status::ready;
101 Diagnostics diagnostics;
102 size_t returnSize{0u};
103 std::promise<Diagnostics> promise;
106 void vertexBuffer_test_startup(void)
108 test_return_value = TET_UNDEF;
111 void vertexBuffer_test_cleanup(void)
113 test_return_value = TET_PASS;
116 int UtcDaliVertexBufferNew01(void)
118 TestApplication application;
120 Property::Map texturedQuadVertexFormat;
121 texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
122 texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
124 VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
126 DALI_TEST_EQUALS((bool)vertexBuffer, true, TEST_LOCATION);
130 int UtcDaliVertexBufferNew02(void)
132 TestApplication application;
133 VertexBuffer vertexBuffer;
134 DALI_TEST_EQUALS((bool)vertexBuffer, false, TEST_LOCATION);
138 int UtcDaliVertexBufferDownCast01(void)
140 TestApplication application;
142 Property::Map texturedQuadVertexFormat;
143 texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
144 texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
146 VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
148 BaseHandle handle(vertexBuffer);
149 VertexBuffer vertexBuffer2 = VertexBuffer::DownCast(handle);
150 DALI_TEST_EQUALS((bool)vertexBuffer2, true, TEST_LOCATION);
154 int UtcDaliVertexBufferDownCast02(void)
156 TestApplication application;
158 Handle handle = Handle::New(); // Create a custom object
159 VertexBuffer vertexBuffer = VertexBuffer::DownCast(handle);
160 DALI_TEST_EQUALS((bool)vertexBuffer, false, TEST_LOCATION);
164 int UtcDaliVertexBufferCopyConstructor(void)
166 TestApplication application;
168 VertexBuffer vertexBuffer = CreateVertexBuffer();
170 VertexBuffer vertexBufferCopy(vertexBuffer);
172 DALI_TEST_EQUALS((bool)vertexBufferCopy, true, TEST_LOCATION);
173 DALI_TEST_EQUALS(vertexBufferCopy.GetSize(), 0u, TEST_LOCATION);
178 int UtcDaliVertexBufferAssignmentOperator(void)
180 TestApplication application;
182 VertexBuffer vertexBuffer = CreateVertexBuffer();
184 VertexBuffer vertexBuffer2;
185 DALI_TEST_EQUALS((bool)vertexBuffer2, false, TEST_LOCATION);
187 vertexBuffer2 = vertexBuffer;
188 DALI_TEST_EQUALS((bool)vertexBuffer2, true, TEST_LOCATION);
189 DALI_TEST_EQUALS(vertexBuffer2.GetSize(), 0u, TEST_LOCATION);
194 int UtcDaliVertexBufferMoveConstructor(void)
196 TestApplication application;
198 VertexBuffer vertexBuffer = CreateVertexBuffer();
199 DALI_TEST_CHECK(vertexBuffer);
200 DALI_TEST_EQUALS(1, vertexBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
201 DALI_TEST_EQUALS(0u, vertexBuffer.GetSize(), TEST_LOCATION);
203 VertexBuffer move = std::move(vertexBuffer);
204 DALI_TEST_CHECK(move);
205 DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
206 DALI_TEST_EQUALS(0u, move.GetSize(), TEST_LOCATION);
207 DALI_TEST_CHECK(!vertexBuffer);
212 int UtcDaliVertexBufferMoveAssignment(void)
214 TestApplication application;
216 VertexBuffer vertexBuffer = CreateVertexBuffer();
217 DALI_TEST_CHECK(vertexBuffer);
218 DALI_TEST_EQUALS(1, vertexBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
219 DALI_TEST_EQUALS(0u, vertexBuffer.GetSize(), TEST_LOCATION);
222 move = std::move(vertexBuffer);
223 DALI_TEST_CHECK(move);
224 DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
225 DALI_TEST_EQUALS(0u, move.GetSize(), TEST_LOCATION);
226 DALI_TEST_CHECK(!vertexBuffer);
231 int UtcDaliVertexBufferSetData01(void)
233 TestApplication application;
235 Property::Map texturedQuadVertexFormat;
236 texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
237 texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
240 VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
241 DALI_TEST_EQUALS((bool)vertexBuffer, true, TEST_LOCATION);
243 const float halfQuadSize = .5f;
244 struct TexturedQuadVertex
247 Vector2 textureCoordinates;
249 TexturedQuadVertex texturedQuadVertexData[4] = {
250 {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)},
251 {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)},
252 {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)},
253 {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}};
255 vertexBuffer.SetData(texturedQuadVertexData, 4);
257 Geometry geometry = Geometry::New();
258 geometry.AddVertexBuffer(vertexBuffer);
260 Shader shader = CreateShader();
261 Renderer renderer = Renderer::New(geometry, shader);
262 Actor actor = Actor::New();
263 actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
264 actor.AddRenderer(renderer);
265 application.GetScene().Add(actor);
267 auto& drawTrace = application.GetGlAbstraction().GetDrawTrace();
268 drawTrace.Enable(true);
270 application.SendNotification();
271 application.Render(0);
272 application.Render();
273 application.SendNotification();
275 const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
276 application.GetGlAbstraction().GetBufferDataCalls();
278 DALI_TEST_CHECK(drawTrace.FindMethod("DrawArrays"));
280 DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
282 DALI_TEST_EQUALS(bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION);
284 // end of scope to let the buffer and geometry die; do another notification and render to get the deletion processed
285 application.SendNotification();
286 application.Render(0);
291 int UtcDaliVertexBufferSetData02(void)
293 TestApplication application;
295 Property::Map texturedQuadVertexFormat;
296 texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
297 texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
299 VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
300 DALI_TEST_EQUALS((bool)vertexBuffer, true, TEST_LOCATION);
302 const float halfQuadSize = .5f;
303 struct TexturedQuadVertex
306 Vector2 textureCoordinates;
308 TexturedQuadVertex texturedQuadVertexData[4] = {
309 {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)},
310 {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)},
311 {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)},
312 {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}};
314 vertexBuffer.SetData(texturedQuadVertexData, 4);
316 Geometry geometry = Geometry::New();
317 geometry.AddVertexBuffer(vertexBuffer);
319 Shader shader = CreateShader();
320 Renderer renderer = Renderer::New(geometry, shader);
321 Actor actor = Actor::New();
322 actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
323 actor.AddRenderer(renderer);
324 application.GetScene().Add(actor);
326 application.SendNotification();
327 application.Render();
329 auto& gl = application.GetGlAbstraction();
330 const TestGlAbstraction::BufferSubDataCalls& bufferSubDataCalls = gl.GetBufferSubDataCalls();
331 const TestGlAbstraction::BufferDataCalls& bufferDataCalls = gl.GetBufferDataCalls();
333 DALI_TEST_EQUALS(bufferSubDataCalls.size(), 0u, TEST_LOCATION);
334 DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
335 DALI_TEST_EQUALS(bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION);
337 gl.ResetBufferDataCalls();
338 gl.ResetBufferSubDataCalls();
340 // Re-upload the data on the vertexBuffer
341 vertexBuffer.SetData(texturedQuadVertexData, 4);
343 application.SendNotification();
344 application.Render(0);
346 DALI_TEST_EQUALS(bufferSubDataCalls.size(), 0u, TEST_LOCATION);
347 DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
348 DALI_TEST_EQUALS(bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION);
353 int UtcDaliVertexBufferMapInitializerList(void)
355 TestApplication application;
357 Property::Map texturedQuadVertexFormat = Property::Map{{"aPosition", Property::VECTOR2},
358 {"aTexCoord", Property::VECTOR2},
359 {"aColor", Property::VECTOR4}};
363 VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
364 tet_result(TET_PASS);
366 catch(Dali::DaliException& e)
368 // Shouldn't assert any more
369 tet_result(TET_FAIL);
374 int UtcDaliVertexBufferInvalidTypeN01(void)
376 TestApplication application;
378 Property::Map texturedQuadVertexFormat;
379 texturedQuadVertexFormat["aPosition"] = Property::MAP;
380 texturedQuadVertexFormat["aVertexCoord"] = Property::STRING;
384 VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
385 tet_result(TET_FAIL);
387 catch(Dali::DaliException& e)
389 DALI_TEST_ASSERT(e, "Property::Type not supported in VertexBuffer", TEST_LOCATION);
394 int UtcDaliVertexBufferInvalidTypeN02(void)
396 TestApplication application;
398 Property::Map texturedQuadVertexFormat = Property::Map{{"aPosition", Property::MAP},
399 {"aTexCoord", Property::STRING},
400 {"aColor", Property::VECTOR4}};
404 VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
405 tet_result(TET_FAIL);
407 catch(Dali::DaliException& e)
409 DALI_TEST_ASSERT(e, "Property::Type not supported in VertexBuffer", TEST_LOCATION);
414 int UtcDaliVertexBufferSetDataNegative(void)
416 TestApplication application;
417 Dali::VertexBuffer instance;
421 unsigned long arg2(0u);
422 instance.SetData(arg1, arg2);
423 DALI_TEST_CHECK(false); // Should not get here
427 DALI_TEST_CHECK(true); // We expect an assert
432 int UtcDaliVertexBufferGetSizeNegative(void)
434 TestApplication application;
435 Dali::VertexBuffer instance;
439 DALI_TEST_CHECK(false); // Should not get here
443 DALI_TEST_CHECK(true); // We expect an assert
448 int UtcDaliVertexBufferSetDivisor(void)
450 TestApplication application;
452 Property::Map texturedQuadVertexFormat;
453 texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
454 texturedQuadVertexFormat["aTexCoord"] = Property::VECTOR2;
456 Property::Map instanceFormat{{"aTranslate", Property::VECTOR2}, {"aColor", Property::VECTOR4}};
458 VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
459 DALI_TEST_EQUALS((bool)vertexBuffer, true, TEST_LOCATION);
461 DALI_TEST_EQUALS(0, vertexBuffer.GetDivisor(), TEST_LOCATION);
463 VertexBuffer instanceBuffer = VertexBuffer::New(instanceFormat);
464 DALI_TEST_EQUALS((bool)instanceBuffer, true, TEST_LOCATION);
466 const float halfQuadSize = .5f;
467 struct TexturedQuadVertex
470 Vector2 textureCoordinates;
472 TexturedQuadVertex texturedQuadVertexData[4] = {
473 {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)},
474 {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)},
475 {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)},
476 {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}};
478 vertexBuffer.SetData(texturedQuadVertexData, 4);
486 InstanceData instanceData[] = {{Vector2(12, 33), Color::WHITE},
487 {Vector2(-2000, 43), Color::BLUE},
488 {Vector2(200, 43), Color::GREEN},
489 {Vector2(-243, 43), Color::TURQUOISE},
490 {Vector2(192, 43), Color::CYAN},
491 {Vector2(-2000, 43), Color::MAGENTA},
492 {Vector2(-292, 393), Color::BLUE},
493 {Vector2(-499, 128), Color::BLUE},
494 {Vector2(328, 43), Color::BLUE},
495 {Vector2(726, 43), Color::BLUE}};
496 instanceBuffer.SetData(instanceData, sizeof(instanceData) / sizeof(InstanceData));
497 instanceBuffer.SetDivisor(1);
498 DALI_TEST_EQUALS(1, instanceBuffer.GetDivisor(), TEST_LOCATION);
500 Geometry geometry = Geometry::New();
501 geometry.AddVertexBuffer(vertexBuffer);
502 geometry.AddVertexBuffer(instanceBuffer);
504 Shader shader = CreateShader();
505 Renderer renderer = Renderer::New(geometry, shader);
506 Actor actor = Actor::New();
507 actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
508 actor.AddRenderer(renderer);
509 application.GetScene().Add(actor);
511 TestGlAbstraction& gl = application.GetGlAbstraction();
512 auto& bufferTrace = gl.GetBufferTrace();
513 auto& drawTrace = gl.GetDrawTrace();
514 bufferTrace.Enable(true);
515 drawTrace.Enable(true);
517 application.SendNotification();
518 application.Render();
520 TraceCallStack::NamedParams params;
521 params["divisor"] << "1";
522 DALI_TEST_CHECK(bufferTrace.FindMethodAndParams("VertexAttribDivisor", params));
524 tet_infoline("Test that by default, instancing isn't used");
525 TraceCallStack::NamedParams params2;
526 params2["instanceCount"] << 0;
527 DALI_TEST_CHECK(!drawTrace.FindMethodAndGetParameters("DrawArraysInstanced", params2));
528 DALI_TEST_CHECK(drawTrace.FindMethod("DrawArrays"));
530 tet_infoline("Test that instancing is used if Renderer requests an instance count");
533 int instanceCount = sizeof(instanceData) / sizeof(InstanceData);
534 renderer["instanceCount"] = instanceCount;
535 application.SendNotification();
536 application.Render();
538 TraceCallStack::NamedParams params3;
539 params3["instanceCount"] << instanceCount;
540 DALI_TEST_CHECK(drawTrace.FindMethodAndGetParameters("DrawArraysInstanced", params3));
541 DALI_TEST_CHECK(!drawTrace.FindMethod("DrawArrays"));
545 int UtcDaliVertexBufferUpdateCallback(void)
547 TestApplication application;
549 // Create vertex buffer
550 VertexBuffer vertexBuffer = VertexBuffer::New(Property::Map() = {
551 {"aPosition", Property::Type::VECTOR2},
552 {"aTexCoord", Property::Type::VECTOR2}});
555 auto callback = std::make_unique<VertexBufferUpdater>();
556 vertexBuffer.SetVertexBufferUpdateCallback(callback->CreateCallback());
564 std::vector<Vertex> vertices;
566 vertexBuffer.SetData(vertices.data(), 16);
568 Geometry geometry = Geometry::New();
569 geometry.AddVertexBuffer(vertexBuffer);
570 Shader shader = CreateShader();
571 Renderer renderer = Renderer::New(geometry, shader);
572 Actor actor = Actor::New();
573 actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
574 actor.AddRenderer(renderer);
575 application.GetScene().Add(actor);
577 auto& gl = application.GetGlAbstraction();
578 auto& trace = gl.GetDrawTrace();
580 trace.EnableLogging(true);
582 callback->SetCallbackReturnValue(16 * sizeof(Vertex));
584 application.SendNotification();
585 application.Render();
587 auto value = callback->GetValue();
589 // Test whether callback ran
590 DALI_TEST_EQUALS(value.counter, 1, TEST_LOCATION);
591 DALI_TEST_EQUALS(value.lastSize, 16 * sizeof(Vertex), TEST_LOCATION);
592 DALI_TEST_EQUALS(value.lastReturned, 16 * sizeof(Vertex), TEST_LOCATION);
593 DALI_TEST_NOT_EQUALS(value.lastPtr, (void*)nullptr, 0, TEST_LOCATION);
595 // test whether draw call has been issued (return value indicates end of array to be drawn)
596 auto result = trace.FindMethod("DrawArrays");
597 DALI_TEST_EQUALS(result, true, TEST_LOCATION);
598 result = trace.FindMethodAndParams("DrawArrays", "4, 0, 16");
599 DALI_TEST_EQUALS(result, true, TEST_LOCATION);
601 // Test 2. Update and render only half of vertex buffer
602 callback->SetCallbackReturnValue(8 * sizeof(Vertex));
605 application.SendNotification();
606 application.Render();
608 value = callback->GetValue();
609 // Test whether callback ran
610 DALI_TEST_EQUALS(value.counter, 2, TEST_LOCATION);
611 DALI_TEST_EQUALS(value.lastSize, 16 * sizeof(Vertex), TEST_LOCATION);
612 DALI_TEST_EQUALS(value.lastReturned, 8 * sizeof(Vertex), TEST_LOCATION);
613 DALI_TEST_NOT_EQUALS(value.lastPtr, (void*)nullptr, 0, TEST_LOCATION);
614 result = trace.FindMethod("DrawArrays");
615 DALI_TEST_EQUALS(result, true, TEST_LOCATION);
616 result = trace.FindMethodAndParams("DrawArrays", "4, 0, 8");
617 DALI_TEST_EQUALS(result, true, TEST_LOCATION);
619 // Test 3. callback returns 0 elements to render, the draw call shouldn't happen.
620 callback->SetCallbackReturnValue(0);
623 application.SendNotification();
624 application.Render();
626 value = callback->GetValue();
627 // Test whether callback ran
628 DALI_TEST_EQUALS(value.counter, 3, TEST_LOCATION);
629 DALI_TEST_EQUALS(value.lastSize, 16 * sizeof(Vertex), TEST_LOCATION);
630 DALI_TEST_EQUALS(value.lastReturned, 0, TEST_LOCATION);
631 DALI_TEST_NOT_EQUALS(value.lastPtr, (void*)nullptr, 0, TEST_LOCATION);
632 result = trace.FindMethod("DrawArrays");
633 DALI_TEST_EQUALS(result, false, TEST_LOCATION);
635 // Test 4. removing callback, original behaviour should kick in
636 vertexBuffer.SetVertexBufferUpdateCallback(nullptr);
640 application.SendNotification();
641 application.Render();
643 auto valueReady = callback->IsValueReady();
644 DALI_TEST_EQUALS(valueReady, false, TEST_LOCATION);
645 DALI_TEST_EQUALS(callback->diagnostics.counter, 3, TEST_LOCATION);
646 result = trace.FindMethod("DrawArrays");
647 DALI_TEST_EQUALS(result, true, TEST_LOCATION);
648 result = trace.FindMethodAndParams("DrawArrays", "4, 0, 16");
649 DALI_TEST_EQUALS(result, true, TEST_LOCATION);
654 int UtcDaliSetAndRemoveVertexBufferUpdateCallback(void)
656 TestApplication application;
658 // Create vertex buffer
659 VertexBuffer vertexBuffer = VertexBuffer::New(Property::Map() = {
660 {"aPosition", Property::Type::VECTOR2},
661 {"aTexCoord", Property::Type::VECTOR2}});
664 auto callback = std::make_unique<VertexBufferUpdater>();
665 vertexBuffer.SetVertexBufferUpdateCallback(callback->CreateCallback());
673 std::vector<Vertex> vertices;
675 vertexBuffer.SetData(vertices.data(), 16);
677 Geometry geometry = Geometry::New();
678 geometry.AddVertexBuffer(vertexBuffer);
679 Shader shader = CreateShader();
680 Renderer renderer = Renderer::New(geometry, shader);
681 Actor actor = Actor::New();
682 actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
683 actor.AddRenderer(renderer);
684 application.GetScene().Add(actor);
686 auto& gl = application.GetGlAbstraction();
687 auto& trace = gl.GetDrawTrace();
689 trace.EnableLogging(true);
691 callback->SetCallbackReturnValue(16 * sizeof(Vertex));
693 application.SendNotification();
694 application.Render();
696 auto value = callback->GetValue();
698 // Test whether callback ran
699 DALI_TEST_EQUALS(value.counter, 1, TEST_LOCATION);
700 DALI_TEST_EQUALS(value.lastSize, 16 * sizeof(Vertex), TEST_LOCATION);
701 DALI_TEST_EQUALS(value.lastReturned, 16 * sizeof(Vertex), TEST_LOCATION);
702 DALI_TEST_NOT_EQUALS(value.lastPtr, (void*)nullptr, 0, TEST_LOCATION);
704 // test whether draw call has been issued (return value indicates end of array to be drawn)
705 auto result = trace.FindMethod("DrawArrays");
706 DALI_TEST_EQUALS(result, true, TEST_LOCATION);
707 result = trace.FindMethodAndParams("DrawArrays", "4, 0, 16");
708 DALI_TEST_EQUALS(result, true, TEST_LOCATION);
710 // Test 2. Update and render only half of vertex buffer
711 callback->SetCallbackReturnValue(8 * sizeof(Vertex));
714 // Remove the callback
715 vertexBuffer.ClearVertexBufferUpdateCallback();
717 application.SendNotification();
718 application.Render();
720 // Use 1sec timeout as callback won't be executed and future won't be filled
721 value = callback->GetValueWithTimeout();
722 // Test whether callback ran
723 DALI_TEST_EQUALS(value.success, false, TEST_LOCATION);
728 int UtcDaliVertexBufferDestructWorkerThreadN(void)
730 TestApplication application;
731 tet_infoline("UtcDaliAnimationDestructWorkerThreadN Test, for line coverage");
735 class TestThread : public Thread
740 tet_printf("Run TestThread\n");
741 // Destruct at worker thread.
742 mVertexBuffer.Reset();
745 Dali::VertexBuffer mVertexBuffer;
749 Dali::VertexBuffer vertexBuffer = VertexBuffer::New(Property::Map() = {
750 {"aPosition", Property::Type::VECTOR2},
751 {"aTexCoord", Property::Type::VECTOR2}});
752 thread.mVertexBuffer = std::move(vertexBuffer);
753 vertexBuffer.Reset();
764 DALI_TEST_CHECK(true);