Merge "Fix race-condition when window is resized or rotated." into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-environment-variable.cpp
index f02bfb4..4fc6cf2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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 "toolkit-environment-variable.h"
 
 // EXTERNAL INCLUDE
-#include <cstddef>
+#include <map>
 
 namespace Dali
 {
-
 namespace EnvironmentVariable
 {
-
 namespace
 {
-const char * gReturnValue = NULL;
-}
+std::map<std::string, std::string> gEnvironmentVariables;
+} // namespace
 
-const char * GetEnvironmentVariable( const char * variable )
+const char* GetEnvironmentVariable(const char* variable)
 {
-  return gReturnValue;
+  auto value = gEnvironmentVariables.find(variable);
+  if(value != gEnvironmentVariables.end())
+  {
+    return value->second.c_str();
+  }
+  return nullptr;
 }
 
-void SetTestingEnvironmentVariable( bool testing)
+void SetTestEnvironmentVariable(const char* variable, const char* value)
 {
-  if( testing )
-  {
-    gReturnValue = "1";
-  }
-  else
-  {
-    gReturnValue = NULL;
-  }
+  gEnvironmentVariables[variable] = value;
 }
 
 } // namespace EnvironmentVariable