Moved StyleManager to the public API
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-styling / utc-Dali-StyleManager.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 #include <iostream>
18 #include <stdlib.h>
19 #include <dali-toolkit-test-suite-utils.h>
20 #include <dali-toolkit/dali-toolkit.h>
21 #include <dali/integration-api/events/touch-event-integ.h>
22 #include <dali-toolkit/devel-api/builder/builder.h>
23 #include <test-button.h>
24 #include <test-animation-data.h>
25 #include <toolkit-style-monitor.h>
26
27 using namespace Dali;
28 using namespace Dali::Toolkit;
29
30 namespace
31 {
32 const char* defaultTheme =
33 "{\n"
34 "  \"styles\":\n"
35 "  {\n"
36 "    \"textlabel\":\n"
37 "    {\n"
38 "      \"pointSize\":18\n"
39 "    },\n"
40 "\n"
41 "    \"textlabelFontSize0\":\n"
42 "    {\n"
43 "      \"pointSize\":8\n"
44 "    },\n"
45 "    \"textlabelFontSize1\":\n"
46 "    {\n"
47 "      \"pointSize\":10\n"
48 "    },\n"
49 "    \"textlabelFontSize2\":\n"
50 "    {\n"
51 "      \"pointSize\":15\n"
52 "    },\n"
53 "    \"textlabelFontSize3\":\n"
54 "    {\n"
55 "      \"pointSize\":19\n"
56 "    },\n"
57 "    \"textlabelFontSize4\":\n"
58 "    {\n"
59 "      \"pointSize\":25\n"
60 "    },\n"
61 "\n"
62 "    \"textfield\":\n"
63 "    {\n"
64 "      \"pointSize\":18,\n"
65 "      \"primaryCursorColor\":[0.0,0.72,0.9,1.0],\n"
66 "      \"secondaryCursorColor\":[0.0,0.72,0.9,1.0],\n"
67 "      \"cursorWidth\":3,\n"
68 "      \"selectionHighlightColor\":[0.75,0.96,1.0,1.0],\n"
69 "      \"grabHandleImage\" : \"{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png\",\n"
70 "      \"selectionHandleImageLeft\" : {\"filename\":\"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png\" },\n"
71 "      \"selectionHandleImageRight\": {\"filename\":\"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png\" }\n"
72 "    },\n"
73 "\n"
74 "    \"textfieldFontSize0\":\n"
75 "    {\n"
76 "      \"pointSize\":10\n"
77 "    },\n"
78 "    \"textfieldFontSize1\":\n"
79 "    {\n"
80 "      \"pointSize\":10\n"
81 "    },\n"
82 "    \"textfieldFontSize2\":\n"
83 "    {\n"
84 "      \"pointSize\":10\n"
85 "    },\n"
86 "    \"textfieldFontSize3\":\n"
87 "    {\n"
88 "      \"pointSize\":10\n"
89 "    },\n"
90 "    \"textfieldFontSize4\":\n"
91 "    {\n"
92 "      \"pointSize\":10\n"
93 "    },\n"
94 "    \"textselectionpopup\":\n"
95 "    {\n"
96 "      \"popupMaxSize\":[656,72],\n"
97 "      \"optionDividerSize\":[2,0],\n"
98 "      \"popupDividerColor\":[0.23,0.72,0.8,0.11],\n"
99 "      \"popupIconColor\":[1.0,1.0,1.0,1.0],\n"
100 "      \"popupPressedColor\":[0.24,0.72,0.8,0.11],\n"
101 "      \"background\": {\n"
102 "        \"rendererType\": \"nPatch\",\n"
103 "        \"imageUrl\": \"{DALI_IMAGE_DIR}selection-popup-bg.9.png\"\n"
104 "        },\n"
105 "      \"popupFadeInDuration\":0.25,\n"
106 "      \"popupFadeOutDuration\":0.25\n"
107 "    },\n"
108 "    \"textselectionpopupbutton\":\n"
109 "    {\n"
110 "      \"label\":\n"
111 "      {\n"
112 "        \"pointSize\":8,\n"
113 "        \"fontStyle\":\"{\\\\""weight\\\\"":\\\\""light\\\\""}\"\n"
114 "      }\n"
115 "    },\n"
116 "    \"textselectiontoolbar\":\n"
117 "    {\n"
118 "      \"enableOvershoot\":true,\n"
119 "      \"scrollView\":\n"
120 "      {\n"
121 "        \"overshootAnimationSpeed\":360.0,\n"
122 "        \"overshootSize\":[720.0,130.0]\n"
123 "      }\n"
124 "    },\n"
125 "    \"scrollview\":\n"
126 "    {\n"
127 "      \"overshootEffectColor\":\"B018\",\n"
128 "      \"overshootAnimationSpeed\":360.0,\n"
129 "      \"overshootSize\":[720.0,130.0]\n"
130 "    },\n"
131 "    \"itemview\":\n"
132 "    {\n"
133 "      \"overshootEffectColor\":\"B018\",\n"
134 "      \"overshootAnimationSpeed\":360.0,\n"
135 "      \"overshootSize\":[720.0,130.0]\n"
136 "    },\n"
137 "    \"texteditor\":\n"
138 "    {\n"
139 "      \"pointSize\":18,\n"
140 "      \"primaryCursorColor\":[0.0,0.72,0.9,1.0],\n"
141 "      \"secondaryCursorColor\":[0.0,0.72,0.9,1.0],\n"
142 "      \"cursorWidth\":3,\n"
143 "      \"selectionHighlightColor\":[0.75,0.96,1.0,1.0],\n"
144 "      \"grabHandleImage\" : \"{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png\",\n"
145 "      \"selectionHandleImageLeft\" : {\"filename\":\"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png\" },\n"
146 "      \"selectionHandleImageRight\": {\"filename\":\"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png\" }\n"
147 "    }\n"
148 "  }\n"
149 "}\n";
150
151 } // anonymous namespace
152
153
154
155 void dali_style_manager_startup(void)
156 {
157   test_return_value = TET_UNDEF;
158 }
159
160 void dali_style_manager_cleanup(void)
161 {
162   test_return_value = TET_PASS;
163 }
164
165
166 int UtcDaliStyleManagerConstructorP(void)
167 {
168   ToolkitTestApplication application;
169
170   tet_infoline(" UtcDaliStyleManagerConstructorP");
171   StyleManager styleManager;
172   DALI_TEST_CHECK( !styleManager);
173   END_TEST;
174 }
175
176 int UtcDaliStyleManagerCopyConstructorP(void)
177 {
178   TestApplication application;
179
180   StyleManager styleManager = StyleManager::Get();
181   StyleManager copyOfStyleManager( styleManager );
182
183   DALI_TEST_CHECK( copyOfStyleManager );
184   END_TEST;
185 }
186
187 int UtcDaliStyleManagerAssignmentOperatorP(void)
188 {
189   TestApplication application;
190
191   StyleManager styleManager = StyleManager::Get();
192   StyleManager copyOfStyleManager = styleManager;
193
194   DALI_TEST_CHECK( copyOfStyleManager );
195   DALI_TEST_CHECK( copyOfStyleManager == styleManager );
196   END_TEST;
197 }
198
199 int UtcDaliStyleManagerGet(void)
200 {
201   ToolkitTestApplication application;
202
203   tet_infoline(" UtcDaliStyleManagerGet");
204
205   // Register Type
206   TypeInfo type;
207   type = TypeRegistry::Get().GetTypeInfo( "StyleManager" );
208   DALI_TEST_CHECK( type );
209   BaseHandle handle = type.CreateInstance();
210   DALI_TEST_CHECK( handle );
211
212   StyleManager manager;
213
214   manager = StyleManager::Get();
215   DALI_TEST_CHECK(manager);
216
217   StyleManager newManager = StyleManager::Get();
218   DALI_TEST_CHECK(newManager);
219
220   // Check that focus manager is a singleton
221   DALI_TEST_CHECK(manager == newManager);
222   END_TEST;
223 }
224
225
226 namespace
227 {
228 class StyleChangedSignalChecker : public ConnectionTracker
229 {
230 public:
231   StyleChangedSignalChecker()
232   : signalCount(0)
233   {
234   }
235
236   void OnStyleChanged(StyleManager styleManager, StyleChange::Type type)
237   {
238     signalCount++;
239   }
240
241   void Reset()
242   {
243     signalCount =0;
244   }
245
246 public:
247   int signalCount;
248 };
249
250 } // anonymous namespace
251
252 int UtcDaliStyleManagerApplyTheme(void)
253 {
254   ToolkitTestApplication application;
255
256   tet_infoline( "Testing StyleManager ApplyTheme" );
257
258   const char* json1 =
259     "{\n"
260     "  \"styles\":\n"
261     "  {\n"
262     "    \"testbutton\":\n"
263     "    {\n"
264     "      \"backgroundColor\":[1.0,1.0,0.0,1.0],\n"
265     "      \"foregroundColor\":[0.0,0.0,1.0,1.0]\n"
266     "    }\n"
267     "  }\n"
268     "}\n";
269
270   const char* json2 =
271     "{\n"
272     "  \"styles\":\n"
273     "  {\n"
274     "    \"testbutton\":\n"
275     "    {\n"
276     "      \"backgroundColor\":[1.0,0.0,0.0,1.0],\n"
277     "      \"foregroundColor\":[0.0,1.0,1.0,1.0]\n"
278     "    }\n"
279     "  }\n"
280     "}\n";
281
282   // Add 2 buttons to test how many times the signal is sent
283   Test::TestButton testButton = Test::TestButton::New();
284   Test::TestButton testButton2 = Test::TestButton::New();
285   Stage::GetCurrent().Add( testButton );
286   Stage::GetCurrent().Add( testButton2 );
287   StyleChangedSignalChecker styleChangedSignalHandler;
288   StyleChangedSignalChecker styleChangedSignalHandler2;
289   StyleManager styleManager = StyleManager::Get();
290
291   styleManager.StyleChangedSignal().Connect(&styleChangedSignalHandler, &StyleChangedSignalChecker::OnStyleChanged);
292
293   // Render and notify
294   application.SendNotification();
295   application.Render();
296
297   tet_infoline("Apply the style");
298
299   std::string themeFile("ThemeOne");
300   Test::StyleMonitor::SetThemeFileOutput(themeFile, json1);
301   StyleManager::Get().ApplyTheme(themeFile);
302
303   Property::Value bgColor( testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR) );
304   Property::Value fgColor( testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR) );
305
306   DALI_TEST_EQUALS( bgColor, Property::Value(Color::YELLOW), 0.001, TEST_LOCATION );
307   DALI_TEST_EQUALS( fgColor, Property::Value(Color::BLUE), 0.001, TEST_LOCATION );
308
309   tet_infoline("Testing that the signal handler is called only once");
310   DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
311
312   tet_infoline("Override the background property");
313   testButton.SetProperty( Test::TestButton::Property::BACKGROUND_COLOR, Color::GREEN );
314   bgColor = testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
315   fgColor = testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
316   DALI_TEST_EQUALS( bgColor, Property::Value(Color::GREEN), 0.001, TEST_LOCATION );
317   DALI_TEST_EQUALS( fgColor, Property::Value(Color::BLUE), 0.001, TEST_LOCATION );
318
319   // Render and notify
320   application.SendNotification();
321   application.Render();
322
323   tet_infoline("Apply the style again");
324
325   styleChangedSignalHandler.signalCount = 0;
326   StyleManager::Get().ApplyTheme(themeFile);
327
328   bgColor = testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
329   fgColor = testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
330
331   tet_infoline("Check that the property is changed");
332   DALI_TEST_EQUALS( bgColor, Property::Value(Color::YELLOW), 0.001, TEST_LOCATION );
333   DALI_TEST_EQUALS( fgColor, Property::Value(Color::BLUE), 0.001, TEST_LOCATION );
334   tet_infoline("Testing that the signal handler is called only once");
335   DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
336
337   tet_infoline( "Load a different stylesheet");
338
339   tet_infoline("Apply the new style");
340   std::string themeFile2("ThemeTwo");
341   Test::StyleMonitor::SetThemeFileOutput(themeFile2, json2);
342
343   styleChangedSignalHandler.signalCount = 0;
344   StyleManager::Get().ApplyTheme(themeFile2);
345
346   bgColor = testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
347   fgColor = testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
348
349   tet_infoline("Check that the properties change, but the signal gets sent only once");
350   DALI_TEST_EQUALS( bgColor, Property::Value(Color::RED), 0.001, TEST_LOCATION );
351   DALI_TEST_EQUALS( fgColor, Property::Value(Color::CYAN), 0.001, TEST_LOCATION );
352   DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
353
354   END_TEST;
355 }
356
357
358 int UtcDaliStyleManagerApplyDefaultTheme(void)
359 {
360   tet_infoline( "Testing StyleManager ApplyTheme" );
361
362   const char* defaultTheme =
363     "{\n"
364     "  \"styles\":\n"
365     "  {\n"
366     "    \"testbutton\":\n"
367     "    {\n"
368     "      \"backgroundColor\":[1.0,1.0,0.0,1.0],\n"
369     "      \"foregroundColor\":[0.0,0.0,1.0,1.0]\n"
370     "    }\n"
371     "  }\n"
372     "}\n";
373   // Bg: Yellow, Fg: Blue
374
375   const char* appTheme =
376     "{\n"
377     "  \"styles\":\n"
378     "  {\n"
379     "    \"testbutton\":\n"
380     "    {\n"
381     "      \"backgroundColor\":[1.0,0.0,1.0,1.0],\n"
382     "      \"foregroundColor\":[0.0,1.0,0.0,1.0]\n"
383     "    }\n"
384     "  }\n"
385     "}\n";
386   // Bg::Magenta, Fg:Green
387
388   std::string filepath(TEST_RESOURCE_DIR "");
389
390   Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
391                                           defaultTheme);
392   ToolkitTestApplication application;
393
394   Test::TestButton testButton = Test::TestButton::New();
395   Stage::GetCurrent().Add( testButton );
396   StyleChangedSignalChecker styleChangedSignalHandler;
397   StyleManager styleManager = StyleManager::Get();
398
399   styleManager.StyleChangedSignal().Connect(&styleChangedSignalHandler, &StyleChangedSignalChecker::OnStyleChanged);
400
401   // Render and notify
402   application.SendNotification();
403   application.Render();
404
405   // Get the default:
406   Property::Value defaultBgColor( testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR) );
407   Property::Value defaultFgColor( testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR) );
408
409   tet_infoline("Apply the style");
410
411   std::string themeFile("ThemeOne");
412   Test::StyleMonitor::SetThemeFileOutput(themeFile, appTheme);
413   StyleManager::Get().ApplyTheme(themeFile);
414
415   Property::Value bgColor( testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR) );
416   Property::Value fgColor( testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR) );
417
418   DALI_TEST_EQUALS( bgColor, Property::Value(Color::MAGENTA), 0.001, TEST_LOCATION );
419   DALI_TEST_EQUALS( fgColor, Property::Value(Color::GREEN), 0.001, TEST_LOCATION );
420
421   tet_infoline("Testing that the signal handler is called only once");
422   DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
423   tet_infoline("Revert the style");
424
425   styleChangedSignalHandler.signalCount = 0;
426   StyleManager::Get().ApplyDefaultTheme();
427
428   bgColor = testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
429   fgColor = testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
430
431   tet_infoline("Check that the property is reverted");
432   DALI_TEST_EQUALS( bgColor, defaultBgColor, 0.001, TEST_LOCATION );
433   DALI_TEST_EQUALS( fgColor, defaultFgColor, 0.001, TEST_LOCATION );
434   DALI_TEST_EQUALS( bgColor, Property::Value(Color::YELLOW), 0.001, TEST_LOCATION );
435   DALI_TEST_EQUALS( fgColor, Property::Value(Color::BLUE), 0.001, TEST_LOCATION );
436   tet_infoline("Testing that the signal handler is called only once");
437   DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
438
439   END_TEST;
440 }
441
442
443 int UtcDaliStyleManagerSetStyleConstantP(void)
444 {
445   ToolkitTestApplication application;
446
447   tet_infoline( " UtcDaliStyleManagerSetStyleConstantP" );
448
449   StyleManager manager = StyleManager::Get();
450
451   std::string key( "key" );
452   Property::Value value( 100 );
453
454   manager.SetStyleConstant( key, value );
455
456   Property::Value returnedValue;
457   manager.GetStyleConstant( key, returnedValue );
458
459   DALI_TEST_CHECK( value.Get<int>() == returnedValue.Get<int>() );
460   END_TEST;
461 }
462
463
464 int UtcDaliStyleManagerGetStyleConstantP(void)
465 {
466   ToolkitTestApplication application;
467
468   tet_infoline( " UtcDaliStyleManagerGetStyleConstantP" );
469
470   StyleManager manager = StyleManager::Get();
471
472   std::string key( "key" );
473   Property::Value value( 100 );
474
475   manager.SetStyleConstant( key, value );
476
477   Property::Value returnedValue;
478   manager.GetStyleConstant( key, returnedValue );
479
480   DALI_TEST_CHECK( value.Get<int>() == returnedValue.Get<int>() );
481   END_TEST;
482 }
483
484 int UtcDaliStyleManagerGetStyleConstantN(void)
485 {
486   ToolkitTestApplication application;
487
488   tet_infoline( " UtcDaliStyleManagerGetStyleConstantN" );
489
490   StyleManager manager = StyleManager::Get();
491
492   std::string key2( "key2" );
493   Property::Value returnedValue2;
494   DALI_TEST_CHECK( !manager.GetStyleConstant( key2, returnedValue2 ) );
495
496   END_TEST;
497 }
498
499 int UtcDaliStyleManagerApplyStyle(void)
500 {
501   ToolkitTestApplication application;
502
503   tet_infoline( "UtcDaliStyleManagerApplyStyle - test that a style can be applied to a single button" );
504
505   const char* json1 =
506     "{\n"
507     "  \"styles\":\n"
508     "  {\n"
509     "    \"testbutton\":\n"
510     "    {\n"
511     "      \"backgroundColor\":[1.0,1.0,0.0,1.0],\n"
512     "      \"foregroundColor\":[0.0,0.0,1.0,1.0]\n"
513     "    }\n"
514     "  }\n"
515     "}\n";
516
517   const char* json2 =
518     "{\n"
519     "  \"styles\":\n"
520     "  {\n"
521     "    \"testbutton\":\n"
522     "    {\n"
523     "      \"backgroundColor\":[1.0,0.0,0.0,1.0],\n"
524     "      \"foregroundColor\":[0.0,1.0,1.0,1.0]\n"
525     "    }\n"
526     "  }\n"
527     "}\n";
528
529   // Add 2 buttons
530   Test::TestButton testButton = Test::TestButton::New();
531   Test::TestButton testButton2 = Test::TestButton::New();
532   Stage::GetCurrent().Add( testButton );
533   Stage::GetCurrent().Add( testButton2 );
534   StyleChangedSignalChecker styleChangedSignalHandler;
535   StyleManager styleManager = StyleManager::Get();
536
537   styleManager.StyleChangedSignal().Connect(&styleChangedSignalHandler, &StyleChangedSignalChecker::OnStyleChanged);
538
539   tet_infoline("Apply the style");
540
541   std::string themeFile("ThemeOne");
542   Test::StyleMonitor::SetThemeFileOutput(themeFile, json1);
543   styleManager.ApplyTheme(themeFile);
544
545   // Render and notify
546   application.SendNotification();
547   application.Render();
548
549   Property::Value themedBgColor( testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR) );
550   Property::Value themedFgColor( testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR) );
551
552   // Apply the style to the test button:
553   std::string themeFile2("ThemeTwo");
554   Test::StyleMonitor::SetThemeFileOutput(themeFile2, json2);
555   styleManager.ApplyStyle( testButton, themeFile2, "testbutton" );
556
557   tet_infoline("Check that the properties change for the first button");
558   Property::Value bgColor = testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
559   Property::Value fgColor = testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
560   DALI_TEST_EQUALS( bgColor, Property::Value(Color::RED), 0.001, TEST_LOCATION );
561   DALI_TEST_EQUALS( fgColor, Property::Value(Color::CYAN), 0.001, TEST_LOCATION );
562
563   DALI_TEST_NOT_EQUALS( bgColor, themedBgColor, 0.001, TEST_LOCATION );
564   DALI_TEST_NOT_EQUALS( fgColor, themedFgColor, 0.001, TEST_LOCATION );
565
566   tet_infoline("Check that the properties remain the same for the second button");
567   bgColor = testButton2.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
568   fgColor = testButton2.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
569   DALI_TEST_EQUALS( bgColor, themedBgColor, 0.001, TEST_LOCATION );
570   DALI_TEST_EQUALS( fgColor, themedFgColor, 0.001, TEST_LOCATION );
571
572   END_TEST;
573 }
574
575
576 int UtcDaliStyleManagerStyleChangedSignal(void)
577 {
578   tet_infoline("Test that the StyleChange signal is fired when the font size is altered" );
579   Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
580                                           defaultTheme );
581
582   ToolkitTestApplication application;
583
584   std::string labelStr("Label");
585   Toolkit::TextLabel label = Toolkit::TextLabel::New(labelStr);
586   Stage::GetCurrent().Add( label );
587
588   Toolkit::TextLabel label2 = Toolkit::TextLabel::New(labelStr);
589   Stage::GetCurrent().Add( label2 );
590
591   StyleChangedSignalChecker styleChangedSignalHandler;
592   StyleMonitor styleMonitor = StyleMonitor::Get();
593   StyleManager styleManager = StyleManager::Get();
594
595   styleManager.StyleChangedSignal().Connect(&styleChangedSignalHandler, &StyleChangedSignalChecker::OnStyleChanged);
596
597   Test::StyleMonitor::SetDefaultFontFamily("Times New Roman");
598
599   styleMonitor.StyleChangeSignal().Emit( styleMonitor,  StyleChange::DEFAULT_FONT_CHANGE);
600
601   tet_infoline("Test that the StyleChanged signal is received only once");
602
603   DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
604
605   // Check that the label's font style has been altered
606   Property::Value family = label.GetProperty(TextLabel::Property::FONT_FAMILY);
607   std::string familyStr;
608   family.Get( familyStr );
609
610   DALI_TEST_EQUALS( familyStr, "Times New Roman", TEST_LOCATION);
611
612   END_TEST;
613 }