[dali_1.9.26] Merge branch 'devel/master'
[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/public-api/dali-core.h>
19 #include <dali-test-suite-utils.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
38 struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
39
40 PropertyBuffer CreateVertexBuffer( const std::string& aPosition, const std::string& aTexCoord )
41 {
42   const float halfQuadSize = .5f;
43   TexturedQuadVertex texturedQuadVertexData[4] = {
44     { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
45     { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
46     { Vector2(-halfQuadSize,  halfQuadSize), Vector2(0.f, 1.f) },
47     { Vector2( halfQuadSize,  halfQuadSize), Vector2(1.f, 1.f) } };
48
49   Property::Map vertexFormat;
50   vertexFormat[aPosition] = Property::VECTOR2;
51   vertexFormat[aTexCoord] = Property::VECTOR2;
52
53   PropertyBuffer vertexData = PropertyBuffer::New( vertexFormat );
54   vertexData.SetData( texturedQuadVertexData, 4 );
55
56   return vertexData;
57 }
58
59
60 }
61
62
63 int UtcDaliGeometryNew01(void)
64 {
65   TestApplication application;
66
67   Geometry geometry = Geometry::New();
68
69   DALI_TEST_EQUALS( (bool)geometry, true, TEST_LOCATION );
70   END_TEST;
71 }
72
73 int UtcDaliGeometryNew02(void)
74 {
75   TestApplication application;
76   Geometry geometry;
77   DALI_TEST_EQUALS( (bool)geometry, false, TEST_LOCATION );
78   END_TEST;
79 }
80
81 int UtcDaliGeometryCopyConstructor(void)
82 {
83   TestApplication application;
84
85   Geometry geometry = Geometry::New();
86
87   Geometry geometryCopy(geometry);
88
89   DALI_TEST_EQUALS( (bool)geometryCopy, true, TEST_LOCATION );
90   END_TEST;
91 }
92
93 int UtcDaliGeometryAssignmentOperator(void)
94 {
95   TestApplication application;
96
97   Geometry geometry = Geometry::New();
98
99   Geometry geometry2;
100   DALI_TEST_EQUALS( (bool)geometry2, false, TEST_LOCATION );
101
102   geometry2 = geometry;
103   DALI_TEST_EQUALS( (bool)geometry2, true, TEST_LOCATION );
104
105   END_TEST;
106 }
107
108 int UtcDaliGeometryMoveConstructor(void)
109 {
110   TestApplication application;
111
112   Geometry geometry = Geometry::New();
113   DALI_TEST_CHECK( geometry );
114   DALI_TEST_EQUALS( 1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
115   DALI_TEST_EQUALS( 0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION );
116
117   PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
118   geometry.AddVertexBuffer( vertexBuffer );
119   DALI_TEST_EQUALS( 1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION );
120
121   Geometry move = std::move( geometry );
122   DALI_TEST_CHECK( move );
123   DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
124   DALI_TEST_EQUALS( 1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION );
125   DALI_TEST_CHECK( !geometry );
126
127   END_TEST;
128 }
129
130 int UtcDaliGeometryMoveAssignment(void)
131 {
132   TestApplication application;
133
134   Geometry geometry = Geometry::New();
135   DALI_TEST_CHECK( geometry );
136   DALI_TEST_EQUALS( 1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
137   DALI_TEST_EQUALS( 0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION );
138
139   PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
140   geometry.AddVertexBuffer( vertexBuffer );
141   DALI_TEST_EQUALS( 1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION );
142
143   Geometry move;
144   move = std::move( geometry );
145   DALI_TEST_CHECK( move );
146   DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
147   DALI_TEST_EQUALS( 1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION );
148   DALI_TEST_CHECK( !geometry );
149
150   END_TEST;
151 }
152
153 int UtcDaliGeometryDownCast01(void)
154 {
155   TestApplication application;
156
157   Geometry geometry = Geometry::New();
158
159   BaseHandle handle(geometry);
160   Geometry geometry2 = Geometry::DownCast(handle);
161   DALI_TEST_EQUALS( (bool)geometry2, true, TEST_LOCATION );
162   END_TEST;
163 }
164
165 int UtcDaliGeometryDownCast02(void)
166 {
167   TestApplication application;
168
169   Handle handle = Handle::New(); // Create a custom object
170   Geometry geometry = Geometry::DownCast(handle);
171   DALI_TEST_EQUALS( (bool)geometry, false, TEST_LOCATION );
172   END_TEST;
173 }
174
175 int UtcDaliGeometryAddVertexBuffer(void)
176 {
177   TestApplication application;
178
179   tet_infoline("Test AddVertexBuffer");
180
181   PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
182   Geometry geometry = Geometry::New();
183   geometry.AddVertexBuffer( vertexBuffer1 );
184
185   Shader shader = CreateShader();
186   Renderer renderer = Renderer::New(geometry, shader);
187   Actor actor = Actor::New();
188   actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f);
189   actor.AddRenderer(renderer);
190   application.GetScene().Add(actor);
191
192   application.SendNotification();
193   application.Render(0);
194   application.Render();
195   application.SendNotification();
196
197   {
198     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
199         application.GetGlAbstraction().GetBufferDataCalls();
200
201     DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
202
203     DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION );
204   }
205
206   // add the second vertex buffer
207   application.GetGlAbstraction().ResetBufferDataCalls();
208
209   PropertyBuffer vertexBuffer2 = CreateVertexBuffer( "aPosition2", "aTexCoord2" );
210   geometry.AddVertexBuffer( vertexBuffer2 );
211   application.SendNotification();
212   application.Render(0);
213   application.Render();
214   application.SendNotification();
215
216   {
217     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
218         application.GetGlAbstraction().GetBufferDataCalls();
219
220     //Check that only the new buffer gets uploaded
221     DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
222     DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION );
223   }
224
225   END_TEST;
226 }
227
228 int UtcDaliGeometryGetNumberOfVertexBuffers(void)
229 {
230   TestApplication application;
231
232   tet_infoline("Test GetNumberOfVertexBuffers");
233   PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
234   PropertyBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" );
235   PropertyBuffer vertexBuffer3 = CreateVertexBuffer("aPosition3", "aTexCoord3" );
236
237   Geometry geometry = Geometry::New();
238   geometry.AddVertexBuffer( vertexBuffer1 );
239   DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION );
240
241   geometry.AddVertexBuffer( vertexBuffer2 );
242   geometry.AddVertexBuffer( vertexBuffer3 );
243   DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 3u, TEST_LOCATION );
244
245   geometry.RemoveVertexBuffer( 2u );
246   DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 2u, TEST_LOCATION );
247
248   END_TEST;
249 }
250
251 int UtcDaliGeometryRemoveVertexBuffer(void)
252 {
253   TestApplication application;
254
255   tet_infoline("Test RemoveVertexBuffer");
256
257   PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
258   PropertyBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" );
259
260   Geometry geometry = Geometry::New();
261   geometry.AddVertexBuffer( vertexBuffer1 );
262
263   Shader shader = CreateShader();
264   Renderer renderer = Renderer::New(geometry, shader);
265   Actor actor = Actor::New();
266   actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f);
267   actor.AddRenderer(renderer);
268   application.GetScene().Add(actor);
269
270   DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION );
271
272   geometry.RemoveVertexBuffer( 0 );
273   geometry.AddVertexBuffer( vertexBuffer2 );
274   DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION );
275
276   geometry.RemoveVertexBuffer( 0 );
277   DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 0u, TEST_LOCATION );
278
279   //Todo: test by checking the BufferDataCalls
280   // make sure the vertex buffer in actually removed from gl
281
282    END_TEST;
283 }
284
285 int UtcDaliGeometrySetIndexBuffer(void)
286 {
287   TestApplication application;
288
289   tet_infoline("Test SetIndexBuffer");
290
291   PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
292
293   Geometry geometry = Geometry::New();
294   geometry.AddVertexBuffer( vertexBuffer );
295
296   Shader shader = CreateShader();
297   Renderer renderer = Renderer::New(geometry, shader);
298   Actor actor = Actor::New();
299   actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f);
300   actor.AddRenderer(renderer);
301   application.GetScene().Add(actor);
302
303   application.SendNotification();
304   application.Render(0);
305   application.Render();
306   application.SendNotification();
307
308   {
309     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
310         application.GetGlAbstraction().GetBufferDataCalls();
311
312     DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
313
314     DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION );
315   }
316
317   // Set index buffer
318   application.GetGlAbstraction().ResetBufferDataCalls();
319
320   const unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
321   geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
322   application.SendNotification();
323   application.Render(0);
324   application.Render();
325   application.SendNotification();
326
327   {
328     const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
329         application.GetGlAbstraction().GetBufferDataCalls();
330
331     //Only the index buffer should be uploaded
332     DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
333
334     // should be unsigned short instead of unsigned int
335     DALI_TEST_EQUALS( bufferDataCalls[0], 6*sizeof( unsigned short ), TEST_LOCATION );
336   }
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   PropertyBuffer 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   PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
479
480
481   Geometry geometry = Geometry::New();
482   geometry.AddVertexBuffer( vertexBuffer );
483   const unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
484   geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
485
486   Shader shader = CreateShader();
487   Renderer renderer = Renderer::New(geometry, shader);
488   Actor actor = Actor::New();
489   actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f);
490   actor.AddRenderer(renderer);
491   application.GetScene().Add(actor);
492
493   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
494   TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
495
496   /****************************************************/
497   // Default (TRIANGLES), with index buffer
498   drawTrace.Reset();
499   drawTrace.Enable(true);
500   application.SendNotification();
501   application.Render(0);
502   application.Render();
503   application.SendNotification();
504   drawTrace.Enable( false );
505
506   // Test the default geometry type is GL_TRIANGLE
507   DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
508   std::stringstream out;
509   out << GL_TRIANGLES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"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<<", "<<"indices";
530   DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
531
532   DALI_TEST_EQUALS( geometry.GetType(), Geometry::LINES, TEST_LOCATION);
533
534   /*****************************************************/
535   //POINTS
536   geometry.SetType( Geometry::POINTS );
537
538   drawTrace.Reset();
539   drawTrace.Enable(true);
540   application.SendNotification();
541   application.Render(0);
542   application.Render();
543   application.SendNotification();
544   drawTrace.Enable( false );
545
546   // geometry type is set as GL_POINTS
547   // As Points does not use the index buffer, call glDrawArrays,
548   DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
549   out.str("");
550   out << GL_POINTS << ", " << 0 << ", " << numVertex;
551   DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
552
553   DALI_TEST_EQUALS( geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
554
555   /*****************************************************/
556   //TRIANGLE_STRIP
557   geometry.SetType( Geometry::TRIANGLE_STRIP );
558
559   drawTrace.Reset();
560   drawTrace.Enable(true);
561   application.SendNotification();
562   application.Render(0);
563   application.Render();
564   application.SendNotification();
565   drawTrace.Enable( false );
566
567   // geometry type is set as GL_TRIANGLE_STRIP
568   DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
569   out.str("");
570   out << GL_TRIANGLE_STRIP << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices";
571   DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
572
573   DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
574
575   /*****************************************************/
576   //TRIANGLE_FAN
577   geometry.SetType( Geometry::TRIANGLE_FAN );
578
579   drawTrace.Reset();
580   drawTrace.Enable(true);
581   application.SendNotification();
582   application.Render(0);
583   application.Render();
584   application.SendNotification();
585   drawTrace.Enable( false );
586
587   // geometry type is set as GL_TRIANGLE_FAN
588   DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
589   out.str("");
590   out << GL_TRIANGLE_FAN << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices";
591   DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
592
593   DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
594
595   END_TEST;
596 }
597
598 int UtcDaliGeometrySetIndexBufferNegative(void)
599 {
600   TestApplication application;
601   Dali::Geometry instance;
602   try
603   {
604     unsigned short* arg1(nullptr);
605     unsigned long arg2(0u);
606     instance.SetIndexBuffer(arg1,arg2);
607     DALI_TEST_CHECK(false); // Should not get here
608   }
609   catch(...)
610   {
611     DALI_TEST_CHECK(true); // We expect an assert
612   }
613   END_TEST;
614 }
615
616 int UtcDaliGeometryAddVertexBufferNegative(void)
617 {
618   TestApplication application;
619   Dali::Geometry instance;
620   try
621   {
622     Dali::PropertyBuffer arg1;
623     instance.AddVertexBuffer(arg1);
624     DALI_TEST_CHECK(false); // Should not get here
625   }
626   catch(...)
627   {
628     DALI_TEST_CHECK(true); // We expect an assert
629   }
630   END_TEST;
631 }
632
633 int UtcDaliGeometryRemoveVertexBufferNegative(void)
634 {
635   TestApplication application;
636   Dali::Geometry instance;
637   try
638   {
639     unsigned long arg1(0u);
640     instance.RemoveVertexBuffer(arg1);
641     DALI_TEST_CHECK(false); // Should not get here
642   }
643   catch(...)
644   {
645     DALI_TEST_CHECK(true); // We expect an assert
646   }
647   END_TEST;
648 }
649
650 int UtcDaliGeometrySetTypeNegative(void)
651 {
652   TestApplication application;
653   Dali::Geometry instance;
654   try
655   {
656     Dali::Geometry::Type arg1(Geometry::POINTS);
657     instance.SetType(arg1);
658     DALI_TEST_CHECK(false); // Should not get here
659   }
660   catch(...)
661   {
662     DALI_TEST_CHECK(true); // We expect an assert
663   }
664   END_TEST;
665 }
666
667 int UtcDaliGeometryGetNumberOfVertexBuffersNegative(void)
668 {
669   TestApplication application;
670   Dali::Geometry instance;
671   try
672   {
673     instance.GetNumberOfVertexBuffers();
674     DALI_TEST_CHECK(false); // Should not get here
675   }
676   catch(...)
677   {
678     DALI_TEST_CHECK(true); // We expect an assert
679   }
680   END_TEST;
681 }
682
683 int UtcDaliGeometryGetTypeNegative(void)
684 {
685   TestApplication application;
686   Dali::Geometry instance;
687   try
688   {
689     instance.GetType();
690     DALI_TEST_CHECK(false); // Should not get here
691   }
692   catch(...)
693   {
694     DALI_TEST_CHECK(true); // We expect an assert
695   }
696   END_TEST;
697 }