Ensure Button Set and Get works with Image/Actor API
[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/controls/buttons/button-devel.h>
30 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
31 #include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
32
33 #include <dali/devel-api/adaptor-framework/image-loading.h>
34
35 using namespace Dali;
36 using namespace Toolkit;
37
38 void utc_dali_toolkit_pushbutton_startup(void)
39 {
40   test_return_value = TET_UNDEF;
41 }
42
43 void utc_dali_toolkit_pushbutton_cleanup(void)
44 {
45   test_return_value = TET_PASS;
46 }
47
48 namespace
49 {
50 static const char* TEST_IMAGE_ONE = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
51
52 static const Vector2 INSIDE_TOUCH_POINT_POSITON  = Vector2( 240, 400 );
53 static const Vector3 BUTTON_POSITON_TO_GET_INSIDE_TOUCH_EVENTS  = Vector3( 200, 360, 0 );
54 static const Size BUTTON_SIZE_TO_GET_INSIDE_TOUCH_EVENTS  = Size( 100, 100 );
55
56 static bool gPushButtonSelectedState = false;
57 bool PushButtonSelected( Button button )
58 {
59   gPushButtonSelectedState = button.GetProperty<bool>(button.GetPropertyIndex("selected") );
60   return true;
61 }
62
63 static bool gPushButtonPressed = false;
64
65 static bool PushButtonPressed( Button button )
66 {
67   gPushButtonPressed = true;
68   return true;
69 }
70
71 static bool gPushButtonReleased = false;
72
73 static bool PushButtonReleased( Button button )
74 {
75   gPushButtonReleased = true;
76   return true;
77 }
78
79 static bool gPushButtonClicked = false;
80
81 static bool PushButtonClicked( Button button )
82 {
83   gPushButtonClicked = true;
84   return gPushButtonClicked;
85 }
86
87 Dali::Integration::Point GetPointDownInside()
88 {
89   Dali::Integration::Point point;
90   point.SetState( PointState::DOWN );
91   point.SetScreenPosition( INSIDE_TOUCH_POINT_POSITON );
92   return point;
93 }
94
95 Dali::Integration::Point GetPointUpInside()
96 {
97   Dali::Integration::Point point;
98   point.SetState( PointState::UP );
99   point.SetScreenPosition( INSIDE_TOUCH_POINT_POSITON );
100   return point;
101 }
102
103 Dali::Integration::Point GetPointLeave()
104 {
105   Dali::Integration::Point point;
106   point.SetState( PointState::LEAVE );
107   point.SetScreenPosition( INSIDE_TOUCH_POINT_POSITON );
108   return point;
109 }
110
111 Dali::Integration::Point GetPointEnter()
112 {
113   Dali::Integration::Point point;
114   point.SetState( PointState::MOTION );
115   point.SetScreenPosition( INSIDE_TOUCH_POINT_POSITON );
116   return point;
117 }
118
119 Dali::Integration::Point GetPointDownOutside()
120 {
121   Dali::Integration::Point point;
122   point.SetState( PointState::DOWN );
123   point.SetScreenPosition( Vector2( 10, 10 ) );
124   return point;
125 }
126
127 Dali::Integration::Point GetPointUpOutside()
128 {
129   Dali::Integration::Point point;
130   point.SetState( PointState::UP );
131   point.SetScreenPosition( Vector2( 10, 10 ) );
132   return point;
133 }
134
135 // Set up the position of the button for the default test events
136 void SetupButtonForTestTouchEvents( ToolkitTestApplication& application, Button& button, bool useDefaultImages )
137 {
138   button.SetAnchorPoint( AnchorPoint::TOP_LEFT );
139   button.SetParentOrigin( ParentOrigin::TOP_LEFT );
140   button.SetPosition( BUTTON_POSITON_TO_GET_INSIDE_TOUCH_EVENTS );
141   if ( useDefaultImages )
142   {
143     const Vector2 TEST_IMAGE_SIZE = Vector2( BUTTON_SIZE_TO_GET_INSIDE_TOUCH_EVENTS );
144     TestPlatformAbstraction& platform = application.GetPlatform();
145     platform.SetClosestImageSize( TEST_IMAGE_SIZE );
146     button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, TEST_IMAGE_ONE );
147     button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, TEST_IMAGE_ONE );
148   }
149 }
150
151 static std::string GetButtonText( Button button )
152 {
153   Property::Value value = button.GetProperty( Toolkit::Button::Property::LABEL );
154
155   Property::Map *labelProperty = value.GetMap();
156
157   std::string textLabel;
158
159   if ( labelProperty )
160   {
161     Property::Value* value = labelProperty->Find( Toolkit::TextVisual::Property::TEXT );
162     value->Get( textLabel );
163   }
164
165   return textLabel;
166 }
167
168 } //namespace
169
170 int UtcDaliPushButtonConstructorP(void)
171 {
172   TestApplication application;
173
174   PushButton button;
175
176   DALI_TEST_CHECK( !button );
177   END_TEST;
178 }
179
180 int UtcDaliPushButtonCopyConstructorP(void)
181 {
182   TestApplication application;
183
184   // Initialize an object, ref count == 1
185   PushButton button = PushButton::New();
186
187   PushButton copy( button );
188   DALI_TEST_CHECK( copy );
189   END_TEST;
190 }
191
192 int UtcDaliPushButtonAssignmentOperatorP(void)
193 {
194   TestApplication application;
195
196   PushButton button = PushButton::New();
197
198   PushButton copy( button );
199   DALI_TEST_CHECK( copy );
200
201   DALI_TEST_CHECK( button == copy );
202   END_TEST;
203 }
204
205 int UtcDaliPushButtonNewP(void)
206 {
207   TestApplication application;
208
209   PushButton button = PushButton::New();
210
211   DALI_TEST_CHECK( button );
212   END_TEST;
213 }
214
215 int UtcDaliPushButtonDownCastP(void)
216 {
217   TestApplication application;
218
219   PushButton button = PushButton::New();
220
221   BaseHandle object(button);
222
223   PushButton button2 = PushButton::DownCast( object );
224   DALI_TEST_CHECK(button2);
225
226   PushButton button3 = DownCast< PushButton >(object);
227   DALI_TEST_CHECK(button3);
228   END_TEST;
229 }
230
231 int UtcDaliPushButtonDownCastN(void)
232 {
233   TestApplication application;
234
235   BaseHandle unInitializedObject;
236
237   PushButton button1 = PushButton::DownCast( unInitializedObject );
238   DALI_TEST_CHECK( !button1 );
239
240   PushButton button2 = DownCast< PushButton >( unInitializedObject );
241   DALI_TEST_CHECK( !button2 );
242   END_TEST;
243 }
244
245 int UtcDaliPushButtonAutoRepeatingProperty(void)
246 {
247   ToolkitTestApplication application;
248   tet_infoline(" UtcDaliPushButtonSetGetAutoRepeating");
249
250   PushButton pushButton = PushButton::New();
251
252   pushButton.SetProperty( pushButton.GetPropertyIndex("autoRepeating"), true );
253   DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
254
255   pushButton.SetProperty( pushButton.GetPropertyIndex("autoRepeating"), false );
256   DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), false, TEST_LOCATION );
257
258   pushButton.SetProperty( pushButton.GetPropertyIndex("autoRepeating"), true );
259   DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
260
261     END_TEST;
262 }
263
264 int UtcDaliPushButtonSetAutoRepeating(void)
265 {
266   ToolkitTestApplication application;
267   tet_infoline("UtcDaliPushButtonSetAutoRepeating\n");
268   tet_infoline("Ensure setting AutoRepeating on a SELECTED Toggle button switches off Toggle\n");
269   PushButton pushButton = PushButton::New();
270
271   const bool INITIAL_TOGGLE_VALUE = true;
272   const bool INITIAL_SELECTED_VALUE = true;
273
274   pushButton.SetProperty( Button::Property::TOGGLABLE, INITIAL_TOGGLE_VALUE);
275   pushButton.SetProperty( Button::Property::SELECTED, INITIAL_SELECTED_VALUE );
276
277   DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::TOGGLABLE  ), INITIAL_TOGGLE_VALUE , TEST_LOCATION );
278   DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), INITIAL_SELECTED_VALUE , TEST_LOCATION );
279
280   pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
281
282   DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::TOGGLABLE ), !INITIAL_TOGGLE_VALUE , TEST_LOCATION );
283
284   END_TEST;
285 }
286
287 int UtcDaliPushButtonTogglableProperty(void)
288 {
289   ToolkitTestApplication application;
290   tet_infoline(" UtcDaliPushButtonSetGetTogglableButton");
291
292   PushButton pushButton = PushButton::New();
293
294   pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
295   DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), true, TEST_LOCATION );
296
297   pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), false );
298   DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), false, TEST_LOCATION );
299
300   pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
301   DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), true, TEST_LOCATION );
302
303   END_TEST;
304 }
305
306 int UtcDaliPushButtonAutoRepeatingPropertyAndTogglableButton(void)
307 {
308   ToolkitTestApplication application;
309   tet_infoline(" UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton");
310
311   PushButton pushButton = PushButton::New();
312
313   pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
314   pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
315
316   DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), true, TEST_LOCATION );
317   DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), false, TEST_LOCATION );
318
319   pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
320   pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
321
322   DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
323   DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), false, TEST_LOCATION );
324   END_TEST;
325 }
326
327 int UtcDaliPushButtonSelectedProperty01(void)
328 {
329   ToolkitTestApplication application;
330   tet_infoline(" UtcDaliPushButtonSetGetSelected01");
331
332   PushButton pushButton = PushButton::New();
333
334   pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
335
336   pushButton.StateChangedSignal().Connect( &PushButtonSelected );
337
338   gPushButtonSelectedState = false;
339   pushButton.SetProperty( Button::Property::SELECTED, true );
340
341   DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), true , TEST_LOCATION );
342   DALI_TEST_CHECK( gPushButtonSelectedState );
343
344   pushButton.SetProperty( Button::Property::SELECTED, false );
345
346   DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), false , TEST_LOCATION );
347   DALI_TEST_CHECK( !gPushButtonSelectedState );
348
349   pushButton.SetProperty( Button::Property::SELECTED, true );
350
351   DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), true , TEST_LOCATION );
352   DALI_TEST_CHECK( gPushButtonSelectedState );
353   END_TEST;
354 }
355
356 int UtcDaliPushButtonSelectedProperty02(void)
357 {
358   ToolkitTestApplication application;
359   tet_infoline(" UtcDaliPushButtonSetGetSelected02");
360
361   PushButton pushButton = PushButton::New();
362
363   pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), false );
364   pushButton.StateChangedSignal().Connect( &PushButtonSelected );
365
366   gPushButtonSelectedState = false;
367   pushButton.SetProperty( Button::Property::SELECTED, true );
368
369   DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), false , TEST_LOCATION );
370   DALI_TEST_CHECK( !gPushButtonSelectedState );
371
372   pushButton.SetProperty( Button::Property::SELECTED, false );
373
374   DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), false , TEST_LOCATION );
375   DALI_TEST_CHECK( !gPushButtonSelectedState );
376
377   pushButton.SetProperty( Button::Property::SELECTED, true );
378
379   DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), false , TEST_LOCATION );
380   DALI_TEST_CHECK( !gPushButtonSelectedState );
381   END_TEST;
382 }
383
384 int UtcDaliPushButtonAutorepeatingDelayPropertyValues01(void)
385 {
386   ToolkitTestApplication application;
387   tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues01");
388
389   PushButton pushButton = PushButton::New();
390
391   pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
392
393   pushButton.SetProperty( Button::Property::INITIAL_AUTO_REPEATING_DELAY, 1.f );
394
395   DALI_TEST_EQUALS( pushButton.GetProperty<float>(pushButton.GetPropertyIndex("initialAutoRepeatingDelay") ), 1.f, TEST_LOCATION );
396
397   END_TEST;
398 }
399
400 int UtcDaliPushButtonAutorepeatingDelayPropertyValues02(void)
401 {
402   ToolkitTestApplication application;
403   tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues02");
404
405   PushButton pushButton = PushButton::New();
406
407   bool assert1( false );
408   bool assert2( false );
409
410   pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
411
412   try
413   {
414     pushButton.SetProperty( Button::Property::INITIAL_AUTO_REPEATING_DELAY, -1.f );
415   }
416   catch( Dali::DaliException& e )
417   {
418     DALI_TEST_PRINT_ASSERT( e );
419     DALI_TEST_EQUALS(e.condition, "initialAutoRepeatingDelay > 0.f", TEST_LOCATION);
420     assert1 = true;
421   }
422
423   try
424   {
425     pushButton.SetProperty( Button::Property::NEXT_AUTO_REPEATING_DELAY, -1.f );
426   }
427   catch( Dali::DaliException& e )
428   {
429     DALI_TEST_PRINT_ASSERT( e );
430     DALI_TEST_EQUALS(e.condition, "nextAutoRepeatingDelay > 0.f", TEST_LOCATION);
431     assert2 = true;
432   }
433
434   DALI_TEST_CHECK( assert1 && assert2 );
435   END_TEST;
436 }
437
438 int UtcDaliPushButtonLabelProperty(void)
439 {
440   ToolkitTestApplication application;
441   tet_infoline(" UtcDaliPushButtonSetLabelText");
442
443   const std::string STR( "Hola!" );
444
445   PushButton pushButton = PushButton::New();
446
447   application.SendNotification();
448   application.Render();
449
450   pushButton.SetProperty( Toolkit::Button::Property::LABEL,
451                             Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
452                                            .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
453                           );
454
455
456   pushButton.SetProperty( Toolkit::Button::Property::LABEL, STR );
457
458   DALI_TEST_EQUALS( GetButtonText( pushButton ), STR, TEST_LOCATION );
459
460   END_TEST;
461 }
462
463 int UtcDaliPushButtonPressed(void)
464 {
465   ToolkitTestApplication application;
466   tet_infoline(" UtcDaliPushButtonPressed");
467
468   PushButton pushButton = PushButton::New();
469   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
470   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
471   pushButton.SetPosition( BUTTON_POSITON_TO_GET_INSIDE_TOUCH_EVENTS );
472   pushButton.SetSize( BUTTON_SIZE_TO_GET_INSIDE_TOUCH_EVENTS );
473
474   Stage::GetCurrent().Add( pushButton );
475
476   application.SendNotification();
477   application.Render();
478
479   gPushButtonPressed = false;
480
481   // connect to its touch signal
482   pushButton.PressedSignal().Connect( &PushButtonPressed );
483
484   Dali::Integration::TouchEvent eventDown;
485   eventDown.AddPoint( GetPointDownInside() );
486
487   // flush the queue and render once
488   application.SendNotification();
489   application.Render();
490   application.ProcessEvent( eventDown );
491
492   DALI_TEST_CHECK( gPushButtonPressed );
493   END_TEST;
494 }
495
496 int UtcDaliPushButtonReleased(void)
497 {
498   ToolkitTestApplication application;
499   tet_infoline(" UtcDaliPushButtonReleased");
500
501   PushButton pushButton = PushButton::New();
502   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
503   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
504   pushButton.SetPosition( BUTTON_POSITON_TO_GET_INSIDE_TOUCH_EVENTS );
505   pushButton.SetSize( BUTTON_SIZE_TO_GET_INSIDE_TOUCH_EVENTS );
506
507   Stage::GetCurrent().Add( pushButton );
508
509   application.SendNotification();
510   application.Render();
511
512   // connect to its touch signal
513   pushButton.ReleasedSignal().Connect( &PushButtonReleased );
514
515   Dali::Integration::TouchEvent event;
516
517   // Test1. Touch point down and up inside the button.
518
519   gPushButtonReleased = false;
520   event = Dali::Integration::TouchEvent();
521   event.AddPoint( GetPointDownInside() );
522   application.ProcessEvent( event );
523
524   event = Dali::Integration::TouchEvent();
525   event.AddPoint( GetPointUpInside() );
526   application.ProcessEvent( event );
527
528   DALI_TEST_CHECK( gPushButtonReleased );
529
530   // Test2. Touch point down and up outside the button.
531
532   gPushButtonReleased = false;
533   event = Dali::Integration::TouchEvent();
534   event.AddPoint( GetPointDownOutside() );
535   application.ProcessEvent( event );
536
537   event = Dali::Integration::TouchEvent();
538   event.AddPoint( GetPointUpOutside() );
539   application.ProcessEvent( event );
540
541   DALI_TEST_CHECK( !gPushButtonReleased );
542
543   // Test3. Touch point down inside and up outside the button.
544
545   gPushButtonReleased = false;
546   event = Dali::Integration::TouchEvent();
547   event.AddPoint( GetPointDownInside() );
548   application.ProcessEvent( event );
549
550   event = Dali::Integration::TouchEvent();
551   event.AddPoint( GetPointLeave() );
552   application.ProcessEvent( event );
553
554   event = Dali::Integration::TouchEvent();
555   event.AddPoint( GetPointUpOutside() );
556   application.ProcessEvent( event );
557
558   DALI_TEST_CHECK( gPushButtonReleased );
559
560   // Test4. Touch point down outside and up inside the button.
561
562   gPushButtonReleased = false;
563   event = Dali::Integration::TouchEvent();
564   event.AddPoint( GetPointDownOutside() );
565   application.ProcessEvent( event );
566
567   event = Dali::Integration::TouchEvent();
568   event.AddPoint( GetPointEnter() );
569   application.ProcessEvent( event );
570
571   event = Dali::Integration::TouchEvent();
572   event.AddPoint( GetPointUpInside() );
573   application.ProcessEvent( event );
574
575   DALI_TEST_CHECK( !gPushButtonReleased );
576   END_TEST;
577 }
578
579 int UtcDaliPushButtonSelected(void)
580 {
581   ToolkitTestApplication application;
582   tet_infoline(" UtcDaliPushButtonSelected");
583
584   PushButton pushButton = PushButton::New();
585   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
586   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
587   pushButton.SetPosition( BUTTON_POSITON_TO_GET_INSIDE_TOUCH_EVENTS );
588   pushButton.SetSize( BUTTON_SIZE_TO_GET_INSIDE_TOUCH_EVENTS );
589
590   Stage::GetCurrent().Add( pushButton );
591
592   application.SendNotification();
593   application.Render();
594
595   // connect to its touch signal
596   pushButton.StateChangedSignal().Connect( &PushButtonSelected );
597
598   Dali::Integration::TouchEvent event;
599
600   // Test1. No togglable button.
601
602   gPushButtonSelectedState = false;
603   event = Dali::Integration::TouchEvent();
604   event.AddPoint( GetPointDownInside() );
605   application.ProcessEvent( event );
606
607   event = Dali::Integration::TouchEvent();
608   event.AddPoint( GetPointUpInside() );
609   application.ProcessEvent( event );
610
611   DALI_TEST_CHECK( !gPushButtonSelectedState );
612
613   // Set togglable property.
614   pushButton.SetProperty( Button::Property::TOGGLABLE, true );
615
616   // Test2. Touch point down and up inside the button twice.
617   gPushButtonSelectedState = false;
618   event = Dali::Integration::TouchEvent();
619   event.AddPoint( GetPointDownInside() );
620   application.ProcessEvent( event );
621
622   event = Dali::Integration::TouchEvent();
623   event.AddPoint( GetPointUpInside() );
624   application.ProcessEvent( event );
625
626   DALI_TEST_CHECK( gPushButtonSelectedState );
627
628   event = Dali::Integration::TouchEvent();
629   event.AddPoint( GetPointDownInside() );
630   application.ProcessEvent( event );
631
632   event = Dali::Integration::TouchEvent();
633   event.AddPoint( GetPointUpInside() );
634   application.ProcessEvent( event );
635
636   DALI_TEST_CHECK( !gPushButtonSelectedState );
637
638   // Test3. Touch point down and up outside the button.
639
640   gPushButtonSelectedState = false;
641   event = Dali::Integration::TouchEvent();
642   event.AddPoint( GetPointDownOutside() );
643   application.ProcessEvent( event );
644
645   event = Dali::Integration::TouchEvent();
646   event.AddPoint( GetPointUpOutside() );
647   application.ProcessEvent( event );
648
649   DALI_TEST_CHECK( !gPushButtonSelectedState );
650
651   // Test4. Touch point down inside and up outside the button.
652   //        State changes on Button down
653   gPushButtonSelectedState = false;
654   event = Dali::Integration::TouchEvent();
655   event.AddPoint( GetPointDownInside() );
656   application.ProcessEvent( event );
657
658   event = Dali::Integration::TouchEvent();
659   event.AddPoint( GetPointLeave() );
660   application.ProcessEvent( event );
661
662   event = Dali::Integration::TouchEvent();
663   event.AddPoint( GetPointUpOutside() );
664   application.ProcessEvent( event );
665
666   DALI_TEST_CHECK( gPushButtonSelectedState );
667
668   // Test5. Touch point down outside and up inside the button.
669   // Start in unselected state
670   pushButton.SetProperty( Button::Property::SELECTED, false );
671
672   DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("selected") ),false , TEST_LOCATION );
673
674   gPushButtonSelectedState = false;
675   event = Dali::Integration::TouchEvent();
676   event.AddPoint( GetPointDownOutside() );
677   application.ProcessEvent( event );
678
679   event = Dali::Integration::TouchEvent();
680   event.AddPoint( GetPointEnter() );
681   application.ProcessEvent( event );
682
683   event = Dali::Integration::TouchEvent();
684   event.AddPoint( GetPointUpInside() );
685   application.ProcessEvent( event );
686
687   DALI_TEST_CHECK( !gPushButtonSelectedState );
688   END_TEST;
689 }
690
691 int UtcDaliPushButtonPropertySetIconAlignment(void)
692 {
693   ToolkitTestApplication application;
694   tet_infoline(" UtcDaliPushButtonPropertySetIconAlignment");
695
696   PushButton pushButton = PushButton::New();
697   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "TOP" );
698   DALI_TEST_EQUALS( pushButton.GetProperty<std::string>( Toolkit::PushButton::Property::ICON_ALIGNMENT ), "TOP", TEST_LOCATION );
699
700   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "RIGHT" );
701   DALI_TEST_EQUALS( pushButton.GetProperty<std::string>( Toolkit::PushButton::Property::ICON_ALIGNMENT ), "RIGHT", TEST_LOCATION );
702
703   END_TEST;
704 }
705
706 int UtcDaliPushButtonPropertySetLabelPadding(void)
707 {
708   ToolkitTestApplication application;
709   tet_infoline(" UtcDaliPushButtonPropertySetLabelPadding");
710
711   PushButton pushButton = PushButton::New();
712   pushButton.SetProperty( Toolkit::PushButton::Property::LABEL_PADDING, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
713   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 );
714
715   pushButton.SetProperty( Toolkit::PushButton::Property::LABEL_PADDING, Vector4( 10.0f, 10.0f, 10.0f, 10.0f ) );
716   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 );
717
718   END_TEST;
719 }
720
721 int UtcDaliPushButtonPropertySetIconPadding(void)
722 {
723   ToolkitTestApplication application;
724   tet_infoline(" UtcDaliPushButtonPropertySetIconPadding");
725
726   PushButton pushButton = PushButton::New();
727   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_PADDING, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
728   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 );
729
730   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_PADDING, Vector4( 10.0f, 10.0f, 10.0f, 10.0f ) );
731   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 );
732
733   END_TEST;
734 }
735
736 int UtcDaliPushButtonPaddingLayout(void)
737 {
738   ToolkitTestApplication application;
739   tet_infoline(" UtcDaliPushButtonPaddingLayout");
740
741   // This test creates padding for an icon and a label.
742   // The icon and label are each enabled and disabled to confirm the correct padding is used.
743   PushButton pushButton = PushButton::New();
744
745   const Vector4 TEST_ICON_PADDING( 20.0f, 20.0f, 20.0f, 20.0f );
746   const Vector4 TEST_LABEL_PADDING( 10.0f, 10.0f, 10.0f, 10.0f );
747
748   // Get actual size of test image
749   ImageDimensions testImageSize = Dali::GetClosestImageSize( TEST_IMAGE_ONE );
750   const Vector2 TEST_IMAGE_SIZE( testImageSize.GetWidth(), testImageSize.GetHeight() );
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   application.SendNotification();
760   application.Render();
761
762   // First test the size is zero.
763   // No padding should be added as there is no label or icon.
764   Vector2 size( Vector2::ZERO );
765   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
766   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
767   tet_printf( "Button Natural Size(%f,%f)\n", pushButton.GetNaturalSize().width, pushButton.GetNaturalSize().height );
768
769   DALI_TEST_EQUALS( size, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
770
771   // Check label only padding
772   pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Label" );
773
774   application.SendNotification();
775   application.Render();
776
777   Vector2 sizeWithLabelWithoutPadding( Vector2::ZERO );
778   sizeWithLabelWithoutPadding.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
779   sizeWithLabelWithoutPadding.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
780
781   tet_printf( "Button RelayoutSize label without padding (%f,%f)\n", sizeWithLabelWithoutPadding.width, sizeWithLabelWithoutPadding.height );
782
783   // Add label padding to label
784   pushButton.SetProperty( Toolkit::PushButton::Property::LABEL_PADDING, TEST_LABEL_PADDING );
785   application.SendNotification();
786   application.Render();
787
788   Vector2 sizeLabelAndPadding( Vector2::ZERO );
789   sizeLabelAndPadding.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
790   sizeLabelAndPadding.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
791   tet_printf( "Button RelayoutSize after label padding(%f,%f)\n", sizeLabelAndPadding.width, sizeLabelAndPadding.height );
792
793   // If control size has increased beyond size of just label then padding has been applied
794   DALI_TEST_GREATER( sizeLabelAndPadding.width, sizeWithLabelWithoutPadding.width+TEST_LABEL_PADDING.x, TEST_LOCATION );
795   DALI_TEST_GREATER( sizeLabelAndPadding.height, sizeWithLabelWithoutPadding.height+TEST_LABEL_PADDING.w, TEST_LOCATION );
796
797   // Re-initialise the button so we can setup icon-only padding.
798   pushButton.Unparent();
799   pushButton = PushButton::New();
800
801   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
802   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
803   pushButton.SetPosition( 0.0f, 0.0f );
804   pushButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
805
806   Stage::GetCurrent().Add( pushButton );
807
808
809   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "RIGHT" );
810   pushButton.SetProperty( Toolkit::PushButton::Property::UNSELECTED_ICON, TEST_IMAGE_ONE );
811   pushButton.SetProperty( Toolkit::PushButton::Property::SELECTED_ICON, TEST_IMAGE_ONE );
812
813   application.SendNotification();
814   application.Render();
815
816   // Size of button with just icon
817   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
818   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
819   tet_printf( "Button RelayoutSize with icon(%f,%f)\n", size.width, size.height );
820
821   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_PADDING, TEST_ICON_PADDING );
822
823   application.SendNotification();
824   application.Render();
825   DALI_TEST_EQUALS( size, TEST_IMAGE_SIZE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
826
827   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
828   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
829   tet_printf( "Button RelayoutSize after icon padding(%f,%f)\n", size.width, size.height );
830   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 );
831   DALI_TEST_EQUALS( size, expectedIconAndPaddingSize, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
832
833   // Now test padding for both label and icon simultaneously.
834   pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Label" );
835
836   application.SendNotification();
837   application.Render();
838
839   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
840   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
841   tet_printf( "Button RelayoutSize after label added(%f,%f)\n", size.width, size.height );
842
843   pushButton.SetProperty( Toolkit::PushButton::Property::LABEL_PADDING, TEST_LABEL_PADDING );
844
845   application.SendNotification();
846   application.Render();
847
848   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
849   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
850   tet_printf( "Button RelayoutSize after icon and label padding(%f,%f)\n", size.width, size.height );
851
852   DALI_TEST_EQUALS( size.width, sizeLabelAndPadding.width + expectedIconAndPaddingSize.width, TEST_LOCATION );
853   // Test height of control is same as icon and padding, as Text is smaller than icon
854   DALI_TEST_EQUALS( size.height, expectedIconAndPaddingSize.height, TEST_LOCATION );
855
856   END_TEST;
857 }
858
859 int UtcDaliPushButtonAlignmentLayout(void)
860 {
861   ToolkitTestApplication application;
862   tet_infoline(" UtcDaliPushButtonAlignmentLayout");
863
864   /*
865    * This test checks different alignments for the icon against the label.
866    * The icon is then moved around the label in each of it's alignments.
867    * The final relayed out size is checked to confirm the layout has been done correctly.
868    *
869    * There is an Icon which has 0 width and height, but with 75 padding on all sides.
870    *  - Therefore total width and height are both 150.
871    *
872    * There is a Label which has "an unknown" width and height, but with 30 padding on all sides.
873    *  - Therefore total width and height are 60+x and 60+y respectively.
874    *    Where x & y are the width and height of the text.
875    *
876    * The width of the button will always expand to the largest of the icon and label sizes (plus padding).
877    * So We use the padding to help us determine the orientation is correct for each alignment.
878    *
879    * |<- 150 ->|         |<-- 60+x -->|
880    *
881    * +---------+   -
882    * |         |   ^     +------------+   -
883    * |         |   |     |            |   ^
884    * |  Icon   |  150    |   Label    |  60+y
885    * |         |   |     |            |   v
886    * |         |   v     +------------+   -
887    * +---------+   -
888    */
889
890   const Vector4 TEST_ICON_PADDING( 70.0f, 70.0f, 70.0f, 70.0f );
891   const Vector4 TEST_LABEL_PADDING( 30.0f, 30.0f, 30.0f, 30.0f );
892
893   // Get actual size of test image
894   ImageDimensions testImageSize = Dali::GetClosestImageSize( TEST_IMAGE_ONE );
895   const Vector2 TEST_IMAGE_SIZE( testImageSize.GetWidth(), testImageSize.GetHeight() );
896
897   PushButton pushButton = PushButton::New();
898
899   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
900   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
901   pushButton.SetPosition( 0.0f, 0.0f );
902   pushButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
903
904   Stage::GetCurrent().Add( pushButton );
905
906   // Add a label and get size of control
907   pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Label" );
908   application.SendNotification();
909   application.Render();
910
911   // First get the size of control with just label
912   Vector2 justLabelSize( Vector2::ZERO );
913   justLabelSize.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
914   justLabelSize.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
915   tet_printf( "Button RelayoutSize with just label and no padding(%f,%f)\n", justLabelSize.width, justLabelSize.height );
916
917   pushButton.SetProperty( Toolkit::PushButton::Property::LABEL_PADDING, TEST_LABEL_PADDING );
918   application.SendNotification();
919   application.Render();
920
921   // Size of Label and Padding
922   Vector2 expectedLabelAndPaddingSize( Vector2::ZERO );
923   expectedLabelAndPaddingSize.width = justLabelSize.width + TEST_LABEL_PADDING.x + TEST_LABEL_PADDING.y;
924   expectedLabelAndPaddingSize.height = justLabelSize.height + TEST_LABEL_PADDING.w + TEST_LABEL_PADDING.z;
925
926   Vector2 labelAndPaddingSize( Vector2::ZERO );
927   labelAndPaddingSize.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
928   labelAndPaddingSize.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
929
930   DALI_TEST_EQUALS( labelAndPaddingSize, expectedLabelAndPaddingSize , Math::MACHINE_EPSILON_1000, TEST_LOCATION );
931
932   const Vector2 testImageWithPaddingSize = Vector2 ( ( TEST_IMAGE_SIZE.width + TEST_ICON_PADDING.x + TEST_ICON_PADDING.y ),
933                                                      ( TEST_IMAGE_SIZE.height + TEST_ICON_PADDING.w + TEST_ICON_PADDING.z ) );
934
935   // Add Icon and set its alignment
936   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "RIGHT" );
937   pushButton.SetProperty( Toolkit::PushButton::Property::UNSELECTED_ICON, TEST_IMAGE_ONE );
938   pushButton.SetProperty( Toolkit::PushButton::Property::SELECTED_ICON, TEST_IMAGE_ONE );
939   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_PADDING, TEST_ICON_PADDING );
940
941   application.SendNotification();
942   application.Render();
943
944   Vector2 size( Vector2::ZERO );
945   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
946   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
947
948   /*
949    * Test Icon right alignment.
950    * Height grows to largest of Icon or Label (+ padding).
951    * Normally this will be Icons height, except with very large font sizes.
952    *
953    *  +------------+---------+
954    *  |............+         |
955    *  |            |         |
956    *  |   Label    |  Icon   |
957    *  |            |         |
958    *  |............+         |
959    *  +------------+---------+
960    */
961   DALI_TEST_EQUALS( size.width, ( testImageWithPaddingSize.width + labelAndPaddingSize.width ) , TEST_LOCATION );
962   DALI_TEST_EQUALS( size.height, ( std::max( testImageWithPaddingSize.height, labelAndPaddingSize.height) ) , Math::MACHINE_EPSILON_1000, TEST_LOCATION );
963
964   // Now test left alignment matches right for size.
965   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "LEFT" );
966
967   application.SendNotification();
968   application.Render();
969
970   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
971   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
972
973   /*
974    * Test Icon left alignment.
975    * Height grows to largest of Icon or Label (+ padding).
976    * Normally this will be Icons height, except with very large font sizes.
977    *
978    *  +---------+------------+
979    *  |         +............|
980    *  |         |            |
981    *  |  Icon   |   Label    |
982    *  |         |            |
983    *  |         +............|
984    *  +---------+------------+
985    */
986   DALI_TEST_EQUALS( size.width, ( testImageWithPaddingSize.width + labelAndPaddingSize.width ) , TEST_LOCATION );
987   DALI_TEST_EQUALS( size.height, ( std::max( testImageWithPaddingSize.height, labelAndPaddingSize.height) ) , Math::MACHINE_EPSILON_1000, TEST_LOCATION );
988
989   tet_infoline(" Test Icon TOP alignment - Width grows to largest of Icon or label (plus padding)");
990   /*
991    *
992    *  +---------+
993    *  |         |
994    *  |         |
995    *  |  Icon   |
996    *  |         |
997    *  |         |
998    *  +---------+
999    *  |         |
1000    *  |  Label  |
1001    *  |         |
1002    *  +---------+
1003    *
1004    */
1005
1006   tet_infoline("SetProperty on ICON_ALIGNMENT should relayout the Button");
1007   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "TOP" );
1008
1009   application.SendNotification();
1010   application.Render();
1011
1012   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
1013   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
1014
1015   tet_printf("Natural width (%f)\n",pushButton.GetNaturalSize().width);
1016   tet_printf("Natural height (%f)\n",pushButton.GetNaturalSize().height);
1017
1018   tet_printf(" UtcDaliPushButtonAlignmentLayout Top layout - Image and Padding size (%f,%f)\n", testImageWithPaddingSize.width, testImageWithPaddingSize.height );
1019   tet_printf(" UtcDaliPushButtonAlignmentLayout Top layout - Text and Padding size (%f,%f)\n", labelAndPaddingSize.width, labelAndPaddingSize.height );
1020
1021   DALI_TEST_EQUALS( size.width, ( std::max( testImageWithPaddingSize.width, labelAndPaddingSize.width ) ) , TEST_LOCATION );
1022
1023   DALI_TEST_EQUALS( size.height,( testImageWithPaddingSize.height + labelAndPaddingSize.height ) , TEST_LOCATION );
1024
1025   /*
1026    * Test Icon bottom alignment.
1027    * Width grows to largest of Icon or Label (+ padding).
1028    *
1029    *  +---------+
1030    *  |         |
1031    *  |  Label  |
1032    *  |         |
1033    *  +---------+
1034    *  |         |
1035    *  |         |
1036    *  |  Icon   |
1037    *  |         |
1038    *  |         |
1039    *  +---------+
1040    */
1041   tet_infoline(" Test Icon BOTTOM alignment - Width grows to largest of Icon or label (plus padding)");
1042   pushButton.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "BOTTOM" );
1043
1044   application.SendNotification();
1045   application.Render();
1046
1047   size.width = pushButton.GetRelayoutSize( Dimension::WIDTH );
1048   size.height = pushButton.GetRelayoutSize( Dimension::HEIGHT );
1049
1050   DALI_TEST_EQUALS( size.width, ( std::max(testImageWithPaddingSize.width, labelAndPaddingSize.width )) , TEST_LOCATION );
1051   DALI_TEST_EQUALS( size.height,( testImageWithPaddingSize.height + labelAndPaddingSize.height ) , TEST_LOCATION );
1052
1053   END_TEST;
1054 }
1055
1056 int UtcDaliPushButtonSetUnSelectedVisual01P(void)
1057 {
1058   tet_infoline(" Test adding a visual for the UNSELECTED_VISUAL property, removing Button from stage and counting renderers\n");
1059   ToolkitTestApplication application;
1060
1061   PushButton pushButton = PushButton::New();
1062   pushButton.SetSize( BUTTON_SIZE_TO_GET_INSIDE_TOUCH_EVENTS );
1063
1064   Stage::GetCurrent().Add( pushButton );
1065
1066   Property::Map propertyMap;
1067   propertyMap.Insert(Visual::Property::TYPE,  Visual::COLOR);
1068   propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
1069
1070   pushButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, propertyMap );
1071
1072   tet_infoline(" UNSELECTED_VISUAL Added to button\n");
1073
1074   application.SendNotification();
1075   application.Render(0);
1076
1077   unsigned int rendererCount = pushButton.GetRendererCount();
1078   tet_printf("After adding UNSELECTED_BACKGROUND_VISUAL the renderer count is(%d)\n", rendererCount );
1079
1080   DALI_TEST_EQUALS( pushButton.GetRendererCount(), 1 , TEST_LOCATION );
1081
1082   tet_printf("Remove button from stage\n" );
1083
1084   Stage::GetCurrent().Remove( pushButton );
1085
1086   rendererCount = pushButton.GetRendererCount();
1087   tet_printf("After removing pushbutton from stage the renderer count is(%d)\n ", rendererCount );
1088
1089   DALI_TEST_EQUALS( pushButton.GetRendererCount(), 0, TEST_LOCATION );
1090
1091   tet_printf("After removing pushbutton from stage the renderer count is(%d)\n ", rendererCount );
1092
1093   Property::Map propertyMap2;
1094   propertyMap2.Insert(Visual::Property::TYPE,  Visual::COLOR);
1095   propertyMap2.Insert(ColorVisual::Property::MIX_COLOR, Color::RED);
1096   pushButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_VISUAL, propertyMap2 );
1097
1098   tet_printf("Added UNSELECTED_VISUAL and add button back to Stage\n");
1099
1100   Stage::GetCurrent().Add( pushButton );
1101
1102   tet_printf("With UNSELECTED_BACKGROUND_VISUAL and UNSELECTED_ICON the renderer count is(%d)\n", pushButton.GetRendererCount() );
1103
1104   DALI_TEST_EQUALS( pushButton.GetRendererCount(), 2, TEST_LOCATION );
1105
1106   END_TEST;
1107 }
1108
1109 int UtcDaliPushButtonSetSelectedVisualN(void)
1110 {
1111   tet_infoline(" Test adding a broken visual for the UNSELECTED_VISUAL property");
1112
1113   ToolkitTestApplication application;
1114
1115   PushButton pushButton = PushButton::New();
1116
1117   pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1118   pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
1119   pushButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
1120
1121   Stage::GetCurrent().Add( pushButton );
1122   application.SendNotification();
1123   application.Render(0);
1124
1125   unsigned int preRendererCount = pushButton.GetRendererCount();
1126   tet_printf("RendererCount prior to adding visual(%d)\n",preRendererCount);
1127   DALI_TEST_EQUALS( preRendererCount, 0, TEST_LOCATION );
1128
1129   Stage::GetCurrent().Remove( pushButton );
1130   application.SendNotification();
1131   application.Render(0);
1132
1133   Property::Map colorMap;
1134   const int BROKEN_VISUAL_TYPE = 999999999;
1135
1136   colorMap.Insert(Visual::Property::TYPE,  BROKEN_VISUAL_TYPE);
1137   colorMap.Insert(BorderVisual::Property::COLOR,  Color::BLUE);
1138   colorMap.Insert(BorderVisual::Property::SIZE,  5.f);
1139   pushButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_VISUAL, colorMap );
1140
1141   Stage::GetCurrent().Add( pushButton );
1142   application.SendNotification();
1143   application.Render(0);
1144
1145   unsigned int postRendererCount  = pushButton.GetRendererCount();
1146   tet_printf("RendererCount post broken visual (%d)\n", postRendererCount);
1147   DALI_TEST_EQUALS( postRendererCount, 0, TEST_LOCATION );
1148
1149   END_TEST;
1150 }
1151
1152 int UtcDaliPushButtonSetButtonImageP(void)
1153 {
1154   ToolkitTestApplication application;
1155
1156   PushButton button = PushButton::New();
1157   Stage::GetCurrent().Add( button );
1158
1159   try
1160   {
1161     button.SetButtonImage( ImageView::New() );
1162     DALI_TEST_CHECK( true );
1163   }
1164   catch(...)
1165   {
1166     DALI_TEST_CHECK( false );
1167   }
1168
1169   END_TEST;
1170 }
1171
1172 int UtcDaliPushButtonSetBackgroundImageP(void)
1173 {
1174   ToolkitTestApplication application;
1175
1176   PushButton button = PushButton::New();
1177   Stage::GetCurrent().Add( button );
1178
1179   try
1180   {
1181     button.SetBackgroundImage( ImageView::New() );
1182     DALI_TEST_CHECK( true );
1183   }
1184   catch(...)
1185   {
1186     DALI_TEST_CHECK( false );
1187   }
1188
1189   END_TEST;
1190 }
1191
1192 int UtcDaliPushButtonSetSelectedImageP(void)
1193 {
1194   ToolkitTestApplication application;
1195
1196   PushButton button = PushButton::New();
1197   Stage::GetCurrent().Add( button );
1198
1199   try
1200   {
1201     button.SetSelectedImage( ImageView::New() );
1202     DALI_TEST_CHECK( true );
1203   }
1204   catch(...)
1205   {
1206     DALI_TEST_CHECK( false );
1207   }
1208
1209   END_TEST;
1210 }
1211
1212 int UtcDaliPushButtonSetSelectedBackgroundImageP(void)
1213 {
1214   ToolkitTestApplication application;
1215
1216   PushButton button = PushButton::New();
1217   Stage::GetCurrent().Add( button );
1218
1219   try
1220   {
1221     button.SetSelectedBackgroundImage( ImageView::New() );
1222     DALI_TEST_CHECK( true );
1223   }
1224   catch(...)
1225   {
1226     DALI_TEST_CHECK( false );
1227   }
1228
1229   END_TEST;
1230 }
1231
1232 int UtcDaliPushButtonSetDisabledBackgroundImageP(void)
1233 {
1234   ToolkitTestApplication application;
1235
1236   PushButton button = PushButton::New();
1237   Stage::GetCurrent().Add( button );
1238
1239   try
1240   {
1241     button.SetDisabledBackgroundImage( ImageView::New() );
1242     DALI_TEST_CHECK( true );
1243   }
1244   catch(...)
1245   {
1246     DALI_TEST_CHECK( false );
1247   }
1248
1249   END_TEST;
1250 }
1251
1252
1253 int UtcDaliPushButtonSetDisabledImageP(void)
1254 {
1255   ToolkitTestApplication application;
1256
1257   PushButton button = PushButton::New();
1258   Stage::GetCurrent().Add( button );
1259
1260   try
1261   {
1262     button.SetDisabledImage( ImageView::New() );
1263     DALI_TEST_CHECK( true );
1264   }
1265   catch(...)
1266   {
1267     DALI_TEST_CHECK( false );
1268   }
1269
1270   END_TEST;
1271 }
1272
1273 int UtcDaliPushButtonSetDisabledSelectedImageP(void)
1274 {
1275   ToolkitTestApplication application;
1276
1277   PushButton button = PushButton::New();
1278   Stage::GetCurrent().Add( button );
1279
1280   try
1281   {
1282     button.SetDisabledSelectedImage( ImageView::New() );
1283     DALI_TEST_CHECK( true );
1284   }
1285   catch(...)
1286   {
1287     DALI_TEST_CHECK( false );
1288   }
1289
1290   END_TEST;
1291 }
1292
1293 int UtcDaliPushButtonToggleSignalP(void)
1294 {
1295   ToolkitTestApplication application;
1296   tet_infoline(" UtcDaliButtonToggleSignalP Ensure Signals emitted");
1297
1298   PushButton button = PushButton::New();
1299   button.SetProperty( Button::Property::TOGGLABLE, true);
1300
1301   SetupButtonForTestTouchEvents( application, button, true );
1302
1303   Stage::GetCurrent().Add( button );
1304
1305   application.SendNotification();
1306   application.Render();
1307
1308   // connect to its signal
1309   button.ClickedSignal().Connect( &PushButtonClicked );
1310   gPushButtonClicked = false;
1311
1312   tet_infoline(" Touch down and up within button");
1313   Dali::Integration::TouchEvent event;
1314   event = Dali::Integration::TouchEvent();
1315   event.AddPoint( GetPointDownInside() );
1316   application.ProcessEvent( event );
1317
1318   event = Dali::Integration::TouchEvent();
1319   event.AddPoint( GetPointUpInside() );
1320   application.ProcessEvent( event );
1321
1322   DALI_TEST_EQUALS( gPushButtonClicked, true, TEST_LOCATION );
1323
1324   END_TEST;
1325 }
1326
1327 // Deprecated API Tests
1328
1329 int UtcDaliPushButtonSetGetAutoRepeating(void)
1330 {
1331   ToolkitTestApplication application;
1332   tet_infoline(" UtcDaliPushButtonSetGetAutoRepeating");
1333
1334   PushButton pushButton = PushButton::New();
1335
1336   pushButton.SetAutoRepeating( true );
1337
1338   DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
1339
1340   pushButton.SetAutoRepeating( false );
1341
1342   DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
1343
1344   pushButton.SetAutoRepeating( true );
1345
1346   DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
1347   END_TEST;
1348 }
1349
1350 int UtcDaliPushButtonSetGetTogglableButton(void)
1351 {
1352   ToolkitTestApplication application;
1353   tet_infoline(" UtcDaliPushButtonSetGetTogglableButton");
1354
1355   PushButton pushButton = PushButton::New();
1356
1357   pushButton.SetTogglableButton( true );
1358
1359   DALI_TEST_CHECK( pushButton.IsTogglableButton() );
1360
1361   pushButton.SetTogglableButton( false );
1362
1363   DALI_TEST_CHECK( !pushButton.IsTogglableButton() );
1364
1365   pushButton.SetTogglableButton( true );
1366
1367   DALI_TEST_CHECK( pushButton.IsTogglableButton() );
1368   END_TEST;
1369 }
1370
1371 int UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton(void)
1372 {
1373   ToolkitTestApplication application;
1374   tet_infoline(" UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton");
1375
1376   PushButton pushButton = PushButton::New();
1377
1378   pushButton.SetAutoRepeating( true );
1379   pushButton.SetTogglableButton( true );
1380
1381   DALI_TEST_CHECK( pushButton.IsTogglableButton() );
1382   DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
1383
1384   pushButton.SetTogglableButton( true );
1385   pushButton.SetAutoRepeating( true );
1386
1387   DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
1388   DALI_TEST_CHECK( !pushButton.IsTogglableButton() );
1389   END_TEST;
1390 }
1391
1392 int UtcDaliPushButtonSetGetSelected01(void)
1393 {
1394   ToolkitTestApplication application;
1395   tet_infoline(" UtcDaliPushButtonSetGetSelected01");
1396
1397   PushButton pushButton = PushButton::New();
1398
1399   pushButton.SetTogglableButton( true );
1400   pushButton.StateChangedSignal().Connect( &PushButtonSelected );
1401
1402   gPushButtonSelectedState = false;
1403   pushButton.SetSelected( true );
1404
1405   DALI_TEST_CHECK( pushButton.IsSelected() );
1406   DALI_TEST_CHECK( gPushButtonSelectedState );
1407
1408   pushButton.SetSelected( false );
1409
1410   DALI_TEST_CHECK( !pushButton.IsSelected() );
1411   DALI_TEST_CHECK( !gPushButtonSelectedState );
1412
1413   pushButton.SetSelected( true );
1414
1415   DALI_TEST_CHECK( pushButton.IsSelected() );
1416   DALI_TEST_CHECK( gPushButtonSelectedState );
1417   END_TEST;
1418 }
1419
1420 int UtcDaliPushButtonSetGetSelected02(void)
1421 {
1422   ToolkitTestApplication application;
1423   tet_infoline(" UtcDaliPushButtonSetGetSelected02");
1424
1425   PushButton pushButton = PushButton::New();
1426
1427   pushButton.SetTogglableButton( false );
1428   pushButton.StateChangedSignal().Connect( &PushButtonSelected );
1429
1430   gPushButtonSelectedState = false;
1431   pushButton.SetSelected( true );
1432
1433   DALI_TEST_CHECK( !pushButton.IsSelected() );
1434   DALI_TEST_CHECK( !gPushButtonSelectedState );
1435
1436   pushButton.SetSelected( false );
1437
1438   DALI_TEST_CHECK( !pushButton.IsSelected() );
1439   DALI_TEST_CHECK( !gPushButtonSelectedState );
1440
1441   pushButton.SetSelected( true );
1442
1443   DALI_TEST_CHECK( !pushButton.IsSelected() );
1444   DALI_TEST_CHECK( !gPushButtonSelectedState );
1445   END_TEST;
1446 }
1447
1448 int UtcDaliPushButtonSetGetAutorepeatingDelayValues01(void)
1449 {
1450   ToolkitTestApplication application;
1451   tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues01");
1452
1453   PushButton pushButton = PushButton::New();
1454
1455   pushButton.SetAutoRepeating( true );
1456
1457   pushButton.SetInitialAutoRepeatingDelay( 1.f );
1458   DALI_TEST_EQUALS( pushButton.GetInitialAutoRepeatingDelay(), 1.f, TEST_LOCATION );
1459
1460   pushButton.SetNextAutoRepeatingDelay( 1.f );
1461   DALI_TEST_EQUALS( pushButton.GetNextAutoRepeatingDelay(), 1.f, TEST_LOCATION );
1462   END_TEST;
1463 }
1464
1465 int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void)
1466 {
1467   ToolkitTestApplication application;
1468   tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues02");
1469
1470   PushButton pushButton = PushButton::New();
1471
1472   bool assert1( false );
1473   bool assert2( false );
1474
1475   pushButton.SetAutoRepeating( true );
1476
1477   try
1478   {
1479     pushButton.SetInitialAutoRepeatingDelay( -1.f );
1480   }
1481   catch( Dali::DaliException& e )
1482   {
1483     DALI_TEST_PRINT_ASSERT( e );
1484     DALI_TEST_EQUALS(e.condition, "initialAutoRepeatingDelay > 0.f", TEST_LOCATION);
1485     assert1 = true;
1486   }
1487
1488   try
1489   {
1490     pushButton.SetNextAutoRepeatingDelay( -1.f );
1491   }
1492   catch( Dali::DaliException& e )
1493   {
1494     DALI_TEST_PRINT_ASSERT( e );
1495     DALI_TEST_EQUALS(e.condition, "nextAutoRepeatingDelay > 0.f", TEST_LOCATION);
1496     assert2 = true;
1497   }
1498
1499   DALI_TEST_CHECK( assert1 && assert2 );
1500   END_TEST;
1501 }
1502
1503 int UtcDaliPushButtonSetLabelText(void)
1504 {
1505   ToolkitTestApplication application;
1506   tet_infoline(" UtcDaliPushButtonSetLabelText");
1507
1508   const std::string STR( "Hola!" );
1509
1510   PushButton pushButton = PushButton::New();
1511
1512   pushButton.SetProperty( Toolkit::Button::Property::LABEL,
1513                           Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
1514                                          .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
1515                         );
1516
1517   application.SendNotification();
1518   application.Render();
1519
1520   pushButton.SetLabelText( STR );
1521
1522   DALI_TEST_EQUALS( pushButton.GetLabelText(), STR, TEST_LOCATION );
1523
1524   END_TEST;
1525 }
1526
1527 int UtcDaliPushButtonSetButtonImageDeprecatedP(void)
1528 {
1529   ToolkitTestApplication application;
1530   Image setButtonImage = ResourceImage::New( TEST_IMAGE_ONE);
1531   PushButton pushButton = PushButton::New();
1532   pushButton.SetButtonImage( setButtonImage );
1533   Image retreivedButtonImage = ImageView::DownCast(pushButton.GetButtonImage()).GetImage();
1534   DALI_TEST_EQUALS( retreivedButtonImage, setButtonImage ,  TEST_LOCATION );
1535
1536   END_TEST;
1537 }
1538
1539 int UtcDaliPushButtonSetSelectedImageDeprecatedP(void)
1540 {
1541   ToolkitTestApplication application;
1542   Image setButtonImage = ResourceImage::New( TEST_IMAGE_ONE);
1543   PushButton pushButton = PushButton::New();
1544   pushButton.SetSelectedImage( setButtonImage );
1545   Image retreivedButtonImage = ImageView::DownCast(pushButton.GetSelectedImage()).GetImage();
1546   DALI_TEST_EQUALS( retreivedButtonImage, setButtonImage ,  TEST_LOCATION );
1547
1548   END_TEST;
1549 }
1550
1551 int UtcDaliPushButtonGetButtonImageURLDeprecatedP(void)
1552 {
1553   tet_infoline(" UtcDaliPushButtonGetButtonImageURLDeprecatedP Testing mix use of API");
1554
1555   ToolkitTestApplication application;
1556
1557   PushButton pushButton = PushButton::New();
1558   pushButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, TEST_IMAGE_ONE );
1559
1560   ImageView retreivedButtonImageView = ImageView::DownCast(pushButton.GetButtonImage());
1561   Image retreivedButtonImage = retreivedButtonImageView.GetImage();
1562   ResourceImage resourceImage = ResourceImage::DownCast( retreivedButtonImage );
1563
1564   DALI_TEST_EQUALS( resourceImage.GetUrl(), TEST_IMAGE_ONE ,  TEST_LOCATION );
1565
1566   END_TEST;
1567 }
1568
1569 int UtcDaliPushButtonGetSelectedImageURLDeprecatedP(void)
1570 {
1571   tet_infoline(" UtcDaliPushButtonGetSelectedImageURLDeprecatedP Testing mix use of API");
1572
1573   ToolkitTestApplication application;
1574
1575   PushButton pushButton = PushButton::New();
1576
1577   pushButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, TEST_IMAGE_ONE );
1578
1579   Image retreivedButtonImage = ImageView::DownCast(pushButton.GetSelectedImage()).GetImage();
1580   ResourceImage resourceImage = ResourceImage::DownCast( retreivedButtonImage );
1581   DALI_TEST_EQUALS( resourceImage.GetUrl(), TEST_IMAGE_ONE ,  TEST_LOCATION );
1582
1583   END_TEST;
1584 }
1585
1586 int UtcDaliPushButtonSetSelectedImageWithActorDeprecatedP(void)
1587 {
1588   tet_infoline(" UtcDaliPushButton SetSelectedImage With ImageView (Actor)");
1589
1590   ToolkitTestApplication application;
1591
1592   Image image = ResourceImage::New( TEST_IMAGE_ONE );
1593
1594   DALI_TEST_CHECK( image );
1595
1596   ImageView imgViewSet = ImageView::New(image);
1597
1598   DALI_TEST_CHECK(imgViewSet );
1599
1600   PushButton pushButton = PushButton::New();
1601
1602   DALI_TEST_CHECK( pushButton );
1603
1604   pushButton.SetSelectedImage( imgViewSet );
1605
1606   ImageView imageView = ImageView::DownCast( pushButton.GetSelectedImage());
1607
1608   DALI_TEST_CHECK( imageView );
1609
1610   Property::Value value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) );
1611   Property::Map map;
1612   value.Get( map );
1613   DALI_TEST_CHECK( !map.Empty() );
1614   DALI_TEST_EQUALS( map[ "filename" ].Get<std::string>(), TEST_IMAGE_ONE , TEST_LOCATION );
1615
1616   END_TEST;
1617 }
1618
1619 int UtcDaliPushButtonSetButtonImageWithActorDeprecatedP(void)
1620 {
1621   tet_infoline(" UtcDaliPushButton SetButtonImage With ImageView (Actor)");
1622
1623   ToolkitTestApplication application;
1624
1625   Image image = ResourceImage::New( TEST_IMAGE_ONE );
1626
1627   DALI_TEST_CHECK( image );
1628
1629   ImageView imgViewSet = ImageView::New(image);
1630
1631   DALI_TEST_CHECK(imgViewSet );
1632
1633   PushButton pushButton = PushButton::New();
1634
1635   DALI_TEST_CHECK( pushButton );
1636
1637   pushButton.SetButtonImage( imgViewSet );
1638
1639   ImageView imageView = ImageView::DownCast( pushButton.GetButtonImage());
1640
1641   DALI_TEST_CHECK( imageView );
1642
1643   Property::Value value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) );
1644   Property::Map map;
1645   value.Get( map );
1646   DALI_TEST_CHECK( !map.Empty() );
1647   DALI_TEST_EQUALS( map[ "filename" ].Get<std::string>(), TEST_IMAGE_ONE , TEST_LOCATION );
1648
1649   END_TEST;
1650 }
1651
1652 int UtcDaliPushButtonSetBackgroundImageWithActorDeprecatedP(void)
1653 {
1654   tet_infoline(" UtcDaliPushButton SetBackgroundImage With ImageView (Actor)");
1655
1656   ToolkitTestApplication application;
1657
1658   Image image = ResourceImage::New( TEST_IMAGE_ONE );
1659
1660   DALI_TEST_CHECK( image );
1661
1662   ImageView imgViewSet = ImageView::New(image);
1663
1664   DALI_TEST_CHECK(imgViewSet );
1665
1666   PushButton pushButton = PushButton::New();
1667
1668   DALI_TEST_CHECK( pushButton );
1669
1670   pushButton.SetBackgroundImage( imgViewSet );
1671
1672   ImageView imageView = ImageView::DownCast( pushButton.GetButtonImage());
1673
1674   DALI_TEST_CHECK( imageView );
1675
1676   Property::Value value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) );
1677   Property::Map map;
1678   value.Get( map );
1679   DALI_TEST_CHECK( !map.Empty() );
1680   DALI_TEST_EQUALS( map[ "filename" ].Get<std::string>(), TEST_IMAGE_ONE , TEST_LOCATION );
1681
1682   END_TEST;
1683 }
1684
1685
1686 int UtcDaliPushButtonSetSelectedBackgroundImageWithActorDeprecatedP(void)
1687 {
1688   tet_infoline(" UtcDaliPushButton SetSelectedBackgroundImage With ImageView (Actor)");
1689
1690   ToolkitTestApplication application;
1691
1692   Image image = ResourceImage::New( TEST_IMAGE_ONE );
1693
1694   DALI_TEST_CHECK( image );
1695
1696   ImageView imgViewSet = ImageView::New(image);
1697
1698   DALI_TEST_CHECK(imgViewSet );
1699
1700   PushButton pushButton = PushButton::New();
1701
1702   DALI_TEST_CHECK( pushButton );
1703
1704   pushButton.SetSelectedBackgroundImage( imgViewSet );
1705
1706   ImageView imageView = ImageView::DownCast( pushButton.GetSelectedImage());
1707
1708   DALI_TEST_CHECK( imageView );
1709
1710   Property::Value value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) );
1711   Property::Map map;
1712   value.Get( map );
1713   DALI_TEST_CHECK( !map.Empty() );
1714   DALI_TEST_EQUALS( map[ "filename" ].Get<std::string>(), TEST_IMAGE_ONE , TEST_LOCATION );
1715
1716   END_TEST;
1717 }
1718
1719 int UtcDaliPushButtonSetDisabledBackgroundImageWithActorDeprecatedP(void)
1720 {
1721   tet_infoline(" UtcDaliPushButton SetDisabledBackgroundImage With ImageView (Actor)");
1722
1723   ToolkitTestApplication application;
1724
1725   Image image = ResourceImage::New( TEST_IMAGE_ONE );
1726
1727   DALI_TEST_CHECK( image );
1728
1729   ImageView imgViewSet = ImageView::New(image);
1730
1731   DALI_TEST_CHECK(imgViewSet );
1732
1733   PushButton pushButton = PushButton::New();
1734
1735   DALI_TEST_CHECK( pushButton );
1736
1737   pushButton.SetDisabledBackgroundImage( imgViewSet );
1738
1739   Property::Value value = pushButton.GetProperty( Toolkit::DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL );
1740   Property::Map map;
1741   value.Get( map );
1742
1743   Property::Value* urlValue = map.Find( ImageVisual::Property::URL );
1744
1745   std::string urlString;
1746   urlValue->Get( urlString );
1747   DALI_TEST_EQUALS( urlString , TEST_IMAGE_ONE , TEST_LOCATION );
1748
1749   END_TEST;
1750 }
1751
1752 int UtcDaliPushButtonSetDisabledImageWithActorDeprecatedP(void)
1753 {
1754   tet_infoline(" UtcDaliPushButton SetDisabledImage With ImageView (Actor)");
1755
1756   ToolkitTestApplication application;
1757
1758   Image image = ResourceImage::New( TEST_IMAGE_ONE );
1759
1760   DALI_TEST_CHECK( image );
1761
1762   ImageView imgViewSet = ImageView::New(image);
1763
1764   DALI_TEST_CHECK(imgViewSet );
1765
1766   PushButton pushButton = PushButton::New();
1767
1768   DALI_TEST_CHECK( pushButton );
1769
1770   pushButton.SetDisabledImage( imgViewSet );
1771
1772   Property::Value value = pushButton.GetProperty( Toolkit::DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL );
1773
1774   Property::Map map;
1775   value.Get( map );
1776
1777   Property::Value* urlValue = map.Find( ImageVisual::Property::URL );
1778
1779   std::string urlString;
1780   urlValue->Get( urlString );
1781   DALI_TEST_EQUALS( urlString , TEST_IMAGE_ONE , TEST_LOCATION );
1782
1783   END_TEST;
1784 }
1785
1786 int UtcDaliPushButtonSetDisabledSelectedImageWithActorDeprecatedP(void)
1787 {
1788   tet_infoline(" UtcDaliPushButton SetDisabledSelectedImage With ImageView (Actor)");
1789
1790   ToolkitTestApplication application;
1791
1792   Image image = ResourceImage::New( TEST_IMAGE_ONE );
1793
1794   DALI_TEST_CHECK( image );
1795
1796   ImageView imgViewSet = ImageView::New(image);
1797
1798   DALI_TEST_CHECK(imgViewSet );
1799
1800   PushButton pushButton = PushButton::New();
1801
1802   DALI_TEST_CHECK( pushButton );
1803
1804   pushButton.SetDisabledSelectedImage( imgViewSet );
1805
1806   Property::Value value = pushButton.GetProperty( Toolkit::DevelButton::Property::DISABLED_SELECTED_BACKGROUND_VISUAL );
1807
1808   Property::Map map;
1809   value.Get( map );
1810
1811   Property::Value* urlValue = map.Find( ImageVisual::Property::URL );
1812
1813   std::string urlString;
1814   urlValue->Get( urlString );
1815   DALI_TEST_EQUALS( urlString , TEST_IMAGE_ONE , TEST_LOCATION );
1816
1817   END_TEST;
1818 }