[dali_2.2.22] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-scene3d-internal / utc-Dali-ModelPrimitiveImpl.cpp
1 /*
2  * Copyright (c) 2023 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-toolkit-test-suite-utils.h>
19 #include <dali-toolkit/dali-toolkit.h>
20 #include <stdlib.h>
21 #include <iostream>
22
23 #include <dali-scene3d/internal/model-components/model-primitive-impl.h>
24
25 using namespace Dali;
26 using namespace Dali::Toolkit;
27
28 void model_components_model_primitive_impl_startup(void)
29 {
30   test_return_value = TET_UNDEF;
31 }
32
33 void model_components_model_primitive_impl_cleanup(void)
34 {
35   test_return_value = TET_PASS;
36 }
37
38 namespace
39 {
40 } // namespace
41
42 // Method test
43 int UtcDaliModelPrimitiveImplSetData(void)
44 {
45   ToolkitTestApplication application;
46
47   Scene3D::ModelPrimitive modelPrimitive = Scene3D::ModelPrimitive::New();
48
49   tet_printf("Check primitive don't have material initial time\n");
50
51   DALI_TEST_CHECK(!GetImplementation(modelPrimitive).GetRenderer());
52   DALI_TEST_CHECK(!modelPrimitive.GetGeometry());
53   DALI_TEST_CHECK(!modelPrimitive.GetMaterial());
54
55   Dali::Geometry geometry = Dali::Geometry::New();
56   Dali::Scene3D::Material material = Dali::Scene3D::Material::New();
57
58   modelPrimitive.SetGeometry(geometry);
59   modelPrimitive.SetMaterial(material);
60   DALI_TEST_CHECK(geometry == modelPrimitive.GetGeometry());
61   DALI_TEST_CHECK(material == modelPrimitive.GetMaterial());
62   DALI_TEST_CHECK(GetImplementation(modelPrimitive).GetRenderer());
63
64   END_TEST;
65 }