/*
- * 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.
#include <dali/integration-api/scene.h>
#include <test-application.h>
#include <toolkit-adaptor-impl.h>
+#include <toolkit-application.h>
+#include <toolkit-async-task-manager.h>
#include <toolkit-scene-holder-impl.h>
#include <toolkit-test-application.h>
+#include "dali-test-suite-utils.h"
namespace Dali
{
Adaptor::~Adaptor()
{
gAdaptor = nullptr;
+
+ // Ensure all threads and not-excuted tasks are destroyed.
+ // TODO : we'd better make some singletone service for toolkit UTC in future.
+ Test::AsyncTaskManager::DestroyAsyncTaskManager();
}
void Adaptor::Start(Dali::Window window)
AddWindow(&GetImplementation(window));
}
+void Adaptor::Stop()
+{
+ if(mTestApplication)
+ {
+ Integration::Core& core = mTestApplication->GetCore();
+ tet_printf("Adaptor::UnregisterProcessors\n");
+ core.UnregisterProcessors();
+ }
+
+ mStopped = true;
+}
+
Integration::Scene Adaptor::GetScene(Dali::Window window)
{
return window.GetScene();
bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue)
{
- if(hasReturnValue)
+ if(ToolkitApplication::ADD_IDLE_SUCCESS)
{
- mReturnCallbacks.PushBack(callback);
- }
- else
- {
- mCallbacks.PushBack(callback);
+ if(hasReturnValue)
+ {
+ mReturnCallbacks.PushBack(callback);
+ }
+ else
+ {
+ mCallbacks.PushBack(callback);
+ }
}
- return true;
+ return ToolkitApplication::ADD_IDLE_SUCCESS;
}
void Adaptor::RemoveIdle(CallbackBase* callback)
mReturnCallbacks.Swap(reusedCallbacks);
}
+void Adaptor::RequestUpdateOnce()
+{
+ if(mTestApplication)
+ {
+ auto scene = mTestApplication->GetScene();
+ if(scene)
+ {
+ tet_printf("Adaptor::RequestUpdateOnce()\n");
+ scene.KeepRendering(0.0f);
+ }
+ }
+}
+
Dali::RenderSurfaceInterface& Adaptor::GetSurface()
{
DALI_ASSERT_ALWAYS(!mWindows.empty());
void Adaptor::RegisterProcessor(Integration::Processor& processor, bool postProcessor)
{
Integration::Core& core = mTestApplication->GetCore();
+ tet_printf("Adaptor::RegisterProcessor : %s\n", processor.GetProcessorName().data());
core.RegisterProcessor(processor, postProcessor);
}
void Adaptor::UnregisterProcessor(Integration::Processor& processor, bool postProcessor)
{
Integration::Core& core = mTestApplication->GetCore();
+ tet_printf("Adaptor::UnregisterProcessor : %s\n", processor.GetProcessorName().data());
core.UnregisterProcessor(processor, postProcessor);
}
void Adaptor::Stop()
{
+ mImpl->Stop();
}
bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue)
bool Adaptor::IsAvailable()
{
- return Internal::Adaptor::gAdaptor;
+ return Internal::Adaptor::gAdaptor && (!Internal::Adaptor::Adaptor::GetImpl(*Internal::Adaptor::gAdaptor).IsStopped());
}
void Adaptor::NotifySceneCreated()