Merge "Add the logical key to Integration::KeyEvent" into devel/master
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Processors.cpp
1 /*
2  * Copyright (c) 2018 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 <stdlib.h>
19 #include <dali/public-api/dali-core.h>
20 #include <dali/integration-api/core.h>
21 #include <dali-test-suite-utils.h>
22
23 using namespace Dali;
24
25
26 class TestProcessor : public Integration::Processor
27 {
28 public:
29   TestProcessor()
30   : processRun(false)
31   {
32   }
33
34   virtual void Process()
35   {
36     processRun = true;
37   }
38
39   bool processRun;
40 };
41
42
43 int UtcDaliCoreProcessorP(void)
44 {
45   TestApplication application;
46
47   TestProcessor testProcessor;
48   Integration::Core& core = application.GetCore();
49   core.RegisterProcessor( testProcessor );
50
51   tet_infoline("Test that the processor has not been executed yet:");
52   DALI_TEST_CHECK( testProcessor.processRun == false );
53
54   application.SendNotification();
55
56   tet_infoline("Test that the processor has been executed:");
57   DALI_TEST_CHECK( testProcessor.processRun );
58
59   // Clear down for next part of test
60   testProcessor.processRun = false;
61
62   core.UnregisterProcessor( testProcessor );
63   application.SendNotification();
64   tet_infoline("Test that the processor has not been executed again:");
65   DALI_TEST_CHECK( testProcessor.processRun == false );
66
67   END_TEST;
68 }