Fixed SVACE errors in Test Graphics
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TableView.cpp
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 #include <stdlib.h>
20 #include <sstream>
21 #include <dali-toolkit-test-suite-utils.h>
22 #include <dali-toolkit/dali-toolkit.h>
23 #include <dali-toolkit/devel-api/controls/table-view/table-view.h>
24
25 using namespace Dali;
26 using namespace Toolkit;
27
28 void dali_tableview_startup(void)
29 {
30   test_return_value = TET_UNDEF;
31 }
32
33 void dali_tableview_cleanup(void)
34 {
35   test_return_value = TET_PASS;
36 }
37
38 namespace
39 {
40
41 const char* const PROPERTY_NAME_ROWS = "rows";
42 const char* const PROPERTY_NAME_COLUMNS = "columns";
43 const char* const PROPERTY_NAME_CELL_PADDING = "cellPadding";
44 const char* const PROPERTY_NAME_LAYOUT_ROWS = "layoutRows";
45 const char* const PROPERTY_NAME_LAYOUT_COLUMNS = "layoutColumns";
46 const Vector2 CELL_SIZE( 10, 10 );
47
48 static bool gObjectCreatedCallBackCalled;
49
50 static void TestCallback(BaseHandle handle)
51 {
52   gObjectCreatedCallBackCalled = true;
53 }
54
55 struct Constraint100
56 {
57   Constraint100( )
58   {
59   }
60
61   /**
62    * function operator to apply the parent size
63    */
64   void operator()( Dali::Vector3& current, const PropertyInputContainer& /* inputs */ )
65   {
66     current.x = current.y = current.z = 100.0f;
67   }
68 };
69
70 // Convenience function to quickly set up a 10x10 table with each cell being 10x10 pixels in size by default.
71 static void SetupTableViewAndActors(Integration::Scene scene, TableView& tableView, Actor& actor1, Actor& actor2, Actor& actor3)
72 {
73   tableView = TableView::New( 10, 10 ); // 10 by 10 grid.
74   DALI_TEST_CHECK( tableView );
75
76   scene.Add( tableView );
77   tableView.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) );
78
79   actor1 = Actor::New();
80   actor2 = Actor::New();
81   actor3 = Actor::New();
82
83   actor1.SetProperty( Actor::Property::SIZE, CELL_SIZE );
84   actor2.SetProperty( Actor::Property::SIZE, CELL_SIZE );
85   actor3.SetProperty( Actor::Property::SIZE, CELL_SIZE );
86
87   tableView.AddChild( actor1, TableView::CellPosition( 0, 0 ) );
88   tableView.AddChild( actor2, TableView::CellPosition( 0, 1 ) );
89   tableView.AddChild( actor3, TableView::CellPosition( 1, 0 ) );
90 }
91
92 } // namespace
93
94 int UtcDaliTableViewCtorCopyP(void)
95 {
96   ToolkitTestApplication application;
97
98   TableView actor1 = TableView::New(10,10);
99   TableView actor2( actor1 );
100
101   DALI_TEST_EQUALS( actor1, actor2, TEST_LOCATION );
102   END_TEST;
103 }
104
105 int UtcDaliTableViewNew(void)
106 {
107   ToolkitTestApplication application;
108
109   TableView tableView = TableView::New(10,10);
110   DALI_TEST_CHECK(tableView);
111
112   //Additional check to ensure object is created by checking if it's registered
113   ObjectRegistry registry = application.GetCore().GetObjectRegistry();
114   DALI_TEST_CHECK( registry );
115
116   gObjectCreatedCallBackCalled = false;
117   registry.ObjectCreatedSignal().Connect(&TestCallback);
118   {
119     TableView tableView = TableView::New(10,10);
120   }
121   DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
122   END_TEST;
123 }
124
125 // Test adjusting the metric values for the cell.
126 int UtcDaliTableViewMetricsPadding(void)
127 {
128   ToolkitTestApplication application;
129
130   tet_infoline("UtcDaliTableViewMetricsPadding");
131
132   TableView tableView;
133   Actor actor1;
134   Actor actor2;
135   Actor actor3;
136
137   SetupTableViewAndActors(application.GetScene(), tableView, actor1, actor2, actor3);
138
139   // 1. check that padding works. no padding:
140   tableView.SetCellPadding(Size(0.0f, 0.0f));
141   application.SendNotification();
142   application.Render();
143
144   DALI_TEST_EQUALS( tableView.GetCellPadding(), Size(0.0f, 0.0f), TEST_LOCATION );
145   DALI_TEST_EQUALS( actor1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
146   DALI_TEST_EQUALS( actor2.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION );
147   DALI_TEST_EQUALS( actor3.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION );
148
149   // 1. check that padding works. some padding:
150   tableView.SetCellPadding(Size(5.0f, 10.0f));
151   application.SendNotification();
152   application.Render();
153
154   DALI_TEST_EQUALS( tableView.GetCellPadding(), Size(5.0f, 10.0f), TEST_LOCATION );
155   DALI_TEST_EQUALS( actor1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(5.0f, 10.0f, 0.0f), TEST_LOCATION );
156   END_TEST;
157 }
158
159 // Test adjusting the metric values for the cell.
160 int UtcDaliTableViewMetricsFit(void)
161 {
162   ToolkitTestApplication application;
163
164   tet_infoline("UtcDaliTableViewMetricsFit");
165
166   TableView tableView;
167   Actor actor1;
168   Actor actor2;
169   Actor actor3;
170
171   SetupTableViewAndActors(application.GetScene(), tableView, actor1, actor2, actor3);
172   application.SendNotification();
173   application.Render();
174
175   // 1. check that with no fixed width/heights, actors are in default position.
176   DALI_TEST_EQUALS( actor1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
177   DALI_TEST_EQUALS( actor2.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION );
178   DALI_TEST_EQUALS( actor3.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION );
179
180   // 2. check that with a fixed width & height, actors to the right and below are offsetted.
181   tableView.SetFitHeight(0);
182   tableView.SetFitWidth(0);
183   DALI_TEST_EQUALS( tableView.IsFitHeight(0), true, TEST_LOCATION );
184   DALI_TEST_EQUALS( tableView.IsFitWidth(0), true, TEST_LOCATION );
185
186   application.SendNotification();
187   application.Render();
188
189   DALI_TEST_EQUALS( actor1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
190   DALI_TEST_EQUALS( actor2.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION );
191   DALI_TEST_EQUALS( actor3.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION );
192
193   tableView.SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,  Dali::LayoutDirection::RIGHT_TO_LEFT );
194   application.SendNotification();
195   application.Render();
196
197   DALI_TEST_EQUALS( actor1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(90.0f, 0.0f, 0.0f), TEST_LOCATION );
198   DALI_TEST_EQUALS( actor2.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(80.0f, 0.0f, 0.0f), TEST_LOCATION );
199   DALI_TEST_EQUALS( actor3.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(90.0f, 10.0f, 0.0f), TEST_LOCATION );
200
201   tableView.SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,  Dali::LayoutDirection::LEFT_TO_RIGHT );
202   application.SendNotification();
203   application.Render();
204
205   DALI_TEST_EQUALS( actor1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
206   DALI_TEST_EQUALS( actor2.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION );
207   DALI_TEST_EQUALS( actor3.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION );
208
209   END_TEST;
210 }
211
212 // Test adjusting the metric values for the cell.
213 int UtcDaliTableViewMetricsFixed(void)
214 {
215   ToolkitTestApplication application;
216
217   tet_infoline("UtcDaliTableViewMetricsFixed");
218
219   TableView tableView;
220   Actor actor1;
221   Actor actor2;
222   Actor actor3;
223
224   SetupTableViewAndActors(application.GetScene(), tableView, actor1, actor2, actor3);
225   application.SendNotification();
226   application.Render();
227
228   // 1. check that with no fixed width/heights, actors are in default position.
229   DALI_TEST_EQUALS( actor1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
230   DALI_TEST_EQUALS( actor2.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION );
231   DALI_TEST_EQUALS( actor3.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION );
232
233   // 2. check that with a fixed width & height, actors to the right and below are offsetted.
234   tableView.SetFixedWidth(0, 20.0f);
235   tableView.SetFixedHeight(0, 50.0f);
236   DALI_TEST_EQUALS( tableView.GetFixedWidth(0), 20.0f, TEST_LOCATION );
237   DALI_TEST_EQUALS( tableView.GetFixedHeight(0), 50.0f, TEST_LOCATION );
238
239   application.SendNotification();
240   application.Render();
241
242   DALI_TEST_EQUALS( actor1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
243   DALI_TEST_EQUALS( actor2.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20.0f, 0.0f, 0.0f), TEST_LOCATION );
244   DALI_TEST_EQUALS( actor3.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 50.0f, 0.0f), TEST_LOCATION );
245   END_TEST;
246 }
247
248 // Test adjusting the metric values for the cell.
249 int UtcDaliTableViewMetricsRelative(void)
250 {
251   ToolkitTestApplication application;
252
253   tet_infoline("UtcDaliTableViewMetricsRelative");
254
255   TableView tableView;
256   Actor actor1;
257   Actor actor2;
258   Actor actor3;
259
260   SetupTableViewAndActors(application.GetScene(), tableView, actor1, actor2, actor3);
261   application.SendNotification();
262   application.Render();
263
264   // 1. check that with no relative width/heights, actors are in default position.
265   DALI_TEST_EQUALS( actor1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
266   DALI_TEST_EQUALS( actor2.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION );
267   DALI_TEST_EQUALS( actor3.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION );
268
269   // 2. check that with a relative width & height, actors to the right and below are offsetted.
270   tableView.SetRelativeWidth(0, 0.3f); // cell 0,0 occupies 30%x50% of the grid (i.e. 30x50 pixels)
271   tableView.SetRelativeHeight(0, 0.5f);
272   DALI_TEST_EQUALS( tableView.GetRelativeWidth(0), 0.3f, TEST_LOCATION );
273   DALI_TEST_EQUALS( tableView.GetRelativeHeight(0), 0.5f, TEST_LOCATION );
274
275   application.SendNotification();
276   application.Render();
277
278   DALI_TEST_EQUALS( actor1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
279   DALI_TEST_EQUALS( actor2.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(30.0f, 0.0f, 0.0f), TEST_LOCATION );
280   DALI_TEST_EQUALS( actor3.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0f, 50.0f, 0.0f), TEST_LOCATION );
281   END_TEST;
282 }
283
284
285 // Test Adding/Removing/Finding Children.
286 int UtcDaliTableViewChild(void)
287 {
288   ToolkitTestApplication application;
289
290   tet_infoline("UtcDaliTableViewChild");
291
292   // Create a 10x10 table-view
293   TableView tableView = TableView::New(10,10);
294   DALI_TEST_CHECK( tableView );
295
296   // Check if actor doesn't exist.
297   DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(0,0)) );
298
299   // Add an actor to it at 0,0
300   Actor actor = Actor::New();
301   tableView.AddChild(actor, TableView::CellPosition());
302
303   // Check if exists.
304   DALI_TEST_CHECK( tableView.GetChildAt(TableView::CellPosition(0,0)) );
305
306   // Remove this actor
307   tableView.RemoveChildAt(TableView::CellPosition());
308
309   // Check if actor no longer exists.
310   DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(0,0)) );
311
312   // Add actor to it again, but at 2,5
313   tableView.AddChild(actor, TableView::CellPosition(2,5));
314
315   // Add another actor somewhere else 7,8
316   Actor actor2 = Actor::New();
317   tableView.AddChild(actor2, TableView::CellPosition(7,8));
318
319   Actor searchActor;
320
321   // Check that no actor exists in a few random places.
322   DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(0,0)) );
323   DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(2,1)) );
324   DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(6,3)) );
325   DALI_TEST_CHECK( !tableView.GetChildAt(TableView::CellPosition(9,5)) );
326
327   // Check for actors at actual positions.
328   searchActor = tableView.GetChildAt(TableView::CellPosition(2,5));
329   DALI_TEST_CHECK( searchActor == actor);
330
331   searchActor = tableView.GetChildAt(TableView::CellPosition(7,8));
332   DALI_TEST_CHECK( searchActor == actor2);
333
334   // Create a second table, and add already added Child to new one.
335   TableView tableView2 = TableView::New(5,5);
336   tableView2.AddChild(actor, TableView::CellPosition(2,2));
337   DALI_TEST_CHECK( tableView2.GetChildAt(TableView::CellPosition(2,2)) );
338   END_TEST;
339 }
340
341 // Test calling Add on it's own (to invoke the OnChildAdd)
342 int UtcDaliTableViewAdd(void)
343 {
344   ToolkitTestApplication application;
345
346   tet_infoline("UtcDaliTableViewAdd");
347
348   // Create a 4x1 table-view, and just keep adding.
349   TableView tableView = TableView::New(1,4);
350   DALI_TEST_CHECK( tableView );
351
352   for(unsigned int i = 0;i<16;i++)
353   {
354     Actor currentActor = Actor::New();
355     TableView::CellPosition position = TableView::CellPosition();
356     tableView.Add( currentActor );
357     tableView.FindChildPosition(currentActor, position);
358     tet_printf("%dx%d (%d,%d)\n", tableView.GetColumns(), tableView.GetRows(), position.columnIndex, position.rowIndex);
359
360     DALI_TEST_EQUALS((position.rowIndex * 4 + position.columnIndex), i, TEST_LOCATION);
361   }
362   END_TEST;
363 }
364
365 // Test cell modification.
366 int UtcDaliTableViewCells(void)
367 {
368   ToolkitTestApplication application;
369   tet_infoline("UtcDaliTableViewCells");
370
371   // Create a 10x10 table-view
372   TableView tableView = TableView::New(10,10);
373   DALI_TEST_CHECK( tableView );
374
375   // Add a few actors to the table.
376   Actor actor1 = Actor::New();
377   Actor actor2 = Actor::New();
378   Actor actor3 = Actor::New();
379   actor1.SetProperty( Dali::Actor::Property::NAME,"Actor1");
380   actor2.SetProperty( Dali::Actor::Property::NAME,"Actor2");
381   actor3.SetProperty( Dali::Actor::Property::NAME,"Actor3");
382
383   // note: positions are specified in reversed cartesian coords - row,col (i.e. y,x)
384   tableView.AddChild(actor1, TableView::CellPosition(0,0));
385   tableView.AddChild(actor2, TableView::CellPosition(5,5));
386   tableView.AddChild(actor3, TableView::CellPosition(7,2));
387
388   DALI_TEST_CHECK( tableView.GetRows() == 10 && tableView.GetColumns() == 10 );
389
390   // Add a row between actor1 and actor2 | insert column on actor1 and see what happens...
391   tableView.InsertRow(3);
392   tableView.InsertColumn(0);
393   DALI_TEST_CHECK( tableView.GetRows() == 11 && tableView.GetColumns() == 11 );
394
395   TableView::CellPosition cellPosition;
396   bool result;
397
398   result = tableView.FindChildPosition(actor1, cellPosition);
399   DALI_TEST_CHECK( result && cellPosition.rowIndex == 0 && cellPosition.columnIndex == 1);
400   result = tableView.FindChildPosition(actor2, cellPosition);
401   DALI_TEST_CHECK( result && cellPosition.rowIndex == 6 && cellPosition.columnIndex == 6);
402   result = tableView.FindChildPosition(actor3, cellPosition);
403   DALI_TEST_CHECK( result && cellPosition.rowIndex == 8 && cellPosition.columnIndex == 3);
404
405   // Delete a row between actor2 and actor3 | delete column on actor2 and see what happens...
406   tableView.DeleteRow(7);
407   tableView.DeleteColumn(6);
408   DALI_TEST_CHECK( tableView.GetRows() == 10 && tableView.GetColumns() == 10 );
409
410   result = tableView.FindChildPosition(actor1, cellPosition);
411   DALI_TEST_CHECK( result && cellPosition.rowIndex == 0 && cellPosition.columnIndex == 1);
412   result = tableView.FindChildPosition(actor2, cellPosition);
413   DALI_TEST_CHECK( !result );
414   result = tableView.FindChildPosition(actor3, cellPosition);
415   DALI_TEST_CHECK( result && cellPosition.rowIndex == 7 && cellPosition.columnIndex == 3);
416
417   // Delete the other two remaining actors by a row delete and a column delete.
418   std::vector<Actor> actorsRemoved;
419   tableView.DeleteRow(0, actorsRemoved);
420   tet_printf("Row Delete >> Actors Removed: %d {", actorsRemoved.size());
421   for(size_t i = 0;i<actorsRemoved.size();i++) tet_printf("%d => %s, ", i, actorsRemoved[i].GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str());
422   tet_printf("}\n");
423   DALI_TEST_EQUALS( static_cast<int>(actorsRemoved.size()), 1, TEST_LOCATION );
424   DALI_TEST_CHECK( actorsRemoved[0] == actor1 );
425
426   actorsRemoved.clear();
427   tableView.DeleteColumn(3, actorsRemoved);
428   tet_printf("Column Delete >> Actors Removed: %d {", actorsRemoved.size());
429   for(size_t i = 0;i<actorsRemoved.size();i++) tet_printf("%d => %s, ", i, actorsRemoved[i].GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str());
430   tet_printf("}\n");
431   DALI_TEST_EQUALS( static_cast<int>(actorsRemoved.size()), 1, TEST_LOCATION );
432   DALI_TEST_CHECK( actorsRemoved[0] == actor3 );
433
434   DALI_TEST_CHECK( tableView.GetRows() == 9 && tableView.GetColumns() == 9 );
435
436   tableView.AddChild(actor1, TableView::CellPosition(5,8));
437   tableView.Resize(100,100);
438   DALI_TEST_CHECK( tableView.GetRows() == 100 && tableView.GetColumns() == 100 );
439
440   tableView.AddChild(actor2, TableView::CellPosition(69,57));
441   DALI_TEST_CHECK( tableView.FindChildPosition(actor1, cellPosition) && tableView.FindChildPosition(actor2, cellPosition) );
442
443   tableView.Resize(20,20);
444   DALI_TEST_CHECK( tableView.FindChildPosition(actor1, cellPosition) && !tableView.FindChildPosition(actor2, cellPosition) );
445
446   actorsRemoved.clear();
447   tableView.Resize(1,1, actorsRemoved);
448   DALI_TEST_CHECK( !tableView.FindChildPosition(actor1, cellPosition) && !tableView.FindChildPosition(actor2, cellPosition) );
449   DALI_TEST_EQUALS( static_cast<int>(actorsRemoved.size()), 1, TEST_LOCATION );
450   DALI_TEST_CHECK( actorsRemoved[0] == actor1 );
451
452   // Add child outside table size, forcing a resize.
453   tableView.AddChild(actor1, TableView::CellPosition(100, 100, 1, 1));
454   DALI_TEST_CHECK( tableView.GetRows() == 101 && tableView.GetColumns() == 101 );
455
456   // Add child outside table size, forcing a resize.
457   tableView.AddChild(actor1, TableView::CellPosition(110, 110, 5, 5));
458   DALI_TEST_CHECK( tableView.GetRows() == 115 && tableView.GetColumns() == 115 );
459
460   // Set the alignment of the cell
461   tableView.SetCellAlignment( TableView::CellPosition(100, 100, 1, 1), HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
462   tableView.SetCellAlignment( TableView::CellPosition(110, 110, 5, 5), HorizontalAlignment::LEFT, VerticalAlignment::TOP );
463
464   DALI_TEST_CHECK( true );
465   END_TEST;
466 }
467
468 int UtcDaliTableViewChildAssert(void)
469 {
470   ToolkitTestApplication application;
471   tet_infoline("UtcDaliTableViewChildAssert");
472
473   // Create a 10x10 table-view
474   TableView tableView = TableView::New(10,10);
475   DALI_TEST_CHECK( tableView );
476   Actor childActor;
477
478   try
479   {
480     tableView.AddChild( childActor, TableView::CellPosition(0,0,5,5) );
481     // should assert
482     tet_result(TET_FAIL);
483   }
484   catch( Dali::DaliException& e )
485   {
486     DALI_TEST_PRINT_ASSERT( e );
487     DALI_TEST_EQUALS(e.condition, "child", TEST_LOCATION);
488   }
489   END_TEST;
490 }
491
492 int UtcDaliTableViewMetricsAssert(void)
493 {
494   ToolkitTestApplication application;
495   tet_infoline("UtcDaliTableViewChildAssert");
496
497   // Create a 10x10 table-view
498   TableView tableView = TableView::New(10,10);
499   DALI_TEST_CHECK( tableView );
500
501   // fixeds...
502
503   try
504   {
505     tableView.SetFixedHeight( 10, 1.0f );
506
507     tet_result(TET_FAIL);
508   }
509   catch( Dali::DaliException& e )
510   {
511     DALI_TEST_PRINT_ASSERT( e );
512     DALI_TEST_EQUALS(e.condition, "rowIndex < mRowData.Size()", TEST_LOCATION);
513   }
514
515   try
516   {
517     tableView.GetFixedHeight( 10 );
518
519     tet_result(TET_FAIL);
520   }
521   catch( Dali::DaliException& e )
522   {
523     DALI_TEST_PRINT_ASSERT( e );
524     DALI_TEST_EQUALS(e.condition, "rowIndex < mRowData.Size()", TEST_LOCATION);
525   }
526
527   try
528   {
529     tableView.SetFixedWidth( 10, 1.0f );
530
531     tet_result(TET_FAIL);
532   }
533   catch( Dali::DaliException& e )
534   {
535     DALI_TEST_PRINT_ASSERT( e );
536     DALI_TEST_EQUALS(e.condition, "columnIndex < mColumnData.Size()", TEST_LOCATION);
537   }
538
539   try
540   {
541     tableView.GetFixedWidth( 10 );
542
543     tet_result(TET_FAIL);
544   }
545   catch( Dali::DaliException& e )
546   {
547     DALI_TEST_PRINT_ASSERT( e );
548     DALI_TEST_EQUALS(e.condition, "columnIndex < mColumnData.Size()", TEST_LOCATION);
549   }
550
551   // relatives...
552
553   try
554   {
555     tableView.SetRelativeHeight( 10, 0.1f );
556
557     tet_result(TET_FAIL);
558   }
559   catch( Dali::DaliException& e )
560   {
561     DALI_TEST_PRINT_ASSERT( e );
562     DALI_TEST_EQUALS(e.condition, "rowIndex < mRowData.Size()", TEST_LOCATION);
563   }
564
565   try
566   {
567     tableView.GetRelativeHeight( 10 );
568
569     tet_result(TET_FAIL);
570   }
571   catch( Dali::DaliException& e )
572   {
573     DALI_TEST_PRINT_ASSERT( e );
574     DALI_TEST_EQUALS(e.condition, "rowIndex < mRowData.Size()", TEST_LOCATION);
575   }
576
577   try
578   {
579     tableView.SetRelativeWidth( 10, 0.1f );
580
581     tet_result(TET_FAIL);
582   }
583   catch( Dali::DaliException& e )
584   {
585     DALI_TEST_PRINT_ASSERT( e );
586     DALI_TEST_EQUALS(e.condition, "columnIndex < mColumnData.Size()", TEST_LOCATION);
587   }
588
589   try
590   {
591     tableView.GetRelativeWidth( 10 );
592
593     tet_result(TET_FAIL);
594   }
595   catch( Dali::DaliException& e )
596   {
597     DALI_TEST_PRINT_ASSERT( e );
598     DALI_TEST_EQUALS(e.condition, "columnIndex < mColumnData.Size()", TEST_LOCATION);
599   }
600   END_TEST;
601 }
602
603 int UtcDaliTableViewSetGetProperty(void)
604 {
605   ToolkitTestApplication application;
606   tet_infoline("UtcDaliTableViewSetGetProperty");
607
608   // Create a 1x1 table-view
609   TableView tableView = TableView::New(1,1);
610   tableView.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
611   DALI_TEST_CHECK( tableView );
612
613   // Test "rows" property
614   DALI_TEST_CHECK( tableView.GetPropertyIndex( PROPERTY_NAME_ROWS ) == TableView::Property::ROWS );
615
616   tableView.SetProperty( TableView::Property::ROWS, 4 );
617
618   DALI_TEST_CHECK( tableView.GetRows() == 4u );
619   DALI_TEST_CHECK( tableView.GetProperty(TableView::Property::ROWS).Get<int>() == 4 );
620
621   // Test "columns" property
622   DALI_TEST_CHECK( tableView.GetPropertyIndex( PROPERTY_NAME_COLUMNS ) == TableView::Property::COLUMNS );
623
624   tableView.SetProperty( TableView::Property::COLUMNS, 5 );
625
626   DALI_TEST_CHECK( tableView.GetColumns() == 5u );
627   DALI_TEST_CHECK( tableView.GetProperty(TableView::Property::COLUMNS).Get<int>() == 5 );
628
629   // Test "cellPadding" property
630   DALI_TEST_CHECK( tableView.GetPropertyIndex( PROPERTY_NAME_CELL_PADDING ) == TableView::Property::CELL_PADDING );
631
632   tableView.SetProperty( TableView::Property::CELL_PADDING, Size( 6.f, 8.f ) );
633
634   DALI_TEST_EQUALS( tableView.GetCellPadding(), Size(6.f, 8.f), TEST_LOCATION );
635   DALI_TEST_EQUALS( tableView.GetProperty(TableView::Property::CELL_PADDING).Get<Vector2>(), Vector2(6.f,8.f), TEST_LOCATION );
636
637   //{ "policy": "fixed", "value": 30.0 },
638   Property::Map item1;
639   item1[ "policy" ] = "fixed";
640   item1[ "value" ] = 30.f;
641   //{ "policy": "relative", "value": 0.2 },
642   Property::Map item2;
643   item2[ "policy" ] = "relative";
644   item2[ "value" ] = 0.2f;
645
646   // Test "layoutRows" property
647   DALI_TEST_CHECK( tableView.GetPropertyIndex(PROPERTY_NAME_LAYOUT_ROWS) == TableView::Property::LAYOUT_ROWS );
648
649   /*
650    * "layoutRows":
651    *  {
652    *    "1": { "policy": "fixed", "value": 30 },
653    *    "3": { "policy": "relative", "value": 0.2 }
654    *   }
655    */
656   Property::Map layoutRows;
657   layoutRows[ "1" ] = item1;
658   layoutRows[ "3" ] = item2;
659   tableView.SetProperty( TableView::Property::LAYOUT_ROWS, layoutRows );
660
661   DALI_TEST_EQUALS( tableView.GetFixedHeight( 1u ), 30.f, TEST_LOCATION );
662   DALI_TEST_EQUALS( tableView.GetRelativeHeight( 3u ), 0.2f, TEST_LOCATION );
663
664   Property::Map layoutRowsGet = tableView.GetProperty(TableView::Property::LAYOUT_ROWS).Get<Property::Map>();
665
666   DALI_TEST_EQUALS( layoutRowsGet.GetKey(1).compare(layoutRows.GetKey(0)), 0, TEST_LOCATION );
667   Property::Map* childMap =layoutRowsGet.GetValue(1).GetMap();
668   DALI_TEST_CHECK( childMap->Find( "policy" )->Get<std::string>().compare("fixed") == 0 );
669   DALI_TEST_EQUALS( childMap->Find( "value" )->Get<float>(), 30.f, TEST_LOCATION );
670
671   childMap =layoutRowsGet.GetValue(3).GetMap();
672   DALI_TEST_CHECK( layoutRowsGet.GetKey(3).compare(layoutRows.GetKey(1)) == 0 );
673   DALI_TEST_CHECK( childMap->Find( "policy" )->Get<std::string>().compare("relative") == 0 );
674   DALI_TEST_EQUALS( childMap->Find( "value" )->Get<float>(), 0.2f, TEST_LOCATION );
675
676   // Test "layoutColumns" property
677   DALI_TEST_CHECK( tableView.GetPropertyIndex( PROPERTY_NAME_LAYOUT_COLUMNS ) == TableView::Property::LAYOUT_COLUMNS );
678
679   /*
680    * "layoutColumns":
681    *  {
682    *    "2": { "policy": "relative", "value": 0.2 },
683    *    "3": { "policy": "fixed", "value": 30 }
684    *   }
685    */
686   Property::Map layoutColumns;
687   layoutColumns[ "2" ] = item2;
688   layoutColumns[ "3" ] = item1;
689   tableView.SetProperty( TableView::Property::LAYOUT_COLUMNS, layoutColumns );
690
691   DALI_TEST_EQUALS( tableView.GetRelativeWidth( 2u ), 0.2f, TEST_LOCATION );
692   DALI_TEST_EQUALS( tableView.GetFixedWidth( 3u ), 30.f, TEST_LOCATION );
693
694   Property::Map layoutColumnsGet = tableView.GetProperty(TableView::Property::LAYOUT_COLUMNS).Get<Property::Map>();
695   DALI_TEST_CHECK( layoutColumnsGet.GetKey(2).compare(layoutColumns.GetKey(0)) == 0 );
696   childMap =layoutColumnsGet.GetValue(2).GetMap();
697   DALI_TEST_CHECK( childMap->Find( "policy" )->Get<std::string>().compare("relative") == 0 );
698   DALI_TEST_EQUALS( childMap->Find( "value" )->Get<float>(), 0.2f, TEST_LOCATION );
699   childMap =layoutColumnsGet.GetValue(3).GetMap();
700   DALI_TEST_CHECK( layoutColumnsGet.GetKey(3).compare(layoutColumns.GetKey(1)) == 0 );
701   DALI_TEST_CHECK( childMap->Find( "policy" )->Get<std::string>().compare("fixed") == 0 );
702   DALI_TEST_EQUALS( childMap->Find( "value" )->Get<float>(),30.f, TEST_LOCATION );
703
704   END_TEST;
705 }
706
707 int UtcDaliTableViewChildProperties(void)
708 {
709   ToolkitTestApplication application;
710   tet_infoline("UtcDaliTableViewChildProperties");
711
712   // Create a 10x10 table-view
713   TableView tableView = TableView::New(10,10);
714   application.GetScene().Add( tableView );
715   tableView.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) );
716
717   DALI_TEST_CHECK( tableView );
718
719   // Create a child actor with the custom properties
720   Actor child1 = Actor::New();
721   child1.SetProperty( TableView::ChildProperty::CELL_INDEX, Vector2( 3, 4 ) );
722   tableView.Add( child1 );
723   // Check for actors at actual positions.
724   DALI_TEST_CHECK( tableView.GetChildAt(TableView::CellPosition(3,4)) == child1);
725
726   // Create a second child actor with the custom properties
727   Actor child2 = Actor::New();
728   float rowSpan = 3.f;
729   float columnSpan = 2.f;
730   child2.SetProperty( TableView::ChildProperty::CELL_INDEX, Vector2( 6, 1 ) );
731   child2.SetProperty( TableView::ChildProperty::ROW_SPAN, rowSpan );
732   child2.SetProperty( TableView::ChildProperty::COLUMN_SPAN, columnSpan );
733   tableView.Add( child2 );
734   // Check for actors at actual positions.
735   for( int i=0; i<rowSpan; i++ )
736   {
737     for(int j=0; j<columnSpan; j++)
738     {
739       DALI_TEST_CHECK( tableView.GetChildAt(TableView::CellPosition(6+i,1+j)) == child2);
740     }
741   }
742
743   // Create a third child actor with the cell alignment properties
744   Actor child3 = Actor::New();
745   child3.SetProperty( Actor::Property::SIZE, Vector2( 5.f, 5.f ) );
746   child3.SetProperty( TableView::ChildProperty::CELL_HORIZONTAL_ALIGNMENT, "center" );
747   child3.SetProperty( TableView::ChildProperty::CELL_VERTICAL_ALIGNMENT,   "bottom" );
748   tableView.Add( child3 );
749
750   // store the actor in the first available cell
751   DALI_TEST_CHECK( tableView.GetChildAt(TableView::CellPosition(0,0)) == child3)
752   application.SendNotification();
753   application.Render();
754
755   DALI_TEST_EQUALS( child3.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), AnchorPoint::TOP_LEFT, TEST_LOCATION );
756   DALI_TEST_EQUALS( child3.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_LEFT, TEST_LOCATION );
757   DALI_TEST_EQUALS( child3.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(2.5f, 5.0f, 0.0f), TEST_LOCATION );
758
759   END_TEST;
760 }
761
762 int UtcDaliTableViewGetChildAtN(void)
763 {
764   ToolkitTestApplication application;
765
766   TableView tableView = TableView::New(10,10);
767
768   Actor actor = tableView.GetChildAt( TableView::CellPosition( 200, 200 ) );
769   DALI_TEST_CHECK( !actor );
770
771   END_TEST;
772 }
773
774 int UtcDaliTableViewAddChildN(void)
775 {
776   ToolkitTestApplication application;
777
778   TableView tableView = TableView::New(10,10);
779   DALI_TEST_CHECK( tableView.AddChild( Actor::New(), TableView::CellPosition( 0, 0 ) ) );
780   DALI_TEST_CHECK( ! tableView.AddChild( Actor::New(), TableView::CellPosition( 0, 0 ) ) );
781
782   END_TEST;
783 }
784
785 int UtcDaliTableViewInsertRowAtZero(void)
786 {
787   ToolkitTestApplication application;
788
789   TableView tableView = TableView::New(10,10);
790   DALI_TEST_CHECK( tableView.AddChild( Actor::New(), TableView::CellPosition( 0, 0 , 10, 10 ) ) );
791   tableView.InsertRow(0);
792
793   DALI_TEST_CHECK( tableView.GetRows() == 11 );
794
795   END_TEST;
796 }
797
798 int UtcDaliTableViewDeleteRowAtZero(void)
799 {
800   ToolkitTestApplication application;
801
802   TableView tableView = TableView::New(10,10);
803   DALI_TEST_CHECK( tableView.AddChild( Actor::New(), TableView::CellPosition( 0, 0 , 10, 10 ) ) );
804   tableView.DeleteRow(0);
805
806   DALI_TEST_CHECK( tableView.GetRows() == 9 );
807
808   END_TEST;
809 }
810
811 int UtcDaliTableViewInsertColumnAtZero(void)
812 {
813   ToolkitTestApplication application;
814
815   TableView tableView = TableView::New(10,10);
816   DALI_TEST_CHECK( tableView.AddChild( Actor::New(), TableView::CellPosition( 0, 0 , 10, 10 ) ) );
817   tableView.InsertColumn(0);
818
819   DALI_TEST_CHECK( tableView.GetColumns() == 11 );
820
821   END_TEST;
822 }
823
824 int UtcDaliTableViewDeleteColumnAtZero(void)
825 {
826   ToolkitTestApplication application;
827
828   TableView tableView = TableView::New(10,10);
829   DALI_TEST_CHECK( tableView.AddChild( Actor::New(), TableView::CellPosition( 0, 0 , 10, 10 ) ) );
830   tableView.DeleteColumn(0);
831
832   DALI_TEST_CHECK( tableView.GetColumns() == 9 );
833
834   END_TEST;
835 }
836
837 int UtcDaliTableViewTypeRegistry(void)
838 {
839   ToolkitTestApplication application;
840
841   TypeRegistry typeRegistry = TypeRegistry::Get();
842   DALI_TEST_CHECK( typeRegistry );
843
844   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "TableView" );
845   DALI_TEST_CHECK( typeInfo );
846
847   BaseHandle handle = typeInfo.CreateInstance();
848   DALI_TEST_CHECK( handle );
849
850   TableView view = TableView::DownCast( handle );
851   DALI_TEST_CHECK( view );
852
853   END_TEST;
854 }
855
856 int UtcDaliTableViewKeyboardFocus(void)
857 {
858   ToolkitTestApplication application;
859
860   TableView tableView = TableView::New(4,4);
861   tableView.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
862   tableView.SetProperty( Dali::Actor::Property::NAME, "TableView");
863
864   for ( int row = 0; row < 4; ++row )
865   {
866     for ( int col = 0; col < 4; ++col )
867     {
868       Control control = Control::New();
869       std::ostringstream str;
870       str << row << "-" << col;
871       control.SetProperty( Dali::Actor::Property::NAME, str.str() );
872       control.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
873       tableView.AddChild( control, TableView::CellPosition( row, col ) );
874     }
875   }
876
877   application.GetScene().Add( tableView );
878
879   application.SendNotification();
880   application.Render();
881
882   Actor firstFocusActor = Toolkit::Internal::GetImplementation( tableView ).GetNextKeyboardFocusableActor( Actor(), Control::KeyboardFocus::RIGHT, true );
883   DALI_TEST_CHECK( firstFocusActor );
884   DALI_TEST_CHECK( firstFocusActor.GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-0" );
885
886   KeyboardFocusManager manager = KeyboardFocusManager::Get();
887   manager.SetFocusGroupLoop( true );
888   manager.SetCurrentFocusActor( firstFocusActor );
889
890   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-0" );
891   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
892   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-1" );
893   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
894   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-2" );
895   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
896   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-3" );
897   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
898   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-0" );
899
900   manager.MoveFocus( Control::KeyboardFocus::LEFT );
901   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-3" );
902   manager.MoveFocus( Control::KeyboardFocus::LEFT );
903   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-2" );
904   manager.MoveFocus( Control::KeyboardFocus::LEFT );
905   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-1" );
906   manager.MoveFocus( Control::KeyboardFocus::LEFT );
907   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-0" );
908   manager.MoveFocus( Control::KeyboardFocus::LEFT );
909   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "3-3" );
910
911   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
912   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-0" );
913   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
914   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-1" );
915
916   manager.MoveFocus( Control::KeyboardFocus::DOWN );
917   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1" );
918   manager.MoveFocus( Control::KeyboardFocus::DOWN );
919   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "2-1" );
920   manager.MoveFocus( Control::KeyboardFocus::DOWN );
921   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "3-1" );
922   manager.MoveFocus( Control::KeyboardFocus::DOWN );
923   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-1" );
924
925   manager.MoveFocus( Control::KeyboardFocus::UP );
926   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "3-1" );
927   manager.MoveFocus( Control::KeyboardFocus::UP );
928   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "2-1" );
929   manager.MoveFocus( Control::KeyboardFocus::UP );
930   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1" );
931   manager.MoveFocus( Control::KeyboardFocus::UP );
932   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-1" );
933
934   END_TEST;
935 }
936
937 int UtcDaliTableViewKeyboardFocusInNestedTableView(void)
938 {
939   ToolkitTestApplication application;
940
941   TableView tableView = TableView::New(3, 3);
942   tableView.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
943   tableView.SetProperty( Dali::Actor::Property::NAME, "TableView");
944
945   for ( int row = 0; row < 3; ++row )
946   {
947     for ( int col = 0; col < 3; ++col )
948     {
949       std::ostringstream str;
950       str << row << "-" << col;
951
952       if (row == 1 && col ==1)
953       {
954         // Add a nested 2x2 table view in the middle cell of the parent table view
955         TableView childTableView = TableView::New(2, 2);
956         childTableView.SetProperty( Dali::Actor::Property::NAME, str.str() );
957
958         for(int childRow = 0; childRow < 2; childRow++)
959         {
960           for(int childCol = 0; childCol < 2; childCol++)
961           {
962             Control control = Control::New();
963             std::ostringstream nameStr;
964             nameStr << row << "-" << col << "-" << childRow << "-" << childCol;
965             control.SetProperty( Dali::Actor::Property::NAME, nameStr.str() );
966             control.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
967             childTableView.AddChild( control, TableView::CellPosition( childRow, childCol ) );
968           }
969         }
970         tableView.AddChild( childTableView, TableView::CellPosition( row, col ) );
971       }
972       else
973       {
974         Control control = Control::New();
975         control.SetProperty( Dali::Actor::Property::NAME, str.str() );
976         control.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
977         tableView.AddChild( control, TableView::CellPosition( row, col ) );
978       }
979     }
980   }
981
982   application.GetScene().Add( tableView );
983
984   application.SendNotification();
985   application.Render();
986
987   Actor firstFocusActor = Toolkit::Internal::GetImplementation( tableView ).GetNextKeyboardFocusableActor( Actor(), Control::KeyboardFocus::RIGHT, true );
988   DALI_TEST_CHECK( firstFocusActor );
989   DALI_TEST_CHECK( firstFocusActor.GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-0" );
990
991   KeyboardFocusManager manager = KeyboardFocusManager::Get();
992   manager.SetFocusGroupLoop( false );
993   manager.SetCurrentFocusActor( firstFocusActor );
994
995   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-0" );
996   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
997   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-1" );
998   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
999   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-2" );
1000   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
1001   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-0" );
1002   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
1003   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1-0-0" );
1004   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
1005   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1-0-1" );
1006   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
1007   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1-1-0" );
1008   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
1009   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1-1-1" );
1010   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
1011   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-2" );
1012   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
1013   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "2-0" );
1014   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
1015   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "2-1" );
1016   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
1017   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "2-2" );
1018
1019   manager.MoveFocus( Control::KeyboardFocus::LEFT );
1020   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "2-1" );
1021   manager.MoveFocus( Control::KeyboardFocus::LEFT );
1022   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "2-0" );
1023   manager.MoveFocus( Control::KeyboardFocus::LEFT );
1024   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-2" );
1025   manager.MoveFocus( Control::KeyboardFocus::LEFT );
1026   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1-1-1" );
1027   manager.MoveFocus( Control::KeyboardFocus::LEFT );
1028   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1-1-0" );
1029   manager.MoveFocus( Control::KeyboardFocus::LEFT );
1030   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1-0-1" );
1031   manager.MoveFocus( Control::KeyboardFocus::LEFT );
1032   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1-0-0" );
1033   manager.MoveFocus( Control::KeyboardFocus::LEFT );
1034   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-0" );
1035   manager.MoveFocus( Control::KeyboardFocus::LEFT );
1036   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-2" );
1037   manager.MoveFocus( Control::KeyboardFocus::LEFT );
1038   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-1" );
1039   manager.MoveFocus( Control::KeyboardFocus::LEFT );
1040   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-0" );
1041
1042   manager.MoveFocus( Control::KeyboardFocus::RIGHT );
1043   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-1" );
1044   manager.MoveFocus( Control::KeyboardFocus::DOWN );
1045   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1-0-0" );
1046   manager.MoveFocus( Control::KeyboardFocus::DOWN );
1047   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1-1-0" );
1048   manager.MoveFocus( Control::KeyboardFocus::DOWN );
1049   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "2-1" );
1050
1051   manager.MoveFocus( Control::KeyboardFocus::UP );
1052   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1-1-1" );
1053   manager.MoveFocus( Control::KeyboardFocus::UP );
1054   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "1-1-0-1" );
1055   manager.MoveFocus( Control::KeyboardFocus::UP );
1056   DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetProperty< std::string >( Dali::Actor::Property::NAME ) == "0-1" );
1057
1058   END_TEST;
1059 }