[Tizen] Add Integration API to Create public event type
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Geometry.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include <dali-test-suite-utils.h>
19 #include <dali/public-api/dali-core.h>
20
21 using namespace Dali;
22
23 #include <mesh-builder.h>
24
25 void geometry_test_startup(void)
26 {
27   test_return_value = TET_UNDEF;
28 }
29
30 void geometry_test_cleanup(void)
31 {
32   test_return_value = TET_PASS;
33 }
34
35 namespace
36 {
37 struct TexturedQuadVertex
38 {
39   Vector2 position;
40   Vector2 textureCoordinates;
41 };
42
43 VertexBuffer CreateVertexBuffer(const std::string& aPosition, const std::string& aTexCoord)
44 {
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)}};
51
52   Property::Map vertexFormat;
53   vertexFormat[aPosition] = Property::VECTOR2;
54   vertexFormat[aTexCoord] = Property::VECTOR2;
55
56   VertexBuffer vertexData = VertexBuffer::New(vertexFormat);
57   vertexData.SetData(texturedQuadVertexData, 4);
58
59   return vertexData;
60 }
61
62 } // namespace
63
64 int UtcDaliGeometryNew01(void)
65 {
66   TestApplication application;
67
68   Geometry geometry = Geometry::New();
69
70   DALI_TEST_EQUALS((bool)geometry, true, TEST_LOCATION);
71   END_TEST;
72 }
73
74 int UtcDaliGeometryNew02(void)
75 {
76   TestApplication application;
77   Geometry        geometry;
78   DALI_TEST_EQUALS((bool)geometry, false, TEST_LOCATION);
79   END_TEST;
80 }
81
82 int UtcDaliGeometryCopyConstructor(void)
83 {
84   TestApplication application;
85
86   Geometry geometry = Geometry::New();
87
88   Geometry geometryCopy(geometry);
89
90   DALI_TEST_EQUALS((bool)geometryCopy, true, TEST_LOCATION);
91   END_TEST;
92 }
93
94 int UtcDaliGeometryAssignmentOperator(void)
95 {
96   TestApplication application;
97
98   Geometry geometry = Geometry::New();
99
100   Geometry geometry2;
101   DALI_TEST_EQUALS((bool)geometry2, false, TEST_LOCATION);
102
103   geometry2 = geometry;
104   DALI_TEST_EQUALS((bool)geometry2, true, TEST_LOCATION);
105
106   END_TEST;
107 }
108
109 int UtcDaliGeometryMoveConstructor(void)
110 {
111   TestApplication application;
112
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);
117
118   VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
119   geometry.AddVertexBuffer(vertexBuffer);
120   DALI_TEST_EQUALS(1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
121
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);
127
128   END_TEST;
129 }
130
131 int UtcDaliGeometryMoveAssignment(void)
132 {
133   TestApplication application;
134
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);
139
140   VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
141   geometry.AddVertexBuffer(vertexBuffer);
142   DALI_TEST_EQUALS(1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
143
144   Geometry move;
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);
150
151   END_TEST;
152 }
153
154 int UtcDaliGeometryDownCast01(void)
155 {
156   TestApplication application;
157
158   Geometry geometry = Geometry::New();
159
160   BaseHandle handle(geometry);
161   Geometry   geometry2 = Geometry::DownCast(handle);
162   DALI_TEST_EQUALS((bool)geometry2, true, TEST_LOCATION);
163   END_TEST;
164 }
165
166 int UtcDaliGeometryDownCast02(void)
167 {
168   TestApplication application;
169
170   Handle   handle   = Handle::New(); // Create a custom object
171   Geometry geometry = Geometry::DownCast(handle);
172   DALI_TEST_EQUALS((bool)geometry, false, TEST_LOCATION);
173   END_TEST;
174 }
175
176 int UtcDaliGeometryAddVertexBuffer(void)
177 {
178   TestApplication application;
179
180   tet_infoline("Test AddVertexBuffer");
181
182   VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1");
183   Geometry     geometry      = Geometry::New();
184   geometry.AddVertexBuffer(vertexBuffer1);
185
186   Shader   shader   = CreateShader();
187   Renderer renderer = Renderer::New(geometry, shader);
188   Actor    actor    = Actor::New();
189   actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
190   actor.AddRenderer(renderer);
191   application.GetScene().Add(actor);
192
193   application.SendNotification();
194   application.Render(0);
195   application.Render();
196   application.SendNotification();
197
198   {
199     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
200       application.GetGlAbstraction().GetBufferDataCalls();
201
202     DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
203
204     DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
205   }
206
207   // add the second vertex buffer
208   application.GetGlAbstraction().ResetBufferDataCalls();
209
210   VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2");
211   geometry.AddVertexBuffer(vertexBuffer2);
212   application.SendNotification();
213   application.Render(0);
214   application.Render();
215   application.SendNotification();
216
217   {
218     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
219       application.GetGlAbstraction().GetBufferDataCalls();
220
221     //Check that only the new buffer gets uploaded
222     DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
223     DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
224   }
225
226   END_TEST;
227 }
228
229 int UtcDaliGeometryGetNumberOfVertexBuffers(void)
230 {
231   TestApplication application;
232
233   tet_infoline("Test GetNumberOfVertexBuffers");
234   VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1");
235   VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2");
236   VertexBuffer vertexBuffer3 = CreateVertexBuffer("aPosition3", "aTexCoord3");
237
238   Geometry geometry = Geometry::New();
239   geometry.AddVertexBuffer(vertexBuffer1);
240   DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION);
241
242   geometry.AddVertexBuffer(vertexBuffer2);
243   geometry.AddVertexBuffer(vertexBuffer3);
244   DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 3u, TEST_LOCATION);
245
246   geometry.RemoveVertexBuffer(2u);
247   DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 2u, TEST_LOCATION);
248
249   END_TEST;
250 }
251
252 int UtcDaliGeometryRemoveVertexBuffer(void)
253 {
254   TestApplication application;
255
256   tet_infoline("Test RemoveVertexBuffer");
257
258   VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1");
259   VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2");
260
261   Geometry geometry = Geometry::New();
262   geometry.AddVertexBuffer(vertexBuffer1);
263
264   Shader   shader   = CreateShader();
265   Renderer renderer = Renderer::New(geometry, shader);
266   Actor    actor    = Actor::New();
267   actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
268   actor.AddRenderer(renderer);
269   application.GetScene().Add(actor);
270
271   DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION);
272
273   geometry.RemoveVertexBuffer(0);
274   geometry.AddVertexBuffer(vertexBuffer2);
275   DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION);
276
277   geometry.RemoveVertexBuffer(0);
278   DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 0u, TEST_LOCATION);
279
280   //Todo: test by checking the BufferDataCalls
281   // make sure the vertex buffer in actually removed from gl
282
283   END_TEST;
284 }
285
286 int UtcDaliGeometrySetIndexBuffer(void)
287 {
288   TestApplication application;
289
290   tet_infoline("Test SetIndexBuffer");
291
292   VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
293
294   Geometry geometry = Geometry::New();
295   geometry.AddVertexBuffer(vertexBuffer);
296
297   Shader   shader   = CreateShader();
298   Renderer renderer = Renderer::New(geometry, shader);
299   Actor    actor    = Actor::New();
300   actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
301   actor.AddRenderer(renderer);
302   application.GetScene().Add(actor);
303
304   application.SendNotification();
305   application.Render(0);
306   application.Render();
307   application.SendNotification();
308
309   {
310     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
311       application.GetGlAbstraction().GetBufferDataCalls();
312
313     DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
314
315     DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
316   }
317
318   // Set index buffer
319   application.GetGlAbstraction().ResetBufferDataCalls();
320
321   const unsigned short indexData[6] = {0, 3, 1, 0, 2, 3};
322   geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0]));
323   application.SendNotification();
324   application.Render(0);
325   application.Render();
326   application.SendNotification();
327
328   {
329     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
330       application.GetGlAbstraction().GetBufferDataCalls();
331
332     //Only the index buffer should be uploaded
333     DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
334
335     // should be unsigned short instead of unsigned int
336     DALI_TEST_EQUALS(bufferDataCalls[0], 6 * sizeof(unsigned short), TEST_LOCATION);
337   }
338
339   END_TEST;
340 }
341
342 int UtcDaliGeometrySetGetGeometryType01(void)
343 {
344   TestApplication application;
345
346   tet_infoline("Test SetType and GetType: without index buffer");
347
348   unsigned int numVertex    = 4u;
349   VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
350
351   Geometry geometry = Geometry::New();
352   geometry.AddVertexBuffer(vertexBuffer);
353
354   Shader   shader   = CreateShader();
355   Renderer renderer = Renderer::New(geometry, shader);
356   Actor    actor    = Actor::New();
357   actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
358   actor.AddRenderer(renderer);
359   application.GetScene().Add(actor);
360
361   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
362   TraceCallStack&    drawTrace     = glAbstraction.GetDrawTrace();
363
364   /****************************************************/
365   // Default (TRIANGLES), no index buffer
366   drawTrace.Reset();
367   drawTrace.Enable(true);
368   application.SendNotification();
369   application.Render(0);
370   application.Render();
371   application.SendNotification();
372   drawTrace.Enable(false);
373
374   // Test the default geometry type is GL_TRIANGLE
375   // no index buffer, call glDrawArrays,
376   DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
377   std::stringstream out;
378   out << GL_TRIANGLES << ", " << 0 << ", " << numVertex;
379   DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
380
381   DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
382
383   /*********************************************************/
384   // LINES, no index buffer
385   geometry.SetType(Geometry::LINES);
386
387   drawTrace.Reset();
388   drawTrace.Enable(true);
389   application.SendNotification();
390   application.Render(0);
391   application.Render();
392   application.SendNotification();
393   drawTrace.Enable(false);
394
395   // geometry type is set as GL_LINES
396   // no index buffer, call glDrawArrays,
397   DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
398   out.str("");
399   out << GL_LINES << ", " << 0 << ", " << numVertex;
400   DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
401
402   DALI_TEST_EQUALS(geometry.GetType(), Geometry::LINES, TEST_LOCATION);
403
404   /*****************************************************/
405   //POINTS
406   geometry.SetType(Geometry::POINTS);
407
408   drawTrace.Reset();
409   drawTrace.Enable(true);
410   application.SendNotification();
411   application.Render(0);
412   application.Render();
413   application.SendNotification();
414   drawTrace.Enable(false);
415
416   // geometry type is set as GL_POINTS
417   // no index buffer, call glDrawArrays,
418   DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
419   out.str("");
420   out << GL_POINTS << ", " << 0 << ", " << numVertex;
421   DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
422
423   DALI_TEST_EQUALS(geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
424
425   /*****************************************************/
426   //TRIANGLE_STRIP, no index buffer
427   geometry.SetType(Geometry::TRIANGLE_STRIP);
428
429   drawTrace.Reset();
430   drawTrace.Enable(true);
431   application.SendNotification();
432   application.Render(0);
433   application.Render();
434   application.SendNotification();
435   drawTrace.Enable(false);
436
437   // geometry type is set as GL_TRIANGLE_STRIP
438   // no index buffer, call glDrawArrays,
439   DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
440   out.str("");
441   out << GL_TRIANGLE_STRIP << ", " << 0 << ", " << numVertex;
442   DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
443
444   DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
445
446   /*****************************************************/
447   //TRIANGLE_FAN, no index buffer
448   geometry.SetType(Geometry::TRIANGLE_FAN);
449
450   drawTrace.Reset();
451   drawTrace.Enable(true);
452   application.SendNotification();
453   application.Render(0);
454   application.Render();
455   application.SendNotification();
456   drawTrace.Enable(false);
457
458   // geometry type is set as GL_TRIANGLE_FAN
459   // no index buffer, call glDrawArrays,
460   DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
461   out.str("");
462   out << GL_TRIANGLE_FAN << ", " << 0 << ", " << numVertex;
463   DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
464
465   DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
466
467   END_TEST;
468 }
469
470 int UtcDaliGeometrySetGetGeometryType02(void)
471 {
472   TestApplication application;
473
474   tet_infoline("Test SetType and GetType: with index buffer");
475
476   unsigned int numVertex    = 4u;
477   unsigned int numIndex     = 6u; // 6 unsigned short
478   VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
479
480   Geometry geometry = Geometry::New();
481   geometry.AddVertexBuffer(vertexBuffer);
482   const unsigned short indexData[6] = {0, 3, 1, 0, 2, 3};
483   geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0]));
484
485   Shader   shader   = CreateShader();
486   Renderer renderer = Renderer::New(geometry, shader);
487   Actor    actor    = Actor::New();
488   actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
489   actor.AddRenderer(renderer);
490   application.GetScene().Add(actor);
491
492   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
493   TraceCallStack&    drawTrace     = glAbstraction.GetDrawTrace();
494
495   /****************************************************/
496   // Default (TRIANGLES), with index buffer
497   drawTrace.Reset();
498   drawTrace.Enable(true);
499   application.SendNotification();
500   application.Render(0);
501   application.Render();
502   application.SendNotification();
503   drawTrace.Enable(false);
504
505   // Test the default geometry type is GL_TRIANGLE
506   DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
507   std::stringstream out;
508   out << GL_TRIANGLES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
509       << "indices";
510   DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
511
512   DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
513
514   /*********************************************************/
515   // LINES, with index buffer
516   geometry.SetType(Geometry::LINES);
517
518   drawTrace.Reset();
519   drawTrace.Enable(true);
520   application.SendNotification();
521   application.Render(0);
522   application.Render();
523   application.SendNotification();
524   drawTrace.Enable(false);
525
526   // geometry type is set as GL_LINES
527   DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
528   out.str("");
529   out << GL_LINES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
530       << "indices";
531   DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
532
533   DALI_TEST_EQUALS(geometry.GetType(), Geometry::LINES, TEST_LOCATION);
534
535   /*****************************************************/
536   //POINTS
537   geometry.SetType(Geometry::POINTS);
538
539   drawTrace.Reset();
540   drawTrace.Enable(true);
541   application.SendNotification();
542   application.Render(0);
543   application.Render();
544   application.SendNotification();
545   drawTrace.Enable(false);
546
547   // geometry type is set as GL_POINTS
548   // As Points does not use the index buffer, call glDrawArrays,
549   DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
550   out.str("");
551   out << GL_POINTS << ", " << 0 << ", " << numVertex;
552   DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
553
554   DALI_TEST_EQUALS(geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
555
556   /*****************************************************/
557   //TRIANGLE_STRIP
558   geometry.SetType(Geometry::TRIANGLE_STRIP);
559
560   drawTrace.Reset();
561   drawTrace.Enable(true);
562   application.SendNotification();
563   application.Render(0);
564   application.Render();
565   application.SendNotification();
566   drawTrace.Enable(false);
567
568   // geometry type is set as GL_TRIANGLE_STRIP
569   DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
570   out.str("");
571   out << GL_TRIANGLE_STRIP << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
572       << "indices";
573   DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
574
575   DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
576
577   /*****************************************************/
578   //TRIANGLE_FAN
579   geometry.SetType(Geometry::TRIANGLE_FAN);
580
581   drawTrace.Reset();
582   drawTrace.Enable(true);
583   application.SendNotification();
584   application.Render(0);
585   application.Render();
586   application.SendNotification();
587   drawTrace.Enable(false);
588
589   // geometry type is set as GL_TRIANGLE_FAN
590   DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
591   out.str("");
592   out << GL_TRIANGLE_FAN << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
593       << "indices";
594   DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
595
596   DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
597
598   END_TEST;
599 }
600
601 int UtcDaliGeometrySetIndexBufferNegative(void)
602 {
603   TestApplication application;
604   Dali::Geometry  instance;
605   try
606   {
607     unsigned short* arg1(nullptr);
608     unsigned long   arg2(0u);
609     instance.SetIndexBuffer(arg1, arg2);
610     DALI_TEST_CHECK(false); // Should not get here
611   }
612   catch(...)
613   {
614     DALI_TEST_CHECK(true); // We expect an assert
615   }
616   END_TEST;
617 }
618
619 int UtcDaliGeometryAddVertexBufferNegative(void)
620 {
621   TestApplication application;
622   Dali::Geometry  instance;
623   try
624   {
625     Dali::VertexBuffer arg1;
626     instance.AddVertexBuffer(arg1);
627     DALI_TEST_CHECK(false); // Should not get here
628   }
629   catch(...)
630   {
631     DALI_TEST_CHECK(true); // We expect an assert
632   }
633   END_TEST;
634 }
635
636 int UtcDaliGeometryRemoveVertexBufferNegative(void)
637 {
638   TestApplication application;
639   Dali::Geometry  instance;
640   try
641   {
642     unsigned long arg1(0u);
643     instance.RemoveVertexBuffer(arg1);
644     DALI_TEST_CHECK(false); // Should not get here
645   }
646   catch(...)
647   {
648     DALI_TEST_CHECK(true); // We expect an assert
649   }
650   END_TEST;
651 }
652
653 int UtcDaliGeometrySetTypeNegative(void)
654 {
655   TestApplication application;
656   Dali::Geometry  instance;
657   try
658   {
659     Dali::Geometry::Type arg1(Geometry::POINTS);
660     instance.SetType(arg1);
661     DALI_TEST_CHECK(false); // Should not get here
662   }
663   catch(...)
664   {
665     DALI_TEST_CHECK(true); // We expect an assert
666   }
667   END_TEST;
668 }
669
670 int UtcDaliGeometryGetNumberOfVertexBuffersNegative(void)
671 {
672   TestApplication application;
673   Dali::Geometry  instance;
674   try
675   {
676     instance.GetNumberOfVertexBuffers();
677     DALI_TEST_CHECK(false); // Should not get here
678   }
679   catch(...)
680   {
681     DALI_TEST_CHECK(true); // We expect an assert
682   }
683   END_TEST;
684 }
685
686 int UtcDaliGeometryGetTypeNegative(void)
687 {
688   TestApplication application;
689   Dali::Geometry  instance;
690   try
691   {
692     instance.GetType();
693     DALI_TEST_CHECK(false); // Should not get here
694   }
695   catch(...)
696   {
697     DALI_TEST_CHECK(true); // We expect an assert
698   }
699   END_TEST;
700 }