[dali_2.3.22] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-actor-utils.h
index c5c5d0a..03a65c1 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TEST_ACTOR_UTILS_H__
-#define __DALI_TEST_ACTOR_UTILS_H__
+#ifndef DALI_TEST_ACTOR_UTILS_H
+#define DALI_TEST_ACTOR_UTILS_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  */
 
 // EXTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/rendering/texture-set.h>
+#include <dali/public-api/rendering/texture.h>
+#include <set> // For std::multiset
 #include <string>
 
 namespace Dali
 {
-
 class Actor;
 class Image;
+class Texture;
 
 /**
  * @brief Creates a simple renderable-actor with solid colored quad.
@@ -38,7 +42,7 @@ Actor CreateRenderableActor();
  * @param[in] texture Texture to set.
  * @return An actor with a renderer.
  */
-Actor CreateRenderableActor( Image texture );
+Actor CreateRenderableActor(Texture texture);
 
 /**
  * @brief Creates a renderable-actor with a texture and custom shaders.
@@ -47,15 +51,44 @@ Actor CreateRenderableActor( Image texture );
  * @param[in] fragmentShader The fragment-shader.
  * @return An actor with a renderer.
  */
-Actor CreateRenderableActor( Image texture, const std::string& vertexShader, const std::string& fragmentShader );
+Actor CreateRenderableActor(Texture texture, const std::string& vertexShader, const std::string& fragmentShader);
 
 /**
- * @brief Retrieves the texture used in a renderable actor (if available).
- * @return The texture used by the actor.
- * @note Assumes the actor only has one renderer, and that renderer only has one texture.
+ * @brief Creates a renderable-actor with a texture and custom shaders.
+ * @param[in] textures TextureSet to set.
+ * @param[in] vertexShader The vertex-shader.
+ * @param[in] fragmentShader The fragment-shader.
+ * @return An actor with a renderer.
  */
-Image GetTexture( Actor actor );
+Actor CreateRenderableActor2(TextureSet textures, const std::string& vertexShader, const std::string& fragmentShader);
+
+Texture    CreateTexture(TextureType::Type type, Pixel::Format format, int width, int height);
+TextureSet CreateTextureSet(Pixel::Format format, int width, int height);
+
+// Check dirtyRect is equal with expected multiset.
+// Note that the order of damagedRect is not important
+struct RectSorter
+{
+  bool operator()(const Rect<int>& lhs, const Rect<int>& rhs) const
+  {
+    if(lhs.x != rhs.x)
+    {
+      return lhs.x < rhs.x;
+    }
+    if(lhs.y != rhs.y)
+    {
+      return lhs.y < rhs.y;
+    }
+    if(lhs.width != rhs.width)
+    {
+      return lhs.width < rhs.width;
+    }
+    return lhs.height < rhs.height;
+  }
+};
+
+void DirtyRectChecker(const std::vector<Rect<int>>& damagedRects, std::multiset<Rect<int>, RectSorter> expectedRectList, bool checkRectsExact, const char* testLocation);
 
 } // namespace Dali
 
-#endif // __DALI_TEST_ACTOR_UTILS_H__
+#endif // DALI_TEST_ACTOR_UTILS_H