Moved Gesture::State and -::Type to gesture-enumerations.h.
[platform/core/uifw/dali-core.git] / automated-tests / src / dali-internal / utc-Dali-Internal-PinchGestureProcessor.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
20 #include <stdlib.h>
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
23 #include <dali/internal/event/events/pinch-gesture/pinch-gesture-processor.h>
24 #include <dali/internal/event/events/pinch-gesture/pinch-gesture-event.h>
25 #include <dali/internal/event/common/scene-impl.h>
26
27 using namespace Dali;
28
29 void utc_dali_internal_pinch_gesture_processor_startup(void)
30 {
31   test_return_value = TET_UNDEF;
32 }
33
34 void utc_dali_internal_pinch_gesture_processor_cleanup(void)
35 {
36   test_return_value = TET_PASS;
37 }
38
39 namespace
40 {
41
42 void TestAbortWithState(GestureState state)
43 {
44   TestApplication application;
45
46   Internal::PinchGestureProcessor processor;
47   Integration::Scene scene( application.GetScene() );
48   Internal::Scene& sceneImpl = GetImplementation( scene );
49   Internal::PinchGestureEvent event(state);
50
51   try
52   {
53     processor.Process(sceneImpl, event);
54     DALI_TEST_CHECK( false ); // Should not get here as we expect an abort
55   }
56   catch(...)
57   {
58     DALI_TEST_CHECK( true ); // We aborted, so the test has passed
59   }
60 }
61
62 } // anon namespace
63
64 int UtcDaliPinchGestureProcessorProcessClearStateN(void)
65 {
66   TestAbortWithState(GestureState::CLEAR);
67   END_TEST;
68 }
69
70 int UtcDaliPinchGestureProcessorProcessPossibleStateN(void)
71 {
72   TestAbortWithState(GestureState::POSSIBLE);
73   END_TEST;
74 }
75