Resynced test cases and removed TET framework
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-MeshActor.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 #include <iostream>
18
19 #include <stdlib.h>
20 #include <dali/dali.h>
21 #include <dali-test-suite-utils.h>
22
23 using namespace Dali;
24
25
26 void mesh_actor_test_startup(void)
27 {
28   test_return_value = TET_UNDEF;
29 }
30
31 void mesh_actor_test_cleanup(void)
32 {
33   test_return_value = TET_PASS;
34 }
35
36 namespace
37 {
38
39 static AnimatableMesh NewMesh()
40 {
41   AnimatableMesh::Faces faces;
42   faces.push_back(0);
43   faces.push_back(1);
44   faces.push_back(2);
45
46   Material customMaterial = Material::New("CustomMaterial");
47   customMaterial.SetOpacity(.76f);
48   customMaterial.SetDiffuseColor(Vector4(0.8f, 0.0f, 0.4f, 1.0f));
49   customMaterial.SetAmbientColor(Vector4(0.2f, 1.0f, 0.6f, 1.0f));
50   customMaterial.SetSpecularColor(Vector4(0.5f, 0.6f, 0.7f, 1.0f));
51
52   AnimatableMesh mesh = AnimatableMesh::New( 10u, faces, customMaterial );
53   return mesh;
54 }
55 } // anonymous namespace
56
57 int UtcDaliMeshActorConstructorVoid(void)
58 {
59   TestApplication application;
60   tet_infoline("Testing Dali::MeshActor::MeshActor()");
61
62   MeshActor actor;
63   DALI_TEST_CHECK(!actor);
64   END_TEST;
65 }
66
67 int UtcDaliMeshActorNew01(void)
68 {
69   TestApplication application;
70   tet_infoline("Testing Dali::MeshActor::New()");
71
72   AnimatableMesh mesh = NewMesh();
73   MeshActor actor = MeshActor::New(mesh);
74   application.SendNotification();
75   application.Render();
76   application.Render();
77   application.SendNotification();
78
79   DALI_TEST_CHECK(actor);
80   END_TEST;
81 }
82
83 int UtcDaliMeshActorNew03(void)
84 {
85   TestApplication application;
86   tet_infoline("Testing Dali::Mesh::New() - Create with no mesh");
87
88   try
89   {
90     MeshActor actor = MeshActor::New(); // Shouldn't assert
91     tet_result(TET_PASS);
92   }
93   catch (Dali::DaliException& e)
94   {
95     tet_result(TET_FAIL);
96   }
97
98   END_TEST;
99 }
100
101 int UtcDaliMeshActorIndices(void)
102 {
103   TestApplication application;
104   Actor basicActor = Actor::New();
105   AnimatableMesh mesh = NewMesh();
106   MeshActor meshActor = MeshActor::New(mesh);
107
108   Property::IndexContainer indices;
109   meshActor.GetPropertyIndices( indices );
110   DALI_TEST_CHECK( indices.size() == basicActor.GetPropertyCount() ); // Mesh Actor does not have any properties
111   DALI_TEST_EQUALS( indices.size(), meshActor.GetPropertyCount(), TEST_LOCATION );
112   END_TEST;
113 }