(AutomatedTests) Let we make adaptor invalidate if adaptor stop 82/307682/3
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 12 Mar 2024 07:44:58 +0000 (16:44 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 14 Mar 2024 06:03:36 +0000 (15:03 +0900)
Change-Id: I1436b6dcb86810821abdf90eff9c9a9d63e8ee0a
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor-impl.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp

index a705241c4b8abd91dd20c0f1ee8d3407ddbaacdf..49c344aca2cf376d5f8e4d4891df31364514180f 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_ADAPTOR_IMPL_H
 
 /*
- * Copyright (c) 2021 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.
@@ -37,10 +37,8 @@ using WindowContainer = std::vector<Window>;
 
 namespace Internal
 {
-
 namespace Adaptor
 {
-
 class GraphicsInterface;
 class SceneHolder;
 
@@ -50,7 +48,6 @@ class SceneHolder;
 
 namespace Integration
 {
-
 class GlAbstraction;
 
 } // namespace Integration
@@ -59,7 +56,6 @@ namespace Internal
 {
 namespace Adaptor
 {
-
 class Adaptor
 {
 public:
@@ -68,45 +64,57 @@ public:
   Adaptor();
   ~Adaptor();
 
-  void Start( Dali::Window window );
+  void Start(Dali::Window window);
+  void Stop();
 
-  bool AddIdle( CallbackBase* callback, bool hasReturnValue );
-  void RemoveIdle( CallbackBase* callback );
+  bool AddIdle(CallbackBase* callback, bool hasReturnValue);
+  void RemoveIdle(CallbackBase* callback);
   void RunIdles();
 
-  static Integration::Scene GetScene( Dali::Window window );
+  static Integration::Scene GetScene(Dali::Window window);
 
   Dali::RenderSurfaceInterface& GetSurface();
-  Dali::WindowContainer GetWindows();
-  Dali::SceneHolderList GetSceneHolders();
+  Dali::WindowContainer         GetWindows();
+  Dali::SceneHolderList         GetSceneHolders();
+
+  Dali::Internal::Adaptor::SceneHolder* GetWindow(Dali::Actor& actor);
+  void                                  AddWindow(Internal::Adaptor::SceneHolder* window);
+  void                                  RemoveWindow(Internal::Adaptor::SceneHolder* window);
 
-  Dali::Internal::Adaptor::SceneHolder* GetWindow( Dali::Actor& actor );
-  void AddWindow( Internal::Adaptor::SceneHolder* window );
-  void RemoveWindow( Internal::Adaptor::SceneHolder* window );
+  void RegisterProcessor(Integration::Processor& processor, bool postProcessor = false);
+  void UnregisterProcessor(Integration::Processor& processor, bool postProcessor = false);
 
-  void RegisterProcessor( Integration::Processor& processor, bool postProcessor = false);
-  void UnregisterProcessor( Integration::Processor& processor, bool postProcessor = false);
+  void SetApplication(Dali::TestApplication& testApplication);
 
-  void SetApplication( Dali::TestApplication& testApplication );
+  bool IsStopped() const
+  {
+    return mStopped;
+  }
 
-  Dali::Adaptor::AdaptorSignalType& ResizedSignal();
-  Dali::Adaptor::AdaptorSignalType& LanguageChangedSignal();
+  Dali::Adaptor::AdaptorSignalType&       ResizedSignal();
+  Dali::Adaptor::AdaptorSignalType&       LanguageChangedSignal();
   Dali::Adaptor::WindowCreatedSignalType& WindowCreatedSignal();
   Dali::Adaptor::LocaleChangedSignalType& LocaleChangedSignal();
 
-  static Adaptor& GetImpl( Dali::Adaptor& adaptor ) { return *adaptor.mImpl; }
-  static const Adaptor& GetImpl( const Dali::Adaptor& adaptor ) { return *adaptor.mImpl; }
+  static Adaptor& GetImpl(Dali::Adaptor& adaptor)
+  {
+    return *adaptor.mImpl;
+  }
+  static const Adaptor& GetImpl(const Dali::Adaptor& adaptor)
+  {
+    return *adaptor.mImpl;
+  }
 
 private:
-
-  Vector<CallbackBase*> mCallbacks;
-  Vector<CallbackBase*> mReturnCallbacks;
+  Vector<CallbackBase*>                        mCallbacks;
+  Vector<CallbackBase*>                        mReturnCallbacks;
   std::vector<Internal::Adaptor::SceneHolder*> mWindows;
-  Dali::Adaptor::AdaptorSignalType mResizedSignal;
-  Dali::Adaptor::AdaptorSignalType mLanguageChangedSignal;
-  Dali::Adaptor::WindowCreatedSignalType mWindowCreatedSignal;
-  Dali::Adaptor::LocaleChangedSignalType mLocaleChangedSignal;
-  TestApplication* mTestApplication;
+  Dali::Adaptor::AdaptorSignalType             mResizedSignal;
+  Dali::Adaptor::AdaptorSignalType             mLanguageChangedSignal;
+  Dali::Adaptor::WindowCreatedSignalType       mWindowCreatedSignal;
+  Dali::Adaptor::LocaleChangedSignalType       mLocaleChangedSignal;
+  TestApplication*                             mTestApplication;
+  bool                                         mStopped{false};
 };
 
 } // namespace Adaptor
index 566ca085c069bf4f7198520ea43fb2a1766bd53d..4d77310c2a66d81a99becb23e6f13a79b3ff0f21 100644 (file)
@@ -79,6 +79,18 @@ 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();
@@ -266,6 +278,7 @@ void Adaptor::Resume()
 
 void Adaptor::Stop()
 {
+  mImpl->Stop();
 }
 
 bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue)
@@ -342,7 +355,7 @@ Adaptor& Adaptor::Get()
 
 bool Adaptor::IsAvailable()
 {
-  return Internal::Adaptor::gAdaptor;
+  return Internal::Adaptor::gAdaptor && (!Internal::Adaptor::Adaptor::GetImpl(*Internal::Adaptor::gAdaptor).IsStopped());
 }
 
 void Adaptor::NotifySceneCreated()