(Automated Tests) Sync with core tests
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / dali-test-suite-utils.h
index 7f81872..a3149f4 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_TEST_SUITE_UTILS_H__
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -499,4 +499,45 @@ struct DefaultFunctionCoverage
 BufferImage CreateBufferImage();
 BufferImage CreateBufferImage(int width, int height, const Vector4& color);
 
+// Test namespace to prevent pollution of Dali namespace, add Test helper functions here
+namespace Test
+{
+/**
+ *  @brief
+ *
+ *  Helper to check object destruction occurred
+ *  1) In main part of code create an ObjectDestructionTracker
+ *  2) Within sub section of main create object Actor test and call Start with Actor to test for destruction
+ *  3) Perform code which is expected to destroy Actor
+ *  4) Back in main part of code use IsDestroyed() to test if Actor was destroyed
+ */
+class ObjectDestructionTracker : public ConnectionTracker
+{
+public:
+
+  /**
+   * @brief Call in main part of code
+   */
+  ObjectDestructionTracker();
+
+  /**
+   * @brief Call in sub bock of code where the Actor being checked is still alive.
+   *
+   * @param[in] actor Actor to be checked for destruction
+   */
+  void Start( Actor actor );
+
+  /**
+   * @brief Call to check if Actor alive or destroyed.
+   *
+   * @return bool true if Actor was destroyed
+   */
+  bool IsDestroyed();
+
+private:
+  bool mRefObjectDestroyed;
+};
+
+} // namespace Test
+
 #endif // __DALI_TEST_SUITE_UTILS_H__