2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 // http://floralicense.org/license/
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.
20 #include <dali/dali.h>
21 #include <dali-test-suite-utils.h>
26 void mesh_actor_test_startup(void)
28 test_return_value = TET_UNDEF;
31 void mesh_actor_test_cleanup(void)
33 test_return_value = TET_PASS;
39 static AnimatableMesh NewMesh()
41 AnimatableMesh::Faces faces;
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));
52 AnimatableMesh mesh = AnimatableMesh::New( 10u, faces, customMaterial );
55 } // anonymous namespace
57 int UtcDaliMeshActorConstructorVoid(void)
59 TestApplication application;
60 tet_infoline("Testing Dali::MeshActor::MeshActor()");
63 DALI_TEST_CHECK(!actor);
67 int UtcDaliMeshActorNew01(void)
69 TestApplication application;
70 tet_infoline("Testing Dali::MeshActor::New()");
72 AnimatableMesh mesh = NewMesh();
73 MeshActor actor = MeshActor::New(mesh);
74 application.SendNotification();
77 application.SendNotification();
79 DALI_TEST_CHECK(actor);
83 int UtcDaliMeshActorNew03(void)
85 TestApplication application;
86 tet_infoline("Testing Dali::Mesh::New() - Create with no mesh");
90 MeshActor actor = MeshActor::New(); // Shouldn't assert
93 catch (Dali::DaliException& e)
101 int UtcDaliMeshActorIndices(void)
103 TestApplication application;
104 Actor basicActor = Actor::New();
105 AnimatableMesh mesh = NewMesh();
106 MeshActor meshActor = MeshActor::New(mesh);
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 );