2 * Copyright (c) 2021 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/public-api/dali-core.h>
23 #include <mesh-builder.h>
25 void geometry_test_startup(void)
27 test_return_value = TET_UNDEF;
30 void geometry_test_cleanup(void)
32 test_return_value = TET_PASS;
37 struct TexturedQuadVertex
40 Vector2 textureCoordinates;
43 VertexBuffer CreateVertexBuffer(const std::string& aPosition, const std::string& aTexCoord)
45 const float halfQuadSize = .5f;
46 TexturedQuadVertex texturedQuadVertexData[4] = {
47 {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)},
48 {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)},
49 {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)},
50 {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}};
52 Property::Map vertexFormat;
53 vertexFormat[aPosition] = Property::VECTOR2;
54 vertexFormat[aTexCoord] = Property::VECTOR2;
56 VertexBuffer vertexData = VertexBuffer::New(vertexFormat);
57 vertexData.SetData(texturedQuadVertexData, 4);
64 int UtcDaliGeometryNew01(void)
66 TestApplication application;
68 Geometry geometry = Geometry::New();
70 DALI_TEST_EQUALS((bool)geometry, true, TEST_LOCATION);
74 int UtcDaliGeometryNew02(void)
76 TestApplication application;
78 DALI_TEST_EQUALS((bool)geometry, false, TEST_LOCATION);
82 int UtcDaliGeometryCopyConstructor(void)
84 TestApplication application;
86 Geometry geometry = Geometry::New();
88 Geometry geometryCopy(geometry);
90 DALI_TEST_EQUALS((bool)geometryCopy, true, TEST_LOCATION);
94 int UtcDaliGeometryAssignmentOperator(void)
96 TestApplication application;
98 Geometry geometry = Geometry::New();
101 DALI_TEST_EQUALS((bool)geometry2, false, TEST_LOCATION);
103 geometry2 = geometry;
104 DALI_TEST_EQUALS((bool)geometry2, true, TEST_LOCATION);
109 int UtcDaliGeometryMoveConstructor(void)
111 TestApplication application;
113 Geometry geometry = Geometry::New();
114 DALI_TEST_CHECK(geometry);
115 DALI_TEST_EQUALS(1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION);
116 DALI_TEST_EQUALS(0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
118 VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
119 geometry.AddVertexBuffer(vertexBuffer);
120 DALI_TEST_EQUALS(1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
122 Geometry move = std::move(geometry);
123 DALI_TEST_CHECK(move);
124 DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
125 DALI_TEST_EQUALS(1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION);
126 DALI_TEST_CHECK(!geometry);
131 int UtcDaliGeometryMoveAssignment(void)
133 TestApplication application;
135 Geometry geometry = Geometry::New();
136 DALI_TEST_CHECK(geometry);
137 DALI_TEST_EQUALS(1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION);
138 DALI_TEST_EQUALS(0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
140 VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
141 geometry.AddVertexBuffer(vertexBuffer);
142 DALI_TEST_EQUALS(1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
145 move = std::move(geometry);
146 DALI_TEST_CHECK(move);
147 DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
148 DALI_TEST_EQUALS(1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION);
149 DALI_TEST_CHECK(!geometry);
154 int UtcDaliGeometryDownCast01(void)
156 TestApplication application;
158 Geometry geometry = Geometry::New();
160 BaseHandle handle(geometry);
161 Geometry geometry2 = Geometry::DownCast(handle);
162 DALI_TEST_EQUALS((bool)geometry2, true, TEST_LOCATION);
166 int UtcDaliGeometryDownCast02(void)
168 TestApplication application;
170 Handle handle = Handle::New(); // Create a custom object
171 Geometry geometry = Geometry::DownCast(handle);
172 DALI_TEST_EQUALS((bool)geometry, false, TEST_LOCATION);
176 int UtcDaliGeometryAddVertexBuffer(void)
178 TestApplication application;
180 tet_infoline("Test AddVertexBuffer");
181 auto& bufferTrace = application.GetGlAbstraction().GetBufferTrace();
182 bufferTrace.Enable(true);
183 bufferTrace.EnableLogging(true);
185 VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1");
186 Geometry geometry = Geometry::New();
187 geometry.AddVertexBuffer(vertexBuffer1);
189 Shader shader = CreateShader();
190 Renderer renderer = Renderer::New(geometry, shader);
191 Actor actor = Actor::New();
192 actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
193 actor.AddRenderer(renderer);
194 application.GetScene().Add(actor);
196 application.SendNotification();
197 application.Render(0);
198 application.Render();
199 application.SendNotification();
202 const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
203 application.GetGlAbstraction().GetBufferDataCalls();
205 DALI_TEST_EQUALS(bufferDataCalls.size(), 3u, TEST_LOCATION);
207 DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
210 // add the second vertex buffer
211 application.GetGlAbstraction().ResetBufferDataCalls();
213 VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2");
214 geometry.AddVertexBuffer(vertexBuffer2);
215 application.SendNotification();
216 application.Render(0);
217 application.Render();
218 application.SendNotification();
221 const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
222 application.GetGlAbstraction().GetBufferDataCalls();
224 //Check that only the new buffer gets uploaded
225 DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
226 DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
232 int UtcDaliGeometryGetNumberOfVertexBuffers(void)
234 TestApplication application;
235 auto& bufferTrace = application.GetGlAbstraction().GetBufferTrace();
236 bufferTrace.Enable(true);
237 bufferTrace.EnableLogging(true);
239 tet_infoline("Test GetNumberOfVertexBuffers");
240 VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1");
241 VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2");
242 VertexBuffer vertexBuffer3 = CreateVertexBuffer("aPosition3", "aTexCoord3");
244 Geometry geometry = Geometry::New();
245 geometry.AddVertexBuffer(vertexBuffer1);
246 DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION);
248 geometry.AddVertexBuffer(vertexBuffer2);
249 geometry.AddVertexBuffer(vertexBuffer3);
250 DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 3u, TEST_LOCATION);
252 geometry.RemoveVertexBuffer(2u);
253 DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 2u, TEST_LOCATION);
258 int UtcDaliGeometryRemoveVertexBuffer(void)
260 TestApplication application;
261 auto& bufferTrace = application.GetGlAbstraction().GetBufferTrace();
262 bufferTrace.Enable(true);
263 bufferTrace.EnableLogging(true);
265 tet_infoline("Test RemoveVertexBuffer");
267 VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1");
268 VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2");
270 Geometry geometry = Geometry::New();
271 geometry.AddVertexBuffer(vertexBuffer1);
273 Shader shader = CreateShader();
274 Renderer renderer = Renderer::New(geometry, shader);
275 Actor actor = Actor::New();
276 actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
277 actor.AddRenderer(renderer);
278 application.GetScene().Add(actor);
280 DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION);
282 geometry.RemoveVertexBuffer(0);
283 geometry.AddVertexBuffer(vertexBuffer2);
284 DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION);
286 geometry.RemoveVertexBuffer(0);
287 DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 0u, TEST_LOCATION);
289 //Todo: test by checking the BufferDataCalls
290 // make sure the vertex buffer in actually removed from gl
295 int UtcDaliGeometrySetIndexBuffer(void)
297 TestApplication application;
298 auto& bufferTrace = application.GetGlAbstraction().GetBufferTrace();
299 bufferTrace.Enable(true);
300 bufferTrace.EnableLogging(true);
302 tet_infoline("Test SetIndexBuffer");
304 VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
306 Geometry geometry = Geometry::New();
307 geometry.AddVertexBuffer(vertexBuffer);
309 Shader shader = CreateShader();
310 Renderer renderer = Renderer::New(geometry, shader);
311 Actor actor = Actor::New();
312 actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
313 actor.AddRenderer(renderer);
314 application.GetScene().Add(actor);
316 application.SendNotification();
317 application.Render(0);
318 application.Render();
319 application.SendNotification();
322 const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
323 application.GetGlAbstraction().GetBufferDataCalls();
325 DALI_TEST_EQUALS(bufferDataCalls.size(), 3u, TEST_LOCATION);
327 DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
331 application.GetGlAbstraction().ResetBufferDataCalls();
333 const unsigned short indexData[6] = {0, 3, 1, 0, 2, 3};
334 geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0]));
335 application.SendNotification();
336 application.Render(0);
337 application.Render();
338 application.SendNotification();
341 const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
342 application.GetGlAbstraction().GetBufferDataCalls();
344 //Only the index buffer should be uploaded
345 DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
347 // should be unsigned short instead of unsigned int
348 DALI_TEST_EQUALS(bufferDataCalls[0], 6 * sizeof(unsigned short), TEST_LOCATION);
354 int UtcDaliGeometrySetIndexBuffer32Bits(void)
356 TestApplication application;
357 auto& bufferTrace = application.GetGlAbstraction().GetBufferTrace();
358 bufferTrace.Enable(true);
359 bufferTrace.EnableLogging(true);
361 tet_infoline("Test SetIndexBuffer 32Bits");
363 VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
365 Geometry geometry = Geometry::New();
366 geometry.AddVertexBuffer(vertexBuffer);
368 Shader shader = CreateShader();
369 Renderer renderer = Renderer::New(geometry, shader);
370 Actor actor = Actor::New();
371 actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
372 actor.AddRenderer(renderer);
373 application.GetScene().Add(actor);
375 application.SendNotification();
376 application.Render(0);
377 application.Render();
378 application.SendNotification();
381 const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
382 application.GetGlAbstraction().GetBufferDataCalls();
384 DALI_TEST_EQUALS(bufferDataCalls.size(), 3u, TEST_LOCATION);
386 DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
390 application.GetGlAbstraction().ResetBufferDataCalls();
392 const uint32_t indexData32Bits[6] = {0, 3, 1, 0, 2, 3};
393 geometry.SetIndexBuffer(indexData32Bits, sizeof(indexData32Bits) / sizeof(indexData32Bits[0]));
394 application.SendNotification();
395 application.Render(0);
396 application.Render();
397 application.SendNotification();
400 const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
401 application.GetGlAbstraction().GetBufferDataCalls();
403 //Only the index buffer should be uploaded
404 DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
406 // should be unsigned int instead of unsigned short
407 DALI_TEST_EQUALS(bufferDataCalls[0], 6 * sizeof(uint32_t), TEST_LOCATION);
413 int UtcDaliGeometrySetGetGeometryType01(void)
415 TestApplication application;
416 auto& bufferTrace = application.GetGlAbstraction().GetBufferTrace();
417 bufferTrace.Enable(true);
418 bufferTrace.EnableLogging(true);
420 tet_infoline("Test SetType and GetType: without index buffer");
422 unsigned int numVertex = 4u;
423 VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
425 Geometry geometry = Geometry::New();
426 geometry.AddVertexBuffer(vertexBuffer);
428 Shader shader = CreateShader();
429 Renderer renderer = Renderer::New(geometry, shader);
430 Actor actor = Actor::New();
431 actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
432 actor.AddRenderer(renderer);
433 application.GetScene().Add(actor);
435 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
436 TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
438 /****************************************************/
439 // Default (TRIANGLES), no index buffer
441 drawTrace.Enable(true);
442 application.SendNotification();
443 application.Render(0);
444 application.Render();
445 application.SendNotification();
446 drawTrace.Enable(false);
448 // Test the default geometry type is GL_TRIANGLE
449 // no index buffer, call glDrawArrays,
450 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
451 std::stringstream out;
452 out << GL_TRIANGLES << ", " << 0 << ", " << numVertex;
453 DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
455 DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
457 /*********************************************************/
458 // LINES, no index buffer
459 geometry.SetType(Geometry::LINES);
462 drawTrace.Enable(true);
463 application.SendNotification();
464 application.Render(0);
465 application.Render();
466 application.SendNotification();
467 drawTrace.Enable(false);
469 // geometry type is set as GL_LINES
470 // no index buffer, call glDrawArrays,
471 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
473 out << GL_LINES << ", " << 0 << ", " << numVertex;
474 DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
476 DALI_TEST_EQUALS(geometry.GetType(), Geometry::LINES, TEST_LOCATION);
478 /*****************************************************/
480 geometry.SetType(Geometry::POINTS);
483 drawTrace.Enable(true);
484 application.SendNotification();
485 application.Render(0);
486 application.Render();
487 application.SendNotification();
488 drawTrace.Enable(false);
490 // geometry type is set as GL_POINTS
491 // no index buffer, call glDrawArrays,
492 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
494 out << GL_POINTS << ", " << 0 << ", " << numVertex;
495 DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
497 DALI_TEST_EQUALS(geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
499 /*****************************************************/
500 //TRIANGLE_STRIP, no index buffer
501 geometry.SetType(Geometry::TRIANGLE_STRIP);
504 drawTrace.Enable(true);
505 application.SendNotification();
506 application.Render(0);
507 application.Render();
508 application.SendNotification();
509 drawTrace.Enable(false);
511 // geometry type is set as GL_TRIANGLE_STRIP
512 // no index buffer, call glDrawArrays,
513 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
515 out << GL_TRIANGLE_STRIP << ", " << 0 << ", " << numVertex;
516 DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
518 DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
520 /*****************************************************/
521 //TRIANGLE_FAN, no index buffer
522 geometry.SetType(Geometry::TRIANGLE_FAN);
525 drawTrace.Enable(true);
526 application.SendNotification();
527 application.Render(0);
528 application.Render();
529 application.SendNotification();
530 drawTrace.Enable(false);
532 // geometry type is set as GL_TRIANGLE_FAN
533 // no index buffer, call glDrawArrays,
534 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
536 out << GL_TRIANGLE_FAN << ", " << 0 << ", " << numVertex;
537 DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
539 DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
544 int UtcDaliGeometrySetGetGeometryType02(void)
546 TestApplication application;
547 auto& bufferTrace = application.GetGlAbstraction().GetBufferTrace();
548 bufferTrace.Enable(true);
549 bufferTrace.EnableLogging(true);
551 tet_infoline("Test SetType and GetType: with index buffer");
553 unsigned int numVertex = 4u;
554 unsigned int numIndex = 6u; // 6 unsigned short
555 VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
557 Geometry geometry = Geometry::New();
558 geometry.AddVertexBuffer(vertexBuffer);
559 const unsigned short indexData[6] = {0, 3, 1, 0, 2, 3};
560 geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0]));
562 Shader shader = CreateShader();
563 Renderer renderer = Renderer::New(geometry, shader);
564 Actor actor = Actor::New();
565 actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
566 actor.AddRenderer(renderer);
567 application.GetScene().Add(actor);
569 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
570 TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
572 /****************************************************/
573 // Default (TRIANGLES), with index buffer
575 drawTrace.Enable(true);
576 application.SendNotification();
577 application.Render(0);
578 application.Render();
579 application.SendNotification();
580 drawTrace.Enable(false);
582 // Test the default geometry type is GL_TRIANGLE
583 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
584 std::stringstream out;
585 out << GL_TRIANGLES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
587 DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
589 DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
591 /*********************************************************/
592 // LINES, with index buffer
593 geometry.SetType(Geometry::LINES);
596 drawTrace.Enable(true);
597 application.SendNotification();
598 application.Render(0);
599 application.Render();
600 application.SendNotification();
601 drawTrace.Enable(false);
603 // geometry type is set as GL_LINES
604 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
606 out << GL_LINES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
608 DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
610 DALI_TEST_EQUALS(geometry.GetType(), Geometry::LINES, TEST_LOCATION);
612 /*****************************************************/
614 geometry.SetType(Geometry::POINTS);
617 drawTrace.Enable(true);
618 application.SendNotification();
619 application.Render(0);
620 application.Render();
621 application.SendNotification();
622 drawTrace.Enable(false);
624 // geometry type is set as GL_POINTS
625 // As Points does not use the index buffer, call glDrawArrays,
626 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
628 out << GL_POINTS << ", " << 0 << ", " << numVertex;
629 DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
631 DALI_TEST_EQUALS(geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
633 /*****************************************************/
635 geometry.SetType(Geometry::TRIANGLE_STRIP);
638 drawTrace.Enable(true);
639 application.SendNotification();
640 application.Render(0);
641 application.Render();
642 application.SendNotification();
643 drawTrace.Enable(false);
645 // geometry type is set as GL_TRIANGLE_STRIP
646 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
648 out << GL_TRIANGLE_STRIP << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
650 DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
652 DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
654 /*****************************************************/
656 geometry.SetType(Geometry::TRIANGLE_FAN);
659 drawTrace.Enable(true);
660 application.SendNotification();
661 application.Render(0);
662 application.Render();
663 application.SendNotification();
664 drawTrace.Enable(false);
666 // geometry type is set as GL_TRIANGLE_FAN
667 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
669 out << GL_TRIANGLE_FAN << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
671 DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
673 DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
678 int UtcDaliGeometrySetIndexBufferNegative(void)
680 TestApplication application;
681 Dali::Geometry instance;
684 unsigned short* arg1(nullptr);
685 unsigned long arg2(0u);
686 instance.SetIndexBuffer(arg1, arg2);
687 DALI_TEST_CHECK(false); // Should not get here
691 DALI_TEST_CHECK(true); // We expect an assert
696 int UtcDaliGeometryAddVertexBufferNegative(void)
698 TestApplication application;
699 Dali::Geometry instance;
702 Dali::VertexBuffer arg1;
703 instance.AddVertexBuffer(arg1);
704 DALI_TEST_CHECK(false); // Should not get here
708 DALI_TEST_CHECK(true); // We expect an assert
713 int UtcDaliGeometryRemoveVertexBufferNegative(void)
715 TestApplication application;
716 Dali::Geometry instance;
719 unsigned long arg1(0u);
720 instance.RemoveVertexBuffer(arg1);
721 DALI_TEST_CHECK(false); // Should not get here
725 DALI_TEST_CHECK(true); // We expect an assert
730 int UtcDaliGeometrySetTypeNegative(void)
732 TestApplication application;
733 Dali::Geometry instance;
736 Dali::Geometry::Type arg1(Geometry::POINTS);
737 instance.SetType(arg1);
738 DALI_TEST_CHECK(false); // Should not get here
742 DALI_TEST_CHECK(true); // We expect an assert
747 int UtcDaliGeometryGetNumberOfVertexBuffersNegative(void)
749 TestApplication application;
750 Dali::Geometry instance;
753 instance.GetNumberOfVertexBuffers();
754 DALI_TEST_CHECK(false); // Should not get here
758 DALI_TEST_CHECK(true); // We expect an assert
763 int UtcDaliGeometryGetTypeNegative(void)
765 TestApplication application;
766 Dali::Geometry instance;
770 DALI_TEST_CHECK(false); // Should not get here
774 DALI_TEST_CHECK(true); // We expect an assert