Merge "Fix cursor position issue" into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-BubbleEmitter.cpp
index fd04bbd..41e8236 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 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.
@@ -76,6 +76,21 @@ static int Wait(ToolkitTestApplication& application, int duration = 0)
 static Texture CreateSolidColorTexture(ToolkitTestApplication& application, const Vector4& color, unsigned int width, unsigned int height)
 {
   Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+
+  int      bufferSize = width * height * GetBytesPerPixel(Pixel::RGBA8888);
+  uint8_t* buffer     = reinterpret_cast<uint8_t*>(malloc(bufferSize));
+
+  for(uint32_t i = 0; i < width * height; ++i)
+  {
+    buffer[i * 4 + 0] = static_cast<uint8_t>(color.r * 255.0f);
+    buffer[i * 4 + 1] = static_cast<uint8_t>(color.g * 255.0f);
+    buffer[i * 4 + 2] = static_cast<uint8_t>(color.b * 255.0f);
+    buffer[i * 4 + 3] = static_cast<uint8_t>(color.a * 255.0f);
+  }
+
+  PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
+  texture.Upload(pixelData, 0u, 0u, 0u, 0u, width, height);
+
   return texture;
 }
 } //namespace
@@ -318,14 +333,13 @@ int UtcDaliBubbleEmitterEmitBubble(void)
 
 int UtcDaliBubbleEmitterRestore(void)
 {
-#ifdef OLD_GRAPHICS_TEST
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliBubbleEmitterRestore ");
 
   static std::vector<UniformData> customUniforms =
     {
-      UniformData("uPercentage[0]", Property::Type::FLOAT),
-      UniformData("uStartEndPosition[0]", Property::Type::VECTOR4),
+      UniformData("uPercentage[90]", Property::Type::FLOAT),
+      UniformData("uStartEndPosition[90]", Property::Type::VECTOR4),
     };
 
   TestGraphicsController& graphics = application.GetGraphicsController();
@@ -380,9 +394,6 @@ int UtcDaliBubbleEmitterRestore(void)
 
   DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uStartEndPosition[0]", startEndPosValue));
   DALI_TEST_EQUALS(startEndPosValue, Vector4::ZERO, TEST_LOCATION);
-#else
-  tet_result(TET_PASS);
-#endif
 
   END_TEST;
 }