2 * Copyright (c) 2021 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.
18 #include <dali-test-suite-utils.h>
19 #include <dali/integration-api/core.h>
20 #include <dali/integration-api/processor-interface.h>
21 #include <dali/public-api/dali-core.h>
26 class TestProcessor : public Integration::Processor
34 virtual void Process(bool postProcessor)
42 int UtcDaliCoreProcessorP(void)
44 TestApplication application;
46 TestProcessor testProcessor;
47 Integration::Core& core = application.GetCore();
48 core.RegisterProcessor(testProcessor);
50 tet_infoline("Test that the processor has not been executed yet:");
51 DALI_TEST_CHECK(testProcessor.processRun == false);
53 application.SendNotification();
55 tet_infoline("Test that the processor has been executed:");
56 DALI_TEST_CHECK(testProcessor.processRun);
58 // Clear down for next part of test
59 testProcessor.processRun = false;
61 core.UnregisterProcessor(testProcessor);
62 application.SendNotification();
63 tet_infoline("Test that the processor has not been executed again:");
64 DALI_TEST_CHECK(testProcessor.processRun == false);
69 int UtcDaliCoreProcessorMultipleP(void)
71 TestApplication application;
73 TestProcessor testProcessor1;
74 TestProcessor testProcessor2;
75 TestProcessor testProcessor3;
77 Integration::Core& core = application.GetCore();
78 core.RegisterProcessor(testProcessor1);
80 tet_infoline("Test that the processor has not been executed yet:");
81 DALI_TEST_CHECK(testProcessor1.processRun == false);
83 application.SendNotification();
85 tet_infoline("Test that the processor has been executed:");
86 DALI_TEST_CHECK(testProcessor1.processRun);
88 // Clear down for next part of test
89 testProcessor1.processRun = false;
91 core.RegisterProcessor(testProcessor2);
92 core.RegisterProcessor(testProcessor3);
94 tet_infoline("Test that the processors have not been executed yet:");
95 DALI_TEST_CHECK(testProcessor1.processRun == false);
96 DALI_TEST_CHECK(testProcessor2.processRun == false);
97 DALI_TEST_CHECK(testProcessor3.processRun == false);
99 application.SendNotification();
101 tet_infoline("Test that the processors have been executed:");
102 DALI_TEST_CHECK(testProcessor1.processRun);
103 DALI_TEST_CHECK(testProcessor2.processRun);
104 DALI_TEST_CHECK(testProcessor3.processRun);
106 // Clear down for next part of test
107 testProcessor2.processRun = false;
109 core.UnregisterProcessor(testProcessor2);
110 application.SendNotification();
111 tet_infoline("Test that the unregistered processor has not been executed again but others have");
112 DALI_TEST_CHECK(testProcessor1.processRun);
113 DALI_TEST_CHECK(testProcessor2.processRun == false);
114 DALI_TEST_CHECK(testProcessor3.processRun);
119 int UtcDaliCorePostProcessorP(void)
121 TestApplication application;
123 TestProcessor testProcessor;
124 Integration::Core& core = application.GetCore();
125 core.RegisterProcessor(testProcessor, true);
127 tet_infoline("Test that the processor has not been executed yet:");
128 DALI_TEST_CHECK(testProcessor.processRun == false);
130 application.SendNotification();
132 tet_infoline("Test that the processor has been executed:");
133 DALI_TEST_CHECK(testProcessor.processRun);
135 // Clear down for next part of test
136 testProcessor.processRun = false;
138 core.UnregisterProcessor(testProcessor);
139 application.SendNotification();
140 tet_infoline("Test that the processor is still executed:");
141 DALI_TEST_CHECK(testProcessor.processRun);
143 // Clear down for next part of test
144 testProcessor.processRun = false;
146 core.UnregisterProcessor(testProcessor, true);
147 application.SendNotification();
148 tet_infoline("Test that the processor has not been executed again:");
149 DALI_TEST_CHECK(testProcessor.processRun == false);