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