Merge "Wrap Mode support for ImageVisual" into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextEditor.cpp
1 /*
2  * Copyright (c) 2016 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 #include <stdlib.h>
20 #include <dali/public-api/rendering/renderer.h>
21 #include <dali/integration-api/events/key-event-integ.h>
22 #include <dali/integration-api/events/tap-gesture-event.h>
23 #include <dali-toolkit-test-suite-utils.h>
24 #include <dali-toolkit/dali-toolkit.h>
25
26 using namespace Dali;
27 using namespace Toolkit;
28
29 void dali_texteditor_startup(void)
30 {
31   test_return_value = TET_UNDEF;
32 }
33
34 void dali_texteditor_cleanup(void)
35 {
36   test_return_value = TET_PASS;
37 }
38
39 namespace
40 {
41
42 const char* const PROPERTY_NAME_RENDERING_BACKEND                    = "renderingBackend";
43 const char* const PROPERTY_NAME_TEXT                                 = "text";
44 const char* const PROPERTY_NAME_TEXT_COLOR                           = "textColor";
45 const char* const PROPERTY_NAME_FONT_FAMILY                          = "fontFamily";
46 const char* const PROPERTY_NAME_FONT_STYLE                           = "fontStyle";
47 const char* const PROPERTY_NAME_POINT_SIZE                           = "pointSize";
48 const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT                 = "horizontalAlignment";
49 const char* const PROPERTY_NAME_SCROLL_THRESHOLD                     = "scrollThreshold";
50 const char* const PROPERTY_NAME_SCROLL_SPEED                         = "scrollSpeed";
51 const char* const PROPERTY_NAME_PRIMARY_CURSOR_COLOR                 = "primaryCursorColor";
52 const char* const PROPERTY_NAME_SECONDARY_CURSOR_COLOR               = "secondaryCursorColor";
53 const char* const PROPERTY_NAME_ENABLE_CURSOR_BLINK                  = "enableCursorBlink";
54 const char* const PROPERTY_NAME_CURSOR_BLINK_INTERVAL                = "cursorBlinkInterval";
55 const char* const PROPERTY_NAME_CURSOR_BLINK_DURATION                = "cursorBlinkDuration";
56 const char* const PROPERTY_NAME_CURSOR_WIDTH                         = "cursorWidth";
57 const char* const PROPERTY_NAME_GRAB_HANDLE_IMAGE                    = "grabHandleImage";
58 const char* const PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE            = "grabHandlePressedImage";
59 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT          = "selectionHandleImageLeft";
60 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT         = "selectionHandleImageRight";
61 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT  = "selectionHandlePressedImageLeft";
62 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = "selectionHandlePressedImageRight";
63 const char* const PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT   = "selectionHandleMarkerImageLeft";
64 const char* const PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT  = "selectionHandleMarkerImageRight";
65 const char* const PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR            = "selectionHighlightColor";
66 const char* const PROPERTY_NAME_DECORATION_BOUNDING_BOX              = "decorationBoundingBox";
67 const char* const PROPERTY_NAME_ENABLE_MARKUP                        = "enableMarkup";
68 const char* const PROPERTY_NAME_INPUT_COLOR                          = "inputColor";
69 const char* const PROPERTY_NAME_INPUT_FONT_FAMILY                    = "inputFontFamily";
70 const char* const PROPERTY_NAME_INPUT_FONT_STYLE                     = "inputFontStyle";
71 const char* const PROPERTY_NAME_INPUT_POINT_SIZE                     = "inputPointSize";
72
73 const char* const PROPERTY_NAME_LINE_SPACING                         = "lineSpacing";
74 const char* const PROPERTY_NAME_INPUT_LINE_SPACING                   = "inputLineSpacing";
75 const char* const PROPERTY_NAME_UNDERLINE                            = "underline";
76 const char* const PROPERTY_NAME_INPUT_UNDERLINE                      = "inputUnderline";
77 const char* const PROPERTY_NAME_SHADOW                               = "shadow";
78 const char* const PROPERTY_NAME_INPUT_SHADOW                         = "inputShadow";
79 const char* const PROPERTY_NAME_EMBOSS                               = "emboss";
80 const char* const PROPERTY_NAME_INPUT_EMBOSS                         = "inputEmboss";
81 const char* const PROPERTY_NAME_OUTLINE                              = "outline";
82 const char* const PROPERTY_NAME_INPUT_OUTLINE                        = "inputOutline";
83
84 const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
85
86 const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color.
87
88 const unsigned int CURSOR_BLINK_INTERVAL = 500u; // Cursor blink interval
89 const float TO_MILLISECONDS = 1000.f;
90 const float TO_SECONDS = 1.f / TO_MILLISECONDS;
91
92 const float SCROLL_THRESHOLD = 10.f;
93 const float SCROLL_SPEED = 300.f;
94
95 static bool gTextChangedCallBackCalled;
96
97 static void TestTextChangedCallback( TextEditor control )
98 {
99   tet_infoline(" TestTextChangedCallback");
100
101   gTextChangedCallBackCalled = true;
102 }
103
104 // Generate a TapGestureEvent to send to Core.
105 Integration::TapGestureEvent GenerateTap(
106     Gesture::State state,
107     unsigned int numberOfTaps,
108     unsigned int numberOfTouches,
109     Vector2 point)
110 {
111   Integration::TapGestureEvent tap( state );
112
113   tap.numberOfTaps = numberOfTaps;
114   tap.numberOfTouches = numberOfTouches;
115   tap.point = point;
116
117   return tap;
118 }
119
120 // Generate a KeyEvent to send to Core.
121 Integration::KeyEvent GenerateKey( const std::string& keyName,
122                                    const std::string& keyString,
123                                    int keyCode,
124                                    int keyModifier,
125                                    unsigned long timeStamp,
126                                    const Integration::KeyEvent::State& keyState )
127 {
128   return Integration::KeyEvent( keyName,
129                                 keyString,
130                                 keyCode,
131                                 keyModifier,
132                                 timeStamp,
133                                 keyState );
134 }
135
136 } // namespace
137
138 int UtcDaliToolkitTextEditorConstructorP(void)
139 {
140   ToolkitTestApplication application;
141   tet_infoline(" UtcDaliToolkitTextEditorConstructorP");
142   TextEditor textEditor;
143   DALI_TEST_CHECK( !textEditor );
144   END_TEST;
145 }
146
147 int UtcDaliToolkitTextEditorNewP(void)
148 {
149   ToolkitTestApplication application;
150   tet_infoline(" UtcDaliToolkitTextEditorNewP");
151   TextEditor textEditor = TextEditor::New();
152   DALI_TEST_CHECK( textEditor );
153   END_TEST;
154 }
155
156 int UtcDaliToolkitTextEditorDownCastP(void)
157 {
158   ToolkitTestApplication application;
159   tet_infoline(" UtcDaliToolkitTextEditorDownCastP");
160   TextEditor textEditor1 = TextEditor::New();
161   BaseHandle object( textEditor1 );
162
163   TextEditor textEditor2 = TextEditor::DownCast( object );
164   DALI_TEST_CHECK( textEditor2 );
165
166   TextEditor textEditor3 = DownCast< TextEditor >( object );
167   DALI_TEST_CHECK( textEditor3 );
168   END_TEST;
169 }
170
171 int UtcDaliToolkitTextEditorDownCastN(void)
172 {
173   ToolkitTestApplication application;
174   tet_infoline(" UtcDaliToolkitTextEditorDownCastN");
175   BaseHandle uninitializedObject;
176   TextEditor textEditor1 = TextEditor::DownCast( uninitializedObject );
177   DALI_TEST_CHECK( !textEditor1 );
178
179   TextEditor textEditor2 = DownCast< TextEditor >( uninitializedObject );
180   DALI_TEST_CHECK( !textEditor2 );
181   END_TEST;
182 }
183
184 int UtcDaliToolkitTextEditorCopyConstructorP(void)
185 {
186   ToolkitTestApplication application;
187   tet_infoline(" UtcDaliToolkitTextEditorCopyConstructorP");
188   TextEditor textEditor = TextEditor::New();
189   textEditor.SetProperty( TextEditor::Property::TEXT, "Test" );
190
191   TextEditor copy( textEditor );
192   DALI_TEST_CHECK( copy );
193   DALI_TEST_CHECK( copy.GetProperty<std::string>( TextEditor::Property::TEXT ) == textEditor.GetProperty<std::string>( TextEditor::Property::TEXT ) );
194   END_TEST;
195 }
196
197 int UtcDaliToolkitTextEditorAssignmentOperatorP(void)
198 {
199   ToolkitTestApplication application;
200   tet_infoline(" UtcDaliToolkitTextEditorAssignmentOperatorP");
201   TextEditor textEditor = TextEditor::New();
202   textEditor.SetProperty( TextEditor::Property::TEXT, "Test" );
203
204   TextEditor copy = textEditor;
205   DALI_TEST_CHECK( copy );
206   DALI_TEST_CHECK( copy.GetProperty<std::string>( TextEditor::Property::TEXT ) == textEditor.GetProperty<std::string>( TextEditor::Property::TEXT ) );
207   END_TEST;
208 }
209
210 int UtcDaliTextEditorNewP(void)
211 {
212   ToolkitTestApplication application;
213   tet_infoline(" UtcDaliToolkitTextEditorNewP");
214   TextEditor textEditor = TextEditor::New();
215   DALI_TEST_CHECK( textEditor );
216   END_TEST;
217 }
218
219 // Positive test case for a method
220 int UtcDaliTextEditorGetPropertyP(void)
221 {
222   ToolkitTestApplication application;
223   tet_infoline(" UtcDaliToolkitTextEditorGetPropertyP");
224   TextEditor editor = TextEditor::New();
225   DALI_TEST_CHECK( editor );
226
227   // Check Property Indices are correct
228   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == TextEditor::Property::RENDERING_BACKEND );
229   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextEditor::Property::TEXT );
230   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_TEXT_COLOR ) == TextEditor::Property::TEXT_COLOR );
231   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextEditor::Property::FONT_FAMILY );
232   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_FONT_STYLE ) == TextEditor::Property::FONT_STYLE );
233   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_POINT_SIZE ) == TextEditor::Property::POINT_SIZE );
234   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_HORIZONTAL_ALIGNMENT ) == TextEditor::Property::HORIZONTAL_ALIGNMENT );
235   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SCROLL_THRESHOLD ) == TextEditor::Property::SCROLL_THRESHOLD );
236   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SCROLL_SPEED ) == TextEditor::Property::SCROLL_SPEED );
237   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PRIMARY_CURSOR_COLOR ) == TextEditor::Property::PRIMARY_CURSOR_COLOR );
238   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SECONDARY_CURSOR_COLOR ) == TextEditor::Property::SECONDARY_CURSOR_COLOR );
239   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_CURSOR_BLINK ) == TextEditor::Property::ENABLE_CURSOR_BLINK );
240   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_CURSOR_BLINK_INTERVAL ) == TextEditor::Property::CURSOR_BLINK_INTERVAL );
241   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_CURSOR_BLINK_DURATION ) == TextEditor::Property::CURSOR_BLINK_DURATION );
242   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_CURSOR_WIDTH ) == TextEditor::Property::CURSOR_WIDTH );
243   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_GRAB_HANDLE_IMAGE ) == TextEditor::Property::GRAB_HANDLE_IMAGE );
244   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE ) == TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE );
245   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT ) == TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT );
246   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT ) == TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT );
247   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT ) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT );
248   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT ) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT );
249   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT ) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT );
250   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT ) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT );
251   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR ) == TextEditor::Property::SELECTION_HIGHLIGHT_COLOR );
252   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_DECORATION_BOUNDING_BOX ) == TextEditor::Property::DECORATION_BOUNDING_BOX );
253   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_MARKUP ) == TextEditor::Property::ENABLE_MARKUP );
254   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_COLOR ) == TextEditor::Property::INPUT_COLOR );
255   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_FONT_FAMILY ) == TextEditor::Property::INPUT_FONT_FAMILY );
256   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_FONT_STYLE ) == TextEditor::Property::INPUT_FONT_STYLE );
257   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_POINT_SIZE ) == TextEditor::Property::INPUT_POINT_SIZE );
258
259   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_LINE_SPACING ) == TextEditor::Property::LINE_SPACING );
260   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_LINE_SPACING ) == TextEditor::Property::INPUT_LINE_SPACING );
261   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_UNDERLINE ) == TextEditor::Property::UNDERLINE );
262   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_UNDERLINE ) == TextEditor::Property::INPUT_UNDERLINE );
263   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SHADOW ) == TextEditor::Property::SHADOW );
264   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_SHADOW ) == TextEditor::Property::INPUT_SHADOW );
265   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_EMBOSS ) == TextEditor::Property::EMBOSS );
266   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_EMBOSS ) == TextEditor::Property::INPUT_EMBOSS );
267   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextEditor::Property::OUTLINE );
268   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_OUTLINE ) == TextEditor::Property::INPUT_OUTLINE );
269
270   END_TEST;
271 }
272
273 bool SetPropertyMapRetrieved( TextEditor& editor, const Property::Index property, const std::string mapKey, const std::string mapValue )
274 {
275   bool result = false;
276   Property::Map imageMap;
277   imageMap[mapKey] =mapValue;
278
279   editor.SetProperty( property , imageMap );
280   Property::Value propValue = editor.GetProperty( property );
281   Property::Map* resultMap = propValue.GetMap();
282
283   if ( resultMap->Find( mapKey )->Get< std::string>() == mapValue )
284   {
285     result = true;
286   }
287
288   return result;
289 }
290
291 // Positive test case for a method
292 int UtcDaliTextEditorSetPropertyP(void)
293 {
294   ToolkitTestApplication application;
295   tet_infoline(" UtcDaliToolkitTextEditorSetPropertyP");
296   TextEditor editor = TextEditor::New();
297   DALI_TEST_CHECK( editor );
298   Stage::GetCurrent().Add( editor );
299
300   // Note - we can't check the defaults since the stylesheets are platform-specific
301
302   // Check the render backend property.
303   editor.SetProperty( TextEditor::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
304   DALI_TEST_EQUALS( (Text::RenderingType)editor.GetProperty<int>( TextEditor::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
305
306   // Check text property.
307   editor.SetProperty( TextEditor::Property::TEXT, "Setting Text" );
308   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("Setting Text"), TEST_LOCATION );
309
310   // Check text's color property
311   editor.SetProperty( TextEditor::Property::TEXT_COLOR, Color::WHITE );
312   DALI_TEST_EQUALS( editor.GetProperty<Vector4>( TextEditor::Property::TEXT_COLOR ), Color::WHITE, TEST_LOCATION );
313
314   // Check font properties.
315   editor.SetProperty( TextEditor::Property::FONT_FAMILY, "Setting font family" );
316   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
317   editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
318   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}"), TEST_LOCATION );
319   editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
320   DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
321
322   // Reset font style.
323   editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
324   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
325   editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"slant\":\"roman\"}" );
326   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
327   editor.SetProperty( TextEditor::Property::FONT_STYLE, "" );
328   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string(""), TEST_LOCATION );
329
330   // Check that the Alignment properties can be correctly set
331   editor.SetProperty( TextEditor::Property::HORIZONTAL_ALIGNMENT, "END" );
332   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::HORIZONTAL_ALIGNMENT ), "END", TEST_LOCATION );
333
334   // Check scroll properties.
335   editor.SetProperty( TextEditor::Property::SCROLL_THRESHOLD, 1.f );
336   DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SCROLL_THRESHOLD ), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
337   editor.SetProperty( TextEditor::Property::SCROLL_SPEED, 100.f );
338   DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SCROLL_SPEED ), 100.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
339
340   // Check cursor properties
341   editor.SetProperty( TextEditor::Property::PRIMARY_CURSOR_COLOR, Color::RED );
342   DALI_TEST_EQUALS( editor.GetProperty<Vector4>( TextEditor::Property::PRIMARY_CURSOR_COLOR ), Color::RED, TEST_LOCATION );
343   editor.SetProperty( TextEditor::Property::SECONDARY_CURSOR_COLOR, Color::BLUE );
344   DALI_TEST_EQUALS( editor.GetProperty<Vector4>( TextEditor::Property::SECONDARY_CURSOR_COLOR ), Color::BLUE, TEST_LOCATION );
345
346   editor.SetProperty( TextEditor::Property::ENABLE_CURSOR_BLINK, false );
347   DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::ENABLE_CURSOR_BLINK ), false, TEST_LOCATION );
348   editor.SetProperty( TextEditor::Property::CURSOR_BLINK_INTERVAL, 1.f );
349   DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::CURSOR_BLINK_INTERVAL ), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
350   editor.SetProperty( TextEditor::Property::CURSOR_BLINK_DURATION, 10.f );
351   DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::CURSOR_BLINK_DURATION ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
352   editor.SetProperty( TextEditor::Property::CURSOR_WIDTH, 1 );
353   DALI_TEST_EQUALS( editor.GetProperty<int>( TextEditor::Property::CURSOR_WIDTH ), 1, TEST_LOCATION );
354
355   // Check handle images
356   editor.SetProperty( TextEditor::Property::GRAB_HANDLE_IMAGE, "image1" );
357   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::GRAB_HANDLE_IMAGE ), "image1", TEST_LOCATION );
358   editor.SetProperty( TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE, "image2" );
359   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE ), "image2", TEST_LOCATION );
360   editor.SetProperty( TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "image3" );
361
362   // Check handle images
363   DALI_TEST_CHECK( SetPropertyMapRetrieved( editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "filename", "leftHandleImage" )  );
364   DALI_TEST_CHECK( SetPropertyMapRetrieved( editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT, "filename", "rightHandleImage" )  );
365   DALI_TEST_CHECK( SetPropertyMapRetrieved( editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, "filename", "leftHandleImagePressed" )  );
366   DALI_TEST_CHECK( SetPropertyMapRetrieved( editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, "filename", "rightHandleImagePressed" )  );
367   DALI_TEST_CHECK( SetPropertyMapRetrieved( editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, "filename", "leftHandleMarkerImage" )  );
368   DALI_TEST_CHECK( SetPropertyMapRetrieved( editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, "filename", "rightHandleMarkerImage" )  );
369
370   // Check the highlight color
371   editor.SetProperty( TextEditor::Property::SELECTION_HIGHLIGHT_COLOR, Color::GREEN );
372   DALI_TEST_EQUALS( editor.GetProperty<Vector4>( TextEditor::Property::SELECTION_HIGHLIGHT_COLOR ), Color::GREEN, TEST_LOCATION );
373
374   // Decoration bounding box
375   editor.SetProperty( TextEditor::Property::DECORATION_BOUNDING_BOX, Rect<int>( 0, 0, 1, 1 ) );
376   DALI_TEST_EQUALS( editor.GetProperty<Rect <int > >( TextEditor::Property::DECORATION_BOUNDING_BOX ), Rect<int>( 0, 0, 1, 1 ), TEST_LOCATION );
377
378   // Check the enable markup property.
379   DALI_TEST_CHECK( !editor.GetProperty<bool>( TextEditor::Property::ENABLE_MARKUP ) );
380   editor.SetProperty( TextEditor::Property::ENABLE_MARKUP, true );
381   DALI_TEST_CHECK( editor.GetProperty<bool>( TextEditor::Property::ENABLE_MARKUP ) );
382
383   // Check input color property.
384   editor.SetProperty( TextEditor::Property::INPUT_COLOR, Color::YELLOW );
385   DALI_TEST_EQUALS( editor.GetProperty<Vector4>( TextEditor::Property::INPUT_COLOR ), Color::YELLOW, TEST_LOCATION );
386
387   // Check input font properties.
388   editor.SetProperty( TextEditor::Property::INPUT_FONT_FAMILY, "Setting input font family" );
389   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
390   editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
391   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}", TEST_LOCATION );
392   editor.SetProperty( TextEditor::Property::INPUT_POINT_SIZE, 12.f );
393   DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
394
395   // Reset input font style.
396   editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
397   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
398   editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"slant\":\"roman\"}" );
399   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
400   editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "" );
401   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), std::string(""), TEST_LOCATION );
402
403   // Check the line spacing property
404   DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
405   editor.SetProperty( TextEditor::Property::LINE_SPACING, 10.f );
406   DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
407
408   // Check the input line spacing property
409   DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
410   editor.SetProperty( TextEditor::Property::INPUT_LINE_SPACING, 20.f );
411   DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_LINE_SPACING ), 20.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
412
413   // Check the underline property
414   editor.SetProperty( TextEditor::Property::UNDERLINE, "Underline properties" );
415   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::UNDERLINE ), std::string("Underline properties"), TEST_LOCATION );
416
417   // Check the input underline property
418   editor.SetProperty( TextEditor::Property::INPUT_UNDERLINE, "Underline input properties" );
419   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_UNDERLINE ), std::string("Underline input properties"), TEST_LOCATION );
420
421   // Check the shadow property
422   editor.SetProperty( TextEditor::Property::SHADOW, "Shadow properties" );
423   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::SHADOW ), std::string("Shadow properties"), TEST_LOCATION );
424
425   // Check the input shadow property
426   editor.SetProperty( TextEditor::Property::INPUT_SHADOW, "Shadow input properties" );
427   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_SHADOW ), std::string("Shadow input properties"), TEST_LOCATION );
428
429   // Check the emboss property
430   editor.SetProperty( TextEditor::Property::EMBOSS, "Emboss properties" );
431   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
432
433   // Check the input emboss property
434   editor.SetProperty( TextEditor::Property::INPUT_EMBOSS, "Emboss input properties" );
435   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_EMBOSS ), std::string("Emboss input properties"), TEST_LOCATION );
436
437   // Check the outline property
438   editor.SetProperty( TextEditor::Property::OUTLINE, "Outline properties" );
439   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
440
441   // Check the input outline property
442   editor.SetProperty( TextEditor::Property::INPUT_OUTLINE, "Outline input properties" );
443   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_OUTLINE ), std::string("Outline input properties"), TEST_LOCATION );
444
445   END_TEST;
446 }
447
448 // Positive Atlas Text Renderer test
449 int utcDaliTextEditorAtlasRenderP(void)
450 {
451   ToolkitTestApplication application;
452   tet_infoline(" UtcDaliToolkitTextEditorAtlasRenderP");
453   StyleManager styleManager = StyleManager::Get();
454   styleManager.ApplyDefaultTheme();
455   TextEditor editor = TextEditor::New();
456   DALI_TEST_CHECK( editor );
457
458   editor.SetProperty( TextEditor::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
459
460   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
461
462   Stage::GetCurrent().Add( editor );
463
464   try
465   {
466     // Render some text with the shared atlas backend
467     editor.SetProperty( TextEditor::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
468     application.SendNotification();
469     application.Render();
470   }
471   catch( ... )
472   {
473     tet_result(TET_FAIL);
474   }
475   END_TEST;
476 }
477
478 // Positive test for the textChanged signal.
479 int utcDaliTextEditorTextChangedP(void)
480 {
481   ToolkitTestApplication application;
482   tet_infoline(" utcDaliTextEditorTextChangedP");
483   TextEditor editor = TextEditor::New();
484   DALI_TEST_CHECK( editor );
485
486   Stage::GetCurrent().Add( editor );
487
488   editor.TextChangedSignal().Connect(&TestTextChangedCallback);
489
490   gTextChangedCallBackCalled = false;
491   editor.SetProperty( TextEditor::Property::TEXT, "ABC" );
492   DALI_TEST_CHECK( gTextChangedCallBackCalled );
493
494   application.SendNotification();
495
496   editor.SetKeyInputFocus();
497
498   gTextChangedCallBackCalled = false;
499   application.ProcessEvent( GenerateKey( "D", "D", 0, 0, 0, Integration::KeyEvent::Down ) );
500   DALI_TEST_CHECK( gTextChangedCallBackCalled );
501
502   END_TEST;
503 }
504
505 int utcDaliTextEditorEvent01(void)
506 {
507   ToolkitTestApplication application;
508   tet_infoline(" utcDaliTextEditorEvent01");
509
510   // Creates a tap event. After creating a tap event the text editor should
511   // have the focus and add text with key events should be possible.
512
513   TextEditor editor = TextEditor::New();
514   DALI_TEST_CHECK( editor );
515
516   Stage::GetCurrent().Add( editor );
517
518   editor.SetSize( 300.f, 50.f );
519   editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
520   editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
521
522   // Avoid a crash when core load gl resources.
523   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
524
525   // Render and notify
526   application.SendNotification();
527   application.Render();
528
529   // Add a key event but as the text editor has not the focus it should do nothing.
530   application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
531
532   // Render and notify
533   application.SendNotification();
534   application.Render();
535
536   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string(""), TEST_LOCATION );
537
538   // Create a tap event to touch the text editor.
539   application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
540   application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
541
542   // Render and notify
543   application.SendNotification();
544   application.Render();
545
546   // Now the text editor has the focus, so it can handle the key events.
547   application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
548   application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
549
550   // Render and notify
551   application.SendNotification();
552   application.Render();
553
554   DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("aa"), TEST_LOCATION );
555
556   // Create a second text editor and send key events to it.
557   TextEditor editor2 = TextEditor::New();
558
559   editor2.SetParentOrigin( ParentOrigin::TOP_LEFT );
560   editor2.SetAnchorPoint( AnchorPoint::TOP_LEFT );
561   editor2.SetSize( 100.f, 100.f );
562   editor2.SetPosition( 100.f, 100.f );
563
564   Stage::GetCurrent().Add( editor2 );
565
566   // Render and notify
567   application.SendNotification();
568   application.Render();
569
570   // Create a tap event on the second text editor.
571   application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
572   application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
573
574   // Render and notify
575   application.SendNotification();
576   application.Render();
577
578   // The second text editor has the focus. It should handle the key events.
579   application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
580   application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
581
582   // Render and notify
583   application.SendNotification();
584   application.Render();
585
586   // Check the text has been added to the second text editor.
587   DALI_TEST_EQUALS( editor2.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("aa"), TEST_LOCATION );
588
589   END_TEST;
590 }
591
592 int utcDaliTextEditorEvent02(void)
593 {
594   ToolkitTestApplication application;
595   tet_infoline(" utcDaliTextEditorEvent02");
596
597   // Checks if the right number of actors are created.
598
599   TextEditor editor = TextEditor::New();
600   editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
601   DALI_TEST_CHECK( editor );
602
603   Stage::GetCurrent().Add( editor );
604
605   editor.SetSize( 300.f, 50.f );
606   editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
607   editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
608
609   // Avoid a crash when core load gl resources.
610   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
611
612   // Render and notify
613   application.SendNotification();
614   application.Render();
615
616   // Check there are the expected number of children ( offscreen root actor, and the offscreen image view
617   DALI_TEST_EQUALS( editor.GetChildCount(), 2u, TEST_LOCATION );
618
619   Actor offscreenRoot = editor.GetChildAt( 0u );
620   DALI_TEST_CHECK( offscreenRoot.IsLayer() );
621   DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor.
622
623   Actor offscreenImage = editor.GetChildAt( 1u );
624   DALI_TEST_CHECK( offscreenImage );
625
626   // Create a tap event to touch the text editor.
627   application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
628   application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
629
630   // Render and notify
631   application.SendNotification();
632   application.Render();
633
634   Actor layer = editor.GetChildAt( 2u );
635   DALI_TEST_CHECK( layer.IsLayer() );
636
637   DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
638   DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor.
639
640   // Now the text editor has the focus, so it can handle the key events.
641   application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
642   application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
643
644   // Render and notify
645   application.SendNotification();
646   application.Render();
647
648   // Checks the cursor and the renderer have been created.
649   DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
650   DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 2u, TEST_LOCATION ); // The camera actor and the renderer
651
652   Control cursor = Control::DownCast( layer.GetChildAt( 0u ) );
653   DALI_TEST_CHECK( cursor );
654
655   CameraActor camera = CameraActor::DownCast( offscreenRoot.GetChildAt( 0u ) );
656   DALI_TEST_CHECK( camera );
657
658   // The offscreen root actor has a container with all the actors which contain the text renderers.
659   Actor container = offscreenRoot.GetChildAt( 1u );
660   for( unsigned int index = 0; index < container.GetChildCount(); ++index )
661   {
662     Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u );
663     DALI_TEST_CHECK( renderer );
664   }
665
666   // Move the cursor and check the position changes.
667   Vector3 position1 = cursor.GetCurrentPosition();
668
669   application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down ) );
670   application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down ) );
671
672   // Render and notify
673   application.SendNotification();
674   application.Render();
675
676   Vector3 position2 = cursor.GetCurrentPosition();
677
678   DALI_TEST_CHECK( position2.x < position1.x );
679
680   application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down ) );
681   application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down ) );
682
683   // Render and notify
684   application.SendNotification();
685   application.Render();
686
687   Vector3 position3 = cursor.GetCurrentPosition();
688
689   DALI_TEST_EQUALS( position1, position3, TEST_LOCATION ); // Should be in the same position1.
690
691   // Send some taps and check the cursor positions.
692
693   // Try to tap at the beginning.
694   application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
695   application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
696
697   // Render and notify
698   application.SendNotification();
699   application.Render();
700
701   // Cursor position should be the same than position1.
702   Vector3 position4 = cursor.GetCurrentPosition();
703
704   DALI_TEST_EQUALS( position2, position4, TEST_LOCATION ); // Should be in the same position2.
705
706   // Tap away from the start position.
707   application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 16.f, 25.0f ) ) );
708   application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 16.0f, 25.0f ) ) );
709
710   // Render and notify
711   application.SendNotification();
712   application.Render();
713
714   Vector3 position5 = cursor.GetCurrentPosition();
715
716   DALI_TEST_CHECK( position5.x > position4.x );
717
718   // Remove all the text.
719   application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
720   application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
721   editor.SetProperty( TextEditor::Property::TEXT, "" );
722
723   // Render and notify
724   application.SendNotification();
725   application.Render();
726
727   // Cursor position should be the same than position2.
728   Vector3 position6 = cursor.GetCurrentPosition();
729
730   DALI_TEST_EQUALS( position2, position6, TEST_LOCATION );// Should be in the same position2.
731
732   // Should not be a renderer.
733   DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor only.
734
735   END_TEST;
736 }
737
738 int utcDaliTextEditorEvent03(void)
739 {
740   ToolkitTestApplication application;
741   tet_infoline(" utcDaliTextEditorEvent03");
742
743   // Checks if the highlight actor is created.
744
745   TextEditor editor = TextEditor::New();
746   DALI_TEST_CHECK( editor );
747
748   Stage::GetCurrent().Add( editor );
749
750   editor.SetProperty( TextEditor::Property::TEXT, "This is a long text for the size of the text-editor." );
751   editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
752   editor.SetSize( 30.f, 50.f );
753   editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
754   editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
755
756   // Avoid a crash when core load gl resources.
757   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
758
759   // Render and notify
760   application.SendNotification();
761   application.Render();
762
763   // Tap first to get the focus.
764   application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
765   application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
766
767   // Render and notify
768   application.SendNotification();
769   application.Render();
770
771   // Double tap to select a word.
772   application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
773   application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
774
775   // Render and notify
776   application.SendNotification();
777   application.Render();
778
779   // The offscreen root actor should have three actors: the camera, a renderer and the highlight actor.
780   Actor offscreenRoot = editor.GetChildAt( 0u );
781   DALI_TEST_CHECK( offscreenRoot.IsLayer() );
782
783   CameraActor camera = CameraActor::DownCast( offscreenRoot.GetChildAt( 0u ) );
784   DALI_TEST_CHECK( camera );
785
786   // The offscreen root actor has a container with all the actors which contain the text renderers.
787   Actor container = offscreenRoot.GetChildAt( 1u );
788   for( unsigned int index = 0; index < container.GetChildCount(); ++index )
789   {
790     Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u );
791     DALI_TEST_CHECK( renderer );
792   }
793
794   Renderer highlight = offscreenRoot.GetChildAt( 2u ).GetRendererAt( 0u );
795   DALI_TEST_CHECK( highlight );
796
797   END_TEST;
798 }