From 1a129e66317b77c6560e0ba4c0779e9b801a80d6 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Tue, 12 Mar 2024 17:19:14 +0900 Subject: [PATCH] [Tizen] Unregister all processors if we need Let we ensure that all processor are unregistered after call Core::UnregisterProcessors() API. It will remove both Processor, and PostProcessor. Change-Id: Ie70f287d8e0ec33579a5128ce2268a66aa4de277 Signed-off-by: Eunki, Hong --- automated-tests/src/dali/utc-Dali-Processors.cpp | 56 +++++++++++++++++++++++- dali/integration-api/core.cpp | 7 ++- dali/integration-api/core.h | 5 +++ dali/internal/common/core-impl.cpp | 8 ++++ dali/internal/common/core-impl.h | 5 +++ 5 files changed, 79 insertions(+), 2 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-Processors.cpp b/automated-tests/src/dali/utc-Dali-Processors.cpp index 74a6ed1..acc8a9e 100644 --- a/automated-tests/src/dali/utc-Dali-Processors.cpp +++ b/automated-tests/src/dali/utc-Dali-Processors.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -285,3 +285,57 @@ int UtcDaliCoreProcessorGetProcessorName(void) END_TEST; } + +int UtcDaliCoreProcessorUnregisterProcessors(void) +{ + TestApplication application; + + TestProcessor testProcessor1; + TestProcessor testProcessor2; + TestProcessor testProcessor3; + + Integration::Core& core = application.GetCore(); + core.RegisterProcessor(testProcessor1); + + tet_infoline("Test that the processor has not been executed yet:"); + DALI_TEST_CHECK(testProcessor1.processRun == false); + + application.SendNotification(); + + tet_infoline("Test that the processor has been executed:"); + DALI_TEST_CHECK(testProcessor1.processRun); + + // Clear down for next part of test + testProcessor1.processRun = false; + + core.RegisterProcessor(testProcessor2); + core.RegisterProcessor(testProcessor3, true); // Register as post processor + + tet_infoline("Test that the processors have not been executed yet:"); + DALI_TEST_CHECK(testProcessor1.processRun == false); + DALI_TEST_CHECK(testProcessor2.processRun == false); + DALI_TEST_CHECK(testProcessor3.processRun == false); + + application.SendNotification(); + + tet_infoline("Test that the processors have been executed:"); + DALI_TEST_CHECK(testProcessor1.processRun); + DALI_TEST_CHECK(testProcessor2.processRun); + DALI_TEST_CHECK(testProcessor3.processRun); + + // Clear down for next part of test + testProcessor1.processRun = false; + testProcessor2.processRun = false; + testProcessor3.processRun = false; + + core.UnregisterProcessors(); + application.SendNotification(); + tet_infoline("Test that all processors has not been executed again"); + DALI_TEST_CHECK(testProcessor1.processRun == false); + DALI_TEST_CHECK(testProcessor2.processRun == false); + DALI_TEST_CHECK(testProcessor3.processRun == false); + + END_TEST; + + END_TEST; +} diff --git a/dali/integration-api/core.cpp b/dali/integration-api/core.cpp index 9caab22..a1c47dc 100644 --- a/dali/integration-api/core.cpp +++ b/dali/integration-api/core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -145,6 +145,11 @@ void Core::UnregisterProcessor(Processor& processor, bool postProcessor) mImpl->UnregisterProcessor(processor, postProcessor); } +void Core::UnregisterProcessors() +{ + mImpl->UnregisterProcessors(); +} + ObjectRegistry Core::GetObjectRegistry() const { return ObjectRegistry(&mImpl->GetObjectRegistry()); diff --git a/dali/integration-api/core.h b/dali/integration-api/core.h index 4431884..6079a3e 100644 --- a/dali/integration-api/core.h +++ b/dali/integration-api/core.h @@ -411,6 +411,11 @@ public: void UnregisterProcessor(Processor& processor, bool postProcessor = false); /** + * @brief Unregister all processors and post processors what we registered before. + */ + void UnregisterProcessors(); + + /** * @brief Gets the Object registry. * @return The object registry */ diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp index 461d2eb..caa9cc1 100644 --- a/dali/internal/common/core-impl.cpp +++ b/dali/internal/common/core-impl.cpp @@ -421,6 +421,14 @@ void Core::UnregisterProcessor(Integration::Processor& processor, bool postProce } } +void Core::UnregisterProcessors() +{ + mPostProcessors.Clear(); + mPostProcessorUnregistered = true; + mProcessors.Clear(); + mProcessorUnregistered = true; +} + void Core::RunProcessors() { if(mProcessors.Count() != 0) diff --git a/dali/internal/common/core-impl.h b/dali/internal/common/core-impl.h index e7a2a86..4c69743 100644 --- a/dali/internal/common/core-impl.h +++ b/dali/internal/common/core-impl.h @@ -185,6 +185,11 @@ public: void UnregisterProcessor(Dali::Integration::Processor& processor, bool postProcessor = false); /** + * @copydoc Dali::Integration::Core::UnregisterProcessors + */ + void UnregisterProcessors(); + + /** * @copydoc Dali::Internal::ThreadLocalStorage::AddScene() */ void AddScene(Scene* scene); -- 2.7.4