Dali 3D User Interface Engine
utc-Dali-Context.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 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 <iostream>
19 
20 #include <stdlib.h>
22 #include <dali-test-suite-utils.h>
23 
24 using namespace Dali;
25 
26 
27 namespace
28 {
29 // Size of the VertexAttributeArray enables
30 // GLES specification states that there's a minimum of 8
31 const unsigned int TEST_MAX_ATTRIBUTE_CACHE_SIZE = 8;
32 
34 {
43 };
44 
45 // Create bitmap image
47 {
49 
50  return image;
51 }
52 
54 {
56  ImageActor actor = ImageActor::New( image );
57  actor.SetSize( 100.0f, 100.0f );
58  actor.SetName("Test ImageActor");
59  return actor;
60 }
61 
62 } // anonymous namespace
63 
64 
65 // Positive test case for a method
67 {
68  tet_infoline("Testing vertex attrib initial state in context");
69 
70  TestApplication application;
71 
72  // start up
73  application.SendNotification();
74  application.Render();
75  application.Render();
76 
77  // check the locations
78  for (unsigned int i = 0; i < TEST_MAX_ATTRIBUTE_CACHE_SIZE; i++)
79  {
81  }
82 
84  END_TEST;
85 }
86 
87 // Tests to make the attribs only get set once when continually rendering an image actor
89 {
90  tet_infoline("Testing vertex attrib rendering state in context with images");
91 
92  TestApplication application;
93 
94  // start up
95  application.SendNotification();
96  application.Render();
97  application.Render();
98 
99  // the vertex attribs get modified on startup to set them to disabled
100  // clear the flag to say they've changed
102 
103 
104  // create a test image actor
105  ImageActor imageActor(CreateImageActor());
106  Stage::GetCurrent().Add(imageActor);
107 
108 
109  application.SendNotification();
110  application.Render();
111  application.Render();
112 
113  // check to make sure the state has changed (the image renderer will enable some
114  // locations).
116 
117  // Now check to make sure the state is cached, and isn't being set each frame.
119 
120  application.Render();
121  application.Render();
122  application.Render();
123 
124  // if it has changed then the caching has failed
126 
127 
129  END_TEST;
130 }
Dali Docs Home
Read more about Dali