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