2 * Copyright (c) 2019 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.
19 #include <dali/public-api/dali-core.h>
20 #include <dali/integration-api/core.h>
21 #include <dali-test-suite-utils.h>
22 #include <dali/integration-api/processor-interface.h>
27 class TestProcessor : public Integration::Processor
36 virtual void Process()
45 int UtcDaliCoreProcessorP(void)
47 TestApplication application;
49 TestProcessor testProcessor;
50 Integration::Core& core = application.GetCore();
51 core.RegisterProcessor( testProcessor );
53 tet_infoline("Test that the processor has not been executed yet:");
54 DALI_TEST_CHECK( testProcessor.processRun == false );
56 application.SendNotification();
58 tet_infoline("Test that the processor has been executed:");
59 DALI_TEST_CHECK( testProcessor.processRun );
61 // Clear down for next part of test
62 testProcessor.processRun = false;
64 core.UnregisterProcessor( testProcessor );
65 application.SendNotification();
66 tet_infoline("Test that the processor has not been executed again:");
67 DALI_TEST_CHECK( testProcessor.processRun == false );
72 int UtcDaliCoreProcessorMultipleP(void)
74 TestApplication application;
76 TestProcessor testProcessor1;
77 TestProcessor testProcessor2;
78 TestProcessor testProcessor3;
80 Integration::Core& core = application.GetCore();
81 core.RegisterProcessor( testProcessor1 );
83 tet_infoline("Test that the processor has not been executed yet:");
84 DALI_TEST_CHECK( testProcessor1.processRun == false );
86 application.SendNotification();
88 tet_infoline("Test that the processor has been executed:");
89 DALI_TEST_CHECK( testProcessor1.processRun );
91 // Clear down for next part of test
92 testProcessor1.processRun = false;
94 core.RegisterProcessor( testProcessor2 );
95 core.RegisterProcessor( testProcessor3 );
97 tet_infoline("Test that the processors have not been executed yet:");
98 DALI_TEST_CHECK( testProcessor1.processRun == false );
99 DALI_TEST_CHECK( testProcessor2.processRun == false );
100 DALI_TEST_CHECK( testProcessor3.processRun == false );
102 application.SendNotification();
104 tet_infoline("Test that the processors have been executed:");
105 DALI_TEST_CHECK( testProcessor1.processRun );
106 DALI_TEST_CHECK( testProcessor2.processRun );
107 DALI_TEST_CHECK( testProcessor3.processRun );
109 // Clear down for next part of test
110 testProcessor2.processRun = false;
112 core.UnregisterProcessor( testProcessor2 );
113 application.SendNotification();
114 tet_infoline("Test that the unregistered processor has not been executed again but others have");
115 DALI_TEST_CHECK( testProcessor1.processRun );
116 DALI_TEST_CHECK( testProcessor2.processRun == false );
117 DALI_TEST_CHECK( testProcessor3.processRun );