Buttons to use Visuals
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-PushButton.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
21 // Need to override adaptor classes for toolkit test harness, so include
22 // test harness headers before dali headers.
23 #include <dali-toolkit-test-suite-utils.h>
24
25 #include <dali.h>
26 #include <dali/integration-api/events/touch-event-integ.h>
27 #include <dali-toolkit/dali-toolkit.h>
28
29 using namespace Dali;
30 using namespace Toolkit;
31
32 void utc_dali_toolkit_pushbutton_startup(void)
33 {
34   test_return_value = TET_UNDEF;
35 }
36
37 void utc_dali_toolkit_pushbutton_cleanup(void)
38 {
39   test_return_value = TET_PASS;
40 }
41
42 namespace
43 {
44 static const char* TEST_IMAGE_ONE = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
45
46 static bool gPushButtonSelectedState = false;
47 bool PushButtonSelected( Button button )
48 {
49   gPushButtonSelectedState = button.IsSelected();
50   return true;
51 }
52
53 static bool gPushButtonPressed = false;
54
55 static bool PushButtonPressed( Button button )
56 {
57   gPushButtonPressed = true;
58   return true;
59 }
60
61 static bool gPushButtonReleased = false;
62
63 static bool PushButtonReleased( Button button )
64 {
65   gPushButtonReleased = true;
66   return true;
67 }
68
69 Dali::Integration::Point GetPointDownInside()
70 {
71   Dali::Integration::Point point;
72   point.SetState( PointState::DOWN );
73   point.SetScreenPosition( Vector2( 240, 400 ) );
74   return point;
75 }
76
77 Dali::Integration::Point GetPointUpInside()
78 {
79   Dali::Integration::Point point;
80   point.SetState( PointState::UP );
81   point.SetScreenPosition( Vector2( 240, 400 ) );
82   return point;
83 }
84
85 Dali::Integration::Point GetPointLeave()
86 {
87   Dali::Integration::Point point;
88   point.SetState( PointState::LEAVE );
89   point.SetScreenPosition( Vector2( 240, 400 ) );
90   return point;
91 }
92
93 Dali::Integration::Point GetPointEnter()
94 {
95   Dali::Integration::Point point;
96   point.SetState( PointState::MOTION );
97   point.SetScreenPosition( Vector2( 240, 400 ) );
98   return point;
99 }
100
101 Dali::Integration::Point GetPointDownOutside()
102 {
103   Dali::Integration::Point point;
104   point.SetState( PointState::DOWN );
105   point.SetScreenPosition( Vector2( 10, 10 ) );
106   return point;
107 }
108
109 Dali::Integration::Point GetPointUpOutside()
110 {
111   Dali::Integration::Point point;
112   point.SetState( PointState::UP );
113   point.SetScreenPosition( Vector2( 10, 10 ) );
114   return point;
115 }
116
117 } //namespace
118
119 int UtcDaliPushButtonConstructorP(void)
120 {
121   TestApplication application;
122
123   PushButton button;
124
125   DALI_TEST_CHECK( !button );
126   END_TEST;
127 }
128
129 int UtcDaliPushButtonCopyConstructorP(void)
130 {
131   TestApplication application;
132
133   // Initialize an object, ref count == 1
134   PushButton button = PushButton::New();
135
136   PushButton copy( button );
137   DALI_TEST_CHECK( copy );
138   END_TEST;
139 }
140
141 int UtcDaliPushButtonAssignmentOperatorP(void)
142 {
143   TestApplication application;
144
145   PushButton button = PushButton::New();
146
147   PushButton copy( button );
148   DALI_TEST_CHECK( copy );
149
150   DALI_TEST_CHECK( button == copy );
151   END_TEST;
152 }
153
154 int UtcDaliPushButtonNewP(void)
155 {
156   TestApplication application;
157
158   PushButton button = PushButton::New();
159
160   DALI_TEST_CHECK( button );
161   END_TEST;
162 }
163
164 int UtcDaliPushButtonDownCastP(void)
165 {
166   TestApplication application;
167
168   PushButton button = PushButton::New();
169
170   BaseHandle object(button);
171
172   PushButton button2 = PushButton::DownCast( object );
173   DALI_TEST_CHECK(button2);
174
175   PushButton button3 = DownCast< PushButton >(object);
176   DALI_TEST_CHECK(button3);
177   END_TEST;
178 }
179
180 int UtcDaliPushButtonDownCastN(void)
181 {
182   TestApplication application;
183
184   BaseHandle unInitializedObject;
185
186   PushButton button1 = PushButton::DownCast( unInitializedObject );
187   DALI_TEST_CHECK( !button1 );
188
189   PushButton button2 = DownCast< PushButton >( unInitializedObject );
190   DALI_TEST_CHECK( !button2 );
191   END_TEST;
192 }
193
194 int UtcDaliPushButtonSetGetAutoRepeating(void)
195 {
196   ToolkitTestApplication application;
197   tet_infoline(" UtcDaliPushButtonSetGetAutoRepeating");
198
199   PushButton pushButton = PushButton::New();
200
201   pushButton.SetAutoRepeating( true );
202
203   DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
204
205   pushButton.SetAutoRepeating( false );
206
207   DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
208
209   pushButton.SetAutoRepeating( true );
210
211   DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
212   END_TEST;
213 }
214
215 int UtcDaliPushButtonSetAutoRepeating(void)
216 {
217   ToolkitTestApplication application;
218   tet_infoline("UtcDaliPushButtonSetAutoRepeating\n");
219   tet_infoline("Ensure setting AutoRepeating on a SELECTED Toggle button switches off Toggle\n");
220   PushButton pushButton = PushButton::New();
221
222   const bool INITIAL_TOGGLE_VALUE = true;
223   const bool INITIAL_SELECTED_VALUE = true;
224
225   pushButton.SetProperty( Button::Property::TOGGLABLE, INITIAL_TOGGLE_VALUE);
226   pushButton.SetProperty( Button::Property::SELECTED, INITIAL_SELECTED_VALUE );
227
228   DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::TOGGLABLE  ), INITIAL_TOGGLE_VALUE , TEST_LOCATION );
229   DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), INITIAL_SELECTED_VALUE , TEST_LOCATION );
230
231   pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
232
233   DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::TOGGLABLE ), !INITIAL_TOGGLE_VALUE , TEST_LOCATION );
234
235   END_TEST;
236 }
237
238 int UtcDaliPushButtonSetGetTogglableButton(void)
239 {
240   ToolkitTestApplication application;
241   tet_infoline(" UtcDaliPushButtonSetGetTogglableButton");
242
243   PushButton pushButton = PushButton::New();
244
245   pushButton.SetTogglableButton( true );
246
247   DALI_TEST_CHECK( pushButton.IsTogglableButton() );
248
249   pushButton.SetTogglableButton( false );
250
251   DALI_TEST_CHECK( !pushButton.IsTogglableButton() );
252
253   pushButton.SetTogglableButton( true );
254
255   DALI_TEST_CHECK( pushButton.IsTogglableButton() );
256   END_TEST;
257 }
258
259 int UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton(void)
260 {
261   ToolkitTestApplication application;
262   tet_infoline(" UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton");
263
264   PushButton pushButton = PushButton::New();
265
266   pushButton.SetAutoRepeating( true );
267   pushButton.SetTogglableButton( true );
268
269   DALI_TEST_CHECK( pushButton.IsTogglableButton() );
270   DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
271
272   pushButton.SetTogglableButton( true );
273   pushButton.SetAutoRepeating( true );
274
275   DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
276   DALI_TEST_CHECK( !pushButton.IsTogglableButton() );
277   END_TEST;
278 }
279
280 int UtcDaliPushButtonSetGetSelected01(void)
281 {
282   ToolkitTestApplication application;
283   tet_infoline(" UtcDaliPushButtonSetGetSelected01");
284
285   PushButton pushButton = PushButton::New();
286
287   pushButton.SetTogglableButton( true );
288   pushButton.StateChangedSignal().Connect( &PushButtonSelected );
289
290   gPushButtonSelectedState = false;
291   pushButton.SetSelected( true );
292
293   DALI_TEST_CHECK( pushButton.IsSelected() );
294   DALI_TEST_CHECK( gPushButtonSelectedState );
295
296   pushButton.SetSelected( false );
297
298   DALI_TEST_CHECK( !pushButton.IsSelected() );
299   DALI_TEST_CHECK( !gPushButtonSelectedState );
300
301   pushButton.SetSelected( true );
302
303   DALI_TEST_CHECK( pushButton.IsSelected() );
304   DALI_TEST_CHECK( gPushButtonSelectedState );
305   END_TEST;
306 }
307
308 int UtcDaliPushButtonSetGetSelected02(void)
309 {
310   ToolkitTestApplication application;
311   tet_infoline(" UtcDaliPushButtonSetGetSelected02");
312
313   PushButton pushButton = PushButton::New();
314
315   pushButton.SetTogglableButton( false );
316   pushButton.StateChangedSignal().Connect( &PushButtonSelected );
317
318   gPushButtonSelectedState = false;
319   pushButton.SetSelected( true );
320
321   DALI_TEST_CHECK( !pushButton.IsSelected() );
322   DALI_TEST_CHECK( !gPushButtonSelectedState );
323
324   pushButton.SetSelected( false );
325
326   DALI_TEST_CHECK( !pushButton.IsSelected() );
327   DALI_TEST_CHECK( !gPushButtonSelectedState );
328
329   pushButton.SetSelected( true );
330
331   DALI_TEST_CHECK( !pushButton.IsSelected() );
332   DALI_TEST_CHECK( !gPushButtonSelectedState );
333   END_TEST;
334 }
335
336 int UtcDaliPushButtonSetGetAutorepeatingDelayValues01(void)
337 {
338   ToolkitTestApplication application;
339   tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues01");
340
341   PushButton pushButton = PushButton::New();
342
343   pushButton.SetAutoRepeating( true );
344
345   pushButton.SetInitialAutoRepeatingDelay( 1.f );
346   DALI_TEST_EQUALS( pushButton.GetInitialAutoRepeatingDelay(), 1.f, TEST_LOCATION );
347
348   pushButton.SetNextAutoRepeatingDelay( 1.f );
349   DALI_TEST_EQUALS( pushButton.GetNextAutoRepeatingDelay(), 1.f, TEST_LOCATION );
350   END_TEST;
351 }
352
353 int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void)
354 {
355   ToolkitTestApplication application;
356   tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues02");
357
358   PushButton pushButton = PushButton::New();
359
360   bool assert1( false );
361   bool assert2( false );
362
363   pushButton.SetAutoRepeating( true );
364
365   try
366   {
367     pushButton.SetInitialAutoRepeatingDelay( -1.f );
368   }
369   catch( Dali::DaliException& e )
370   {
371     DALI_TEST_PRINT_ASSERT( e );
372     DALI_TEST_EQUALS(e.condition, "initialAutoRepeatingDelay > 0.f", TEST_LOCATION);
373     assert1 = true;
374   }
375
376   try
377   {
378     pushButton.SetNextAutoRepeatingDelay( -1.f );
379   }
380   catch( Dali::DaliException& e )
381   {
382     DALI_TEST_PRINT_ASSERT( e );
383     DALI_TEST_EQUALS(e.condition, "nextAutoRepeatingDelay > 0.f", TEST_LOCATION);
384     assert2 = true;
385   }
386
387   DALI_TEST_CHECK( assert1 && assert2 );
388   END_TEST;
389 }
390
391 int UtcDaliPushButtonSetLabelText(void)
392 {
393   ToolkitTestApplication application;
394   tet_infoline(" UtcDaliPushButtonSetLabelText");
395
396   const std::string STR( "Hola!" );
397
398   PushButton pushButton = PushButton::New();
399
400   application.SendNotification();
401   application.Render();
402
403   pushButton.SetLabelText( STR );
404
405   DALI_TEST_EQUALS( pushButton.GetLabelText(), STR, TEST_LOCATION );
406
407   END_TEST;
408 }
409
410 int UtcDaliPushButtonPressed(void)
411 {
412   ToolkitTestApplication application;
413   tet_infoline(" UtcDaliPushButtonPressed");
414
415   PushButton pushButton = PushButton::New();
416   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
417   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
418   pushButton.SetPosition( 240, 400 );
419   pushButton.SetSize( 100, 100 );
420
421   Stage::GetCurrent().Add( pushButton );
422
423   application.SendNotification();
424   application.Render();
425
426   gPushButtonPressed = false;
427
428   // connect to its touch signal
429   pushButton.PressedSignal().Connect( &PushButtonPressed );
430
431   Dali::Integration::TouchEvent eventDown;
432   eventDown.AddPoint( GetPointDownInside() );
433
434   // flush the queue and render once
435   application.SendNotification();
436   application.Render();
437   application.ProcessEvent( eventDown );
438
439   DALI_TEST_CHECK( gPushButtonPressed );
440   END_TEST;
441 }
442
443 int UtcDaliPushButtonReleased(void)
444 {
445   ToolkitTestApplication application;
446   tet_infoline(" UtcDaliPushButtonReleased");
447
448   PushButton pushButton = PushButton::New();
449   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
450   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
451   pushButton.SetPosition( 240, 400 );
452   pushButton.SetSize( 100, 100 );
453
454   Stage::GetCurrent().Add( pushButton );
455
456   application.SendNotification();
457   application.Render();
458
459   // connect to its touch signal
460   pushButton.ReleasedSignal().Connect( &PushButtonReleased );
461
462   Dali::Integration::TouchEvent event;
463
464   // Test1. Touch point down and up inside the button.
465
466   gPushButtonReleased = false;
467   event = Dali::Integration::TouchEvent();
468   event.AddPoint( GetPointDownInside() );
469   application.ProcessEvent( event );
470
471   event = Dali::Integration::TouchEvent();
472   event.AddPoint( GetPointUpInside() );
473   application.ProcessEvent( event );
474
475   DALI_TEST_CHECK( gPushButtonReleased );
476
477   // Test2. Touch point down and up outside the button.
478
479   gPushButtonReleased = false;
480   event = Dali::Integration::TouchEvent();
481   event.AddPoint( GetPointDownOutside() );
482   application.ProcessEvent( event );
483
484   event = Dali::Integration::TouchEvent();
485   event.AddPoint( GetPointUpOutside() );
486   application.ProcessEvent( event );
487
488   DALI_TEST_CHECK( !gPushButtonReleased );
489
490   // Test3. Touch point down inside and up outside the button.
491
492   gPushButtonReleased = false;
493   event = Dali::Integration::TouchEvent();
494   event.AddPoint( GetPointDownInside() );
495   application.ProcessEvent( event );
496
497   event = Dali::Integration::TouchEvent();
498   event.AddPoint( GetPointLeave() );
499   application.ProcessEvent( event );
500
501   event = Dali::Integration::TouchEvent();
502   event.AddPoint( GetPointUpOutside() );
503   application.ProcessEvent( event );
504
505   DALI_TEST_CHECK( gPushButtonReleased );
506
507   // Test4. Touch point down outside and up inside the button.
508
509   gPushButtonReleased = false;
510   event = Dali::Integration::TouchEvent();
511   event.AddPoint( GetPointDownOutside() );
512   application.ProcessEvent( event );
513
514   event = Dali::Integration::TouchEvent();
515   event.AddPoint( GetPointEnter() );
516   application.ProcessEvent( event );
517
518   event = Dali::Integration::TouchEvent();
519   event.AddPoint( GetPointUpInside() );
520   application.ProcessEvent( event );
521
522   DALI_TEST_CHECK( !gPushButtonReleased );
523   END_TEST;
524 }
525
526 int UtcDaliPushButtonSelected(void)
527 {
528   ToolkitTestApplication application;
529   tet_infoline(" UtcDaliPushButtonSelected");
530
531   PushButton pushButton = PushButton::New();
532   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
533   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
534   pushButton.SetPosition( 240, 400 );
535   pushButton.SetSize( 100, 100 );
536
537   Stage::GetCurrent().Add( pushButton );
538
539   application.SendNotification();
540   application.Render();
541
542   // connect to its touch signal
543   pushButton.StateChangedSignal().Connect( &PushButtonSelected );
544
545   Dali::Integration::TouchEvent event;
546
547   // Test1. No togglable button.
548
549   gPushButtonSelectedState = false;
550   event = Dali::Integration::TouchEvent();
551   event.AddPoint( GetPointDownInside() );
552   application.ProcessEvent( event );
553
554   event = Dali::Integration::TouchEvent();
555   event.AddPoint( GetPointUpInside() );
556   application.ProcessEvent( event );
557
558   DALI_TEST_CHECK( !gPushButtonSelectedState );
559
560   // Set togglable property.
561   pushButton.SetTogglableButton( true );
562
563   // Test2. Touch point down and up inside the button twice.
564   gPushButtonSelectedState = false;
565   event = Dali::Integration::TouchEvent();
566   event.AddPoint( GetPointDownInside() );
567   application.ProcessEvent( event );
568
569   event = Dali::Integration::TouchEvent();
570   event.AddPoint( GetPointUpInside() );
571   application.ProcessEvent( event );
572
573   DALI_TEST_CHECK( gPushButtonSelectedState );
574
575   event = Dali::Integration::TouchEvent();
576   event.AddPoint( GetPointDownInside() );
577   application.ProcessEvent( event );
578
579   event = Dali::Integration::TouchEvent();
580   event.AddPoint( GetPointUpInside() );
581   application.ProcessEvent( event );
582
583   DALI_TEST_CHECK( !gPushButtonSelectedState );
584
585   // Test3. Touch point down and up outside the button.
586
587   gPushButtonSelectedState = false;
588   event = Dali::Integration::TouchEvent();
589   event.AddPoint( GetPointDownOutside() );
590   application.ProcessEvent( event );
591
592   event = Dali::Integration::TouchEvent();
593   event.AddPoint( GetPointUpOutside() );
594   application.ProcessEvent( event );
595
596   DALI_TEST_CHECK( !gPushButtonSelectedState );
597
598   // Test4. Touch point down inside and up outside the button.
599   //        State changes on Button down
600   gPushButtonSelectedState = false;
601   event = Dali::Integration::TouchEvent();
602   event.AddPoint( GetPointDownInside() );
603   application.ProcessEvent( event );
604
605   event = Dali::Integration::TouchEvent();
606   event.AddPoint( GetPointLeave() );
607   application.ProcessEvent( event );
608
609   event = Dali::Integration::TouchEvent();
610   event.AddPoint( GetPointUpOutside() );
611   application.ProcessEvent( event );
612
613   DALI_TEST_CHECK( gPushButtonSelectedState );
614
615   // Test5. Touch point down outside and up inside the button.
616   // Start in unselected state
617   pushButton.SetProperty( Button::Property::SELECTED, false );
618   DALI_TEST_CHECK( !pushButton.IsSelected());
619
620   gPushButtonSelectedState = false;
621   event = Dali::Integration::TouchEvent();
622   event.AddPoint( GetPointDownOutside() );
623   application.ProcessEvent( event );
624
625   event = Dali::Integration::TouchEvent();
626   event.AddPoint( GetPointEnter() );
627   application.ProcessEvent( event );
628
629   event = Dali::Integration::TouchEvent();
630   event.AddPoint( GetPointUpInside() );
631   application.ProcessEvent( event );
632
633   DALI_TEST_CHECK( !gPushButtonSelectedState );
634   END_TEST;
635 }
636
637 int UtcDaliPushButtonPropertySetIconAlignment(void)
638 {
639   ToolkitTestApplication application;
640   tet_infoline(" UtcDaliPushButtonPropertySetIconAlignment");
641
642   PushButton pushButton = PushButton::New();
643   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "TOP" );
644   DALI_TEST_EQUALS( pushButton.GetProperty<std::string>( Toolkit::PushButton::Property::ICON_ALIGNMENT ), "TOP", TEST_LOCATION );
645
646   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "RIGHT" );
647   DALI_TEST_EQUALS( pushButton.GetProperty<std::string>( Toolkit::PushButton::Property::ICON_ALIGNMENT ), "RIGHT", TEST_LOCATION );
648
649   END_TEST;
650 }
651
652 int UtcDaliPushButtonPropertySetLabelPadding(void)
653 {
654   ToolkitTestApplication application;
655   tet_infoline(" UtcDaliPushButtonPropertySetLabelPadding");
656
657   PushButton pushButton = PushButton::New();
658   pushButton.SetProperty( Toolkit::PushButton::Property::LABEL_PADDING, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
659   DALI_TEST_EQUALS( pushButton.GetProperty<Vector4>( Toolkit::PushButton::Property::LABEL_PADDING ), Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
660
661   pushButton.SetProperty( Toolkit::PushButton::Property::LABEL_PADDING, Vector4( 10.0f, 10.0f, 10.0f, 10.0f ) );
662   DALI_TEST_EQUALS( pushButton.GetProperty<Vector4>( Toolkit::PushButton::Property::LABEL_PADDING ), Vector4( 10.0f, 10.0f, 10.0f, 10.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
663
664   END_TEST;
665 }
666
667 int UtcDaliPushButtonPropertySetIconPadding(void)
668 {
669   ToolkitTestApplication application;
670   tet_infoline(" UtcDaliPushButtonPropertySetIconPadding");
671
672   PushButton pushButton = PushButton::New();
673   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_PADDING, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
674   DALI_TEST_EQUALS( pushButton.GetProperty<Vector4>( Toolkit::PushButton::Property::ICON_PADDING ), Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
675
676   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_PADDING, Vector4( 10.0f, 10.0f, 10.0f, 10.0f ) );
677   DALI_TEST_EQUALS( pushButton.GetProperty<Vector4>( Toolkit::PushButton::Property::ICON_PADDING ), Vector4( 10.0f, 10.0f, 10.0f, 10.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
678
679   END_TEST;
680 }
681
682 int UtcDaliPushButtonPaddingLayout(void)
683 {
684   ToolkitTestApplication application;
685   tet_infoline(" UtcDaliPushButtonPaddingLayout");
686
687   // This test creates padding for an icon and a label.
688   // The icon and label are each enabled and disabled to confirm the correct padding is used.
689   PushButton pushButton = PushButton::New();
690
691   const Vector4 TEST_ICON_PADDING( 20.0f, 20.0f, 20.0f, 20.0f );
692   const Vector4 TEST_LABEL_PADDING( 10.0f, 10.0f, 10.0f ,10.0f );
693   const Vector2 TEST_IMAGE_SIZE = Vector2( 5.0f, 5.0f);
694
695   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
696   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
697   pushButton.SetPosition( 0.0f, 0.0f );
698   pushButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
699
700   Stage::GetCurrent().Add( pushButton );
701
702   application.SendNotification();
703   application.Render();
704
705   // First test the size is zero.
706   // No padding should be added as there is no label or icon.
707   Vector2 size( Vector2::ZERO );
708   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
709   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
710   tet_printf( "Button Natural Size(%f,%f)\n", pushButton.GetNaturalSize().width, pushButton.GetNaturalSize().height );
711
712   DALI_TEST_EQUALS( size, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
713
714   // Check label only padding
715   pushButton.SetLabelText( "Label" );
716
717   application.SendNotification();
718   application.Render();
719
720   Vector2 sizeWithLabelWithoutPadding( Vector2::ZERO );
721   sizeWithLabelWithoutPadding.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
722   sizeWithLabelWithoutPadding.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
723
724   tet_printf( "Button RelayoutSize label without padding (%f,%f)\n", sizeWithLabelWithoutPadding.width, sizeWithLabelWithoutPadding.height );
725
726   // Add label padding to label
727   pushButton.SetProperty( Toolkit::PushButton::Property::LABEL_PADDING, TEST_LABEL_PADDING );
728   application.SendNotification();
729   application.Render();
730
731   Vector2 sizeLabelAndPadding( Vector2::ZERO );
732   sizeLabelAndPadding.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
733   sizeLabelAndPadding.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
734   tet_printf( "Button RelayoutSize after label padding(%f,%f)\n", sizeLabelAndPadding.width, sizeLabelAndPadding.height );
735
736   // If control size has increased beyond size of just label then padding has been applied
737   DALI_TEST_GREATER( sizeLabelAndPadding.width, sizeWithLabelWithoutPadding.width+TEST_LABEL_PADDING.x, TEST_LOCATION );
738   DALI_TEST_GREATER( sizeLabelAndPadding.height, sizeWithLabelWithoutPadding.height+TEST_LABEL_PADDING.w, TEST_LOCATION );
739
740   // Re-initialise the button so we can setup icon-only padding.
741   pushButton.Unparent();
742   pushButton = PushButton::New();
743
744   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
745   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
746   pushButton.SetPosition( 0.0f, 0.0f );
747   pushButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
748
749   Stage::GetCurrent().Add( pushButton );
750
751   TestPlatformAbstraction& platform = application.GetPlatform();
752   platform.SetClosestImageSize( TEST_IMAGE_SIZE );
753
754   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "RIGHT" );
755   pushButton.SetProperty( Toolkit::PushButton::Property::UNSELECTED_ICON, TEST_IMAGE_ONE );
756   pushButton.SetProperty( Toolkit::PushButton::Property::SELECTED_ICON, TEST_IMAGE_ONE );
757
758   application.SendNotification();
759   application.Render();
760
761   // Size of button with just icon
762   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
763   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
764   tet_printf( "Button RelayoutSize with icon(%f,%f)\n", size.width, size.height );
765
766   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_PADDING, TEST_ICON_PADDING );
767
768   application.SendNotification();
769   application.Render();
770   DALI_TEST_EQUALS( size, TEST_IMAGE_SIZE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
771
772   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
773   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
774   tet_printf( "Button RelayoutSize after icon padding(%f,%f)\n", size.width, size.height );
775   const Vector2 expectedIconAndPaddingSize( TEST_ICON_PADDING.x+TEST_ICON_PADDING.y+TEST_IMAGE_SIZE.width, TEST_ICON_PADDING.w+TEST_ICON_PADDING.z +TEST_IMAGE_SIZE.height );
776   DALI_TEST_EQUALS( size, expectedIconAndPaddingSize, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
777
778   // Now test padding for both label and icon simultaneously.
779   pushButton.SetLabelText( "Label" );
780   application.SendNotification();
781   application.Render();
782
783   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
784   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
785   tet_printf( "Button RelayoutSize after label added(%f,%f)\n", size.width, size.height );
786
787   pushButton.SetProperty( Toolkit::PushButton::Property::LABEL_PADDING, TEST_LABEL_PADDING );
788
789   application.SendNotification();
790   application.Render();
791
792   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
793   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
794   tet_printf( "Button RelayoutSize after icon and label padding(%f,%f)\n", size.width, size.height );
795
796   DALI_TEST_EQUALS( size.width, sizeLabelAndPadding.width + expectedIconAndPaddingSize.width, TEST_LOCATION );
797   DALI_TEST_GREATER( size.height, expectedIconAndPaddingSize.width, TEST_LOCATION ); // Test height of control is greater than icon and padding. As Text set to larger values.
798
799   END_TEST;
800 }
801
802 int UtcDaliPushButtonAlignmentLayout(void)
803 {
804   ToolkitTestApplication application;
805   tet_infoline(" UtcDaliPushButtonAlignmentLayout");
806
807   /*
808    * This test checks different alignments for the icon against the label.
809    * The icon is then moved around the label in each of it's alignments.
810    * The final relayed out size is checked to confirm the layout has been done correctly.
811    *
812    * There is an Icon which has 0 width and height, but with 75 padding on all sides.
813    *  - Therefore total width and height are both 150.
814    *
815    * There is a Label which has "an unknown" width and height, but with 30 padding on all sides.
816    *  - Therefore total width and height are 60+x and 60+y respectively.
817    *    Where x & y are the width and height of the text.
818    *
819    * The width of the button will always expand to the largest of the icon and label sizes (plus padding).
820    * So We use the padding to help us determine the orientation is correct for each alignment.
821    *
822    * |<- 150 ->|         |<-- 60+x -->|
823    *
824    * +---------+   -
825    * |         |   ^     +------------+   -
826    * |         |   |     |            |   ^
827    * |  Icon   |  150    |   Label    |  60+y
828    * |         |   |     |            |   v
829    * |         |   v     +------------+   -
830    * +---------+   -
831    */
832
833   const Vector4 TEST_ICON_PADDING( 70.0f, 70.0f, 70.0f, 70.0f );
834   const Vector4 TEST_LABEL_PADDING( 30.0f, 30.0f, 30.0f, 30.0f );
835   const Vector2 TEST_IMAGE_SIZE = Vector2( 10.0f, 10.0f);
836
837   PushButton pushButton = PushButton::New();
838
839   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
840   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
841   pushButton.SetPosition( 0.0f, 0.0f );
842   pushButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
843
844   Stage::GetCurrent().Add( pushButton );
845
846   // Add a label and get size of control
847   pushButton.SetLabelText( "Label" );
848   application.SendNotification();
849   application.Render();
850
851   // First get the size of control with just label
852   Vector2 justLabelSize( Vector2::ZERO );
853   justLabelSize.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
854   justLabelSize.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
855   tet_printf( "Button RelayoutSize with just label and no padding(%f,%f)\n", justLabelSize.width, justLabelSize.height );
856
857   pushButton.SetProperty( Toolkit::PushButton::Property::LABEL_PADDING, TEST_LABEL_PADDING );
858   application.SendNotification();
859   application.Render();
860
861   // Size of Label and Padding
862   Vector2 expectedLabelAndPaddingSize( Vector2::ZERO );
863   expectedLabelAndPaddingSize.width = justLabelSize.width + TEST_LABEL_PADDING.x + TEST_LABEL_PADDING.y;
864   expectedLabelAndPaddingSize.height = justLabelSize.height + TEST_LABEL_PADDING.w + TEST_LABEL_PADDING.z;
865
866   Vector2 labelAndPaddingSize( Vector2::ZERO );
867   labelAndPaddingSize.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
868   labelAndPaddingSize.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
869
870   DALI_TEST_EQUALS( labelAndPaddingSize, expectedLabelAndPaddingSize , Math::MACHINE_EPSILON_1000, TEST_LOCATION );
871
872   const Vector2 testImageWithPaddingSize = Vector2 ( ( TEST_IMAGE_SIZE.width + TEST_ICON_PADDING.x + TEST_ICON_PADDING.y ),
873                                                      ( TEST_IMAGE_SIZE.height + TEST_ICON_PADDING.w + TEST_ICON_PADDING.z ) );
874
875   TestPlatformAbstraction& platform = application.GetPlatform();
876   platform.SetClosestImageSize( TEST_IMAGE_SIZE );
877
878   // Add Icon and set its alignment
879   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "RIGHT" );
880   pushButton.SetProperty( Toolkit::PushButton::Property::UNSELECTED_ICON, TEST_IMAGE_ONE );
881   pushButton.SetProperty( Toolkit::PushButton::Property::SELECTED_ICON, TEST_IMAGE_ONE );
882   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_PADDING, TEST_ICON_PADDING );
883
884   application.SendNotification();
885   application.Render();
886
887   Vector2 size( Vector2::ZERO );
888   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
889   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
890
891   /*
892    * Test Icon right alignment.
893    * Height grows to largest of Icon or Label (+ padding).
894    * Normally this will be Icons height, except with very large font sizes.
895    *
896    *  +------------+---------+
897    *  |............+         |
898    *  |            |         |
899    *  |   Label    |  Icon   |
900    *  |            |         |
901    *  |............+         |
902    *  +------------+---------+
903    */
904   DALI_TEST_EQUALS( size.width, ( testImageWithPaddingSize.width + labelAndPaddingSize.width ) , TEST_LOCATION );
905   DALI_TEST_EQUALS( size.height, ( std::max( testImageWithPaddingSize.height, labelAndPaddingSize.height) ) , Math::MACHINE_EPSILON_1000, TEST_LOCATION );
906
907   // Now test left alignment matches right for size.
908   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "LEFT" );
909
910   application.SendNotification();
911   application.Render();
912
913   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
914   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
915
916   /*
917    * Test Icon left alignment.
918    * Height grows to largest of Icon or Label (+ padding).
919    * Normally this will be Icons height, except with very large font sizes.
920    *
921    *  +---------+------------+
922    *  |         +............|
923    *  |         |            |
924    *  |  Icon   |   Label    |
925    *  |         |            |
926    *  |         +............|
927    *  +---------+------------+
928    */
929   DALI_TEST_EQUALS( size.width, ( testImageWithPaddingSize.width + labelAndPaddingSize.width ) , TEST_LOCATION );
930   DALI_TEST_EQUALS( size.height, ( std::max( testImageWithPaddingSize.height, labelAndPaddingSize.height) ) , Math::MACHINE_EPSILON_1000, TEST_LOCATION );
931
932   tet_infoline(" Test Icon TOP alignment - Width grows to largest of Icon or label (plus padding)");
933   /*
934    *
935    *  +---------+
936    *  |         |
937    *  |         |
938    *  |  Icon   |
939    *  |         |
940    *  |         |
941    *  +---------+
942    *  |         |
943    *  |  Label  |
944    *  |         |
945    *  +---------+
946    *
947    */
948
949   tet_infoline("SetProperty on ICON_ALIGNMENT should relayout the Button");
950   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "TOP" );
951
952   application.SendNotification();
953   application.Render();
954
955   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
956   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
957
958   tet_printf("Natural width (%f)\n",pushButton.GetNaturalSize().width);
959   tet_printf("Natural height (%f)\n",pushButton.GetNaturalSize().height);
960
961   tet_printf(" UtcDaliPushButtonAlignmentLayout Top layout - Image and Padding size (%f,%f)\n", testImageWithPaddingSize.width, testImageWithPaddingSize.height );
962   tet_printf(" UtcDaliPushButtonAlignmentLayout Top layout - Text and Padding size (%f,%f)\n", labelAndPaddingSize.width, labelAndPaddingSize.height );
963
964   DALI_TEST_EQUALS( size.width, ( std::max( testImageWithPaddingSize.width, labelAndPaddingSize.width ) ) , TEST_LOCATION );
965
966   DALI_TEST_EQUALS( size.height,( testImageWithPaddingSize.height + labelAndPaddingSize.height ) , TEST_LOCATION );
967
968   /*
969    * Test Icon bottom alignment.
970    * Width grows to largest of Icon or Label (+ padding).
971    *
972    *  +---------+
973    *  |         |
974    *  |  Label  |
975    *  |         |
976    *  +---------+
977    *  |         |
978    *  |         |
979    *  |  Icon   |
980    *  |         |
981    *  |         |
982    *  +---------+
983    */
984   tet_infoline(" Test Icon BOTTOM alignment - Width grows to largest of Icon or label (plus padding)");
985   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "BOTTOM" );
986
987   application.SendNotification();
988   application.Render();
989
990   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
991   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
992
993   DALI_TEST_EQUALS( size.width, ( std::max(testImageWithPaddingSize.width, labelAndPaddingSize.width )) , TEST_LOCATION );
994   DALI_TEST_EQUALS( size.height,( testImageWithPaddingSize.height + labelAndPaddingSize.height ) , TEST_LOCATION );
995
996   END_TEST;
997 }
998
999 int UtcDaliPushButtonSetUnSelectedVisual01P(void)
1000 {
1001   tet_infoline(" Test adding a visual for the UNSELECTED_VISUAL property, removing Button from stage and counting renderers\n");
1002   ToolkitTestApplication application;
1003
1004   PushButton pushButton = PushButton::New();
1005   pushButton.SetSize(100.0f, 100.0f);
1006
1007   Stage::GetCurrent().Add( pushButton );
1008
1009   Property::Map propertyMap;
1010   propertyMap.Insert(Visual::Property::TYPE,  Visual::COLOR);
1011   propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
1012
1013   pushButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, propertyMap );
1014
1015   tet_infoline(" UNSELECTED_VISUAL Added to button\n");
1016
1017   application.SendNotification();
1018   application.Render(0);
1019
1020   unsigned int rendererCount = pushButton.GetRendererCount();
1021   tet_printf("After adding UNSELECTED_BACKGROUND_VISUAL the renderer count is(%d)\n", rendererCount );
1022
1023   DALI_TEST_EQUALS( pushButton.GetRendererCount(), 1 , TEST_LOCATION );
1024
1025   tet_printf("Remove button from stage\n" );
1026
1027   Stage::GetCurrent().Remove( pushButton );
1028
1029   rendererCount = pushButton.GetRendererCount();
1030   tet_printf("After removing pushbutton from stage the renderer count is(%d)\n ", rendererCount );
1031
1032   DALI_TEST_EQUALS( pushButton.GetRendererCount(), 0, TEST_LOCATION );
1033
1034   tet_printf("After removing pushbutton from stage the renderer count is(%d)\n ", rendererCount );
1035
1036   Property::Map propertyMap2;
1037   propertyMap2.Insert(Visual::Property::TYPE,  Visual::COLOR);
1038   propertyMap2.Insert(ColorVisual::Property::MIX_COLOR, Color::RED);
1039   pushButton.SetProperty( Toolkit::Button::Property::UNSELECTED_VISUAL, propertyMap2 );
1040
1041   tet_printf("Added UNSELECTED_VISUAL and add button back to Stage\n");
1042
1043   Stage::GetCurrent().Add( pushButton );
1044
1045   tet_printf("With UNSELECTED_BACKGROUND_VISUAL and UNSELECTED_ICON the renderer count is(%d)\n", pushButton.GetRendererCount() );
1046
1047   DALI_TEST_EQUALS( pushButton.GetRendererCount(), 2, TEST_LOCATION );
1048
1049   END_TEST;
1050 }
1051
1052 int UtcDaliPushButtonSetSelectedVisualN(void)
1053 {
1054   tet_infoline(" Test adding a broken visual for the UNSELECTED_VISUAL property");
1055
1056   ToolkitTestApplication application;
1057
1058   PushButton pushButton = PushButton::New();
1059
1060   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1061   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
1062   pushButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
1063
1064   Stage::GetCurrent().Add( pushButton );
1065   application.SendNotification();
1066   application.Render(0);
1067
1068   unsigned int preRendererCount = pushButton.GetRendererCount();
1069   tet_printf("RendererCount prior to adding visual(%d)\n",preRendererCount);
1070   DALI_TEST_EQUALS( preRendererCount, 0, TEST_LOCATION );
1071
1072   Stage::GetCurrent().Remove( pushButton );
1073   application.SendNotification();
1074   application.Render(0);
1075
1076   Property::Map colorMap;
1077   const int BROKEN_VISUAL_TYPE = 999999999;
1078
1079   colorMap.Insert(Visual::Property::TYPE,  BROKEN_VISUAL_TYPE);
1080   //colorMap.Insert(Visual::Property::TYPE,  Visual::COLOR);
1081   colorMap.Insert(BorderVisual::Property::COLOR,  Color::BLUE);
1082   colorMap.Insert(BorderVisual::Property::SIZE,  5.f);
1083   pushButton.SetProperty( Toolkit::Button::Property::UNSELECTED_VISUAL, colorMap );
1084
1085   Stage::GetCurrent().Add( pushButton );
1086   application.SendNotification();
1087   application.Render(0);
1088
1089   unsigned int postRendererCount  = pushButton.GetRendererCount();
1090   tet_printf("RendererCount post broken visual (%d)\n", postRendererCount);
1091   DALI_TEST_EQUALS( postRendererCount, 0, TEST_LOCATION );
1092
1093   END_TEST;
1094 }
1095
1096 int UtcDaliPushButtonSetButtonImageP(void)
1097 {
1098   ToolkitTestApplication application;
1099
1100   PushButton button = PushButton::New();
1101   Stage::GetCurrent().Add( button );
1102
1103   try
1104   {
1105     button.SetButtonImage( ImageView::New() );
1106     DALI_TEST_CHECK( true );
1107   }
1108   catch(...)
1109   {
1110     DALI_TEST_CHECK( false );
1111   }
1112
1113   END_TEST;
1114 }
1115
1116 int UtcDaliPushButtonSetBackgroundImageP(void)
1117 {
1118   ToolkitTestApplication application;
1119
1120   PushButton button = PushButton::New();
1121   Stage::GetCurrent().Add( button );
1122
1123   try
1124   {
1125     button.SetBackgroundImage( ImageView::New() );
1126     DALI_TEST_CHECK( true );
1127   }
1128   catch(...)
1129   {
1130     DALI_TEST_CHECK( false );
1131   }
1132
1133   END_TEST;
1134 }
1135
1136 int UtcDaliPushButtonSetSelectedImageP(void)
1137 {
1138   ToolkitTestApplication application;
1139
1140   PushButton button = PushButton::New();
1141   Stage::GetCurrent().Add( button );
1142
1143   try
1144   {
1145     button.SetSelectedImage( ImageView::New() );
1146     DALI_TEST_CHECK( true );
1147   }
1148   catch(...)
1149   {
1150     DALI_TEST_CHECK( false );
1151   }
1152
1153   END_TEST;
1154 }
1155
1156 int UtcDaliPushButtonSetSelectedBackgroundImageP(void)
1157 {
1158   ToolkitTestApplication application;
1159
1160   PushButton button = PushButton::New();
1161   Stage::GetCurrent().Add( button );
1162
1163   try
1164   {
1165     button.SetSelectedBackgroundImage( ImageView::New() );
1166     DALI_TEST_CHECK( true );
1167   }
1168   catch(...)
1169   {
1170     DALI_TEST_CHECK( false );
1171   }
1172
1173   END_TEST;
1174 }
1175
1176 int UtcDaliPushButtonSetDisabledBackgroundImageP(void)
1177 {
1178   ToolkitTestApplication application;
1179
1180   PushButton button = PushButton::New();
1181   Stage::GetCurrent().Add( button );
1182
1183   try
1184   {
1185     button.SetDisabledBackgroundImage( ImageView::New() );
1186     DALI_TEST_CHECK( true );
1187   }
1188   catch(...)
1189   {
1190     DALI_TEST_CHECK( false );
1191   }
1192
1193   END_TEST;
1194 }
1195
1196
1197 int UtcDaliPushButtonSetDisabledImageP(void)
1198 {
1199   ToolkitTestApplication application;
1200
1201   PushButton button = PushButton::New();
1202   Stage::GetCurrent().Add( button );
1203
1204   try
1205   {
1206     button.SetDisabledImage( ImageView::New() );
1207     DALI_TEST_CHECK( true );
1208   }
1209   catch(...)
1210   {
1211     DALI_TEST_CHECK( false );
1212   }
1213
1214   END_TEST;
1215 }
1216
1217 int UtcDaliPushButtonSetDisabledSelectedImageP(void)
1218 {
1219   ToolkitTestApplication application;
1220
1221   PushButton button = PushButton::New();
1222   Stage::GetCurrent().Add( button );
1223
1224   try
1225   {
1226     button.SetDisabledSelectedImage( ImageView::New() );
1227     DALI_TEST_CHECK( true );
1228   }
1229   catch(...)
1230   {
1231     DALI_TEST_CHECK( false );
1232   }
1233
1234   END_TEST;
1235 }