2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <dali-toolkit-test-suite-utils.h>
21 #include <dali-toolkit/public-api/builder/builder.h>
22 #include <dali/integration-api/events/touch-event-integ.h>
25 using namespace Toolkit;
30 std::string ReplaceQuotes(const std::string &in_s)
33 // wrong as no embedded quote but had regex link problems
34 std::replace(s.begin(), s.end(), '\'', '"');
40 BuilderFunctor( bool& called ) : mCalled( called )
57 void builder_startup(void)
59 test_return_value = TET_UNDEF;
62 void builder_cleanup(void)
64 test_return_value = TET_PASS;
67 int UtcDaliBuilderQuitSignal(void)
69 ToolkitTestApplication application;
71 // JSON with a quit event when the actor is touched
76 "\"type\": \"Actor\","
77 "\"size\": [100,100,1],"
78 "\"parent-origin\": \"TOP_LEFT\","
79 "\"anchor-point\": \"TOP_LEFT\","
81 "\"name\": \"touched\","
82 "\"action\": \"quit\""
87 Builder builder = Builder::New();
88 builder.LoadFromString( json );
89 builder.AddActors ( Stage::GetCurrent().GetRootLayer() );
91 // Connect to builder's quit signal
92 bool functorCalled( false );
93 builder.QuitSignal().Connect( &application, BuilderFunctor( functorCalled ) );
96 application.SendNotification();
99 // Emit touch event and check that our quit method is called
100 Integration::TouchEvent touchEvent;
101 touchEvent.points.push_back( TouchPoint ( 0, TouchPoint::Down, 10.0f, 10.0f ) );
102 application.ProcessEvent( touchEvent );
103 DALI_TEST_CHECK( functorCalled );