[AT-SPI] Squashed implementation
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / mesh-builder.cpp
index 4cc72bd..0693c43 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
  * limitations under the License.
  *
  */
+
+// CLASS HEADER
 #include "mesh-builder.h"
 
 namespace Dali
 {
-
 Shader CreateShader()
 {
-  return Shader::New( "vertexSrc", "fragmentSrc" );
+  return Shader::New("vertexSrc", "fragmentSrc");
 }
 
 TextureSet CreateTextureSet()
@@ -29,21 +30,46 @@ TextureSet CreateTextureSet()
   return TextureSet::New();
 }
 
-TextureSet CreateTextureSet( Image image )
+TextureSet CreateTextureSet(Texture texture)
 {
   TextureSet textureSet = TextureSet::New();
-  textureSet.SetImage( 0u, image );
+  textureSet.SetTexture(0u, texture);
   return textureSet;
 }
 
-PropertyBuffer CreatePropertyBuffer()
+VertexBuffer CreateVertexBuffer()
 {
   Property::Map texturedQuadVertexFormat;
-  texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
+  texturedQuadVertexFormat["aPosition"]    = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer vertexData = PropertyBuffer::New( texturedQuadVertexFormat );
+  VertexBuffer vertexData = VertexBuffer::New(texturedQuadVertexFormat);
   return vertexData;
 }
 
+Geometry CreateQuadGeometry(void)
+{
+  VertexBuffer vertexData   = CreateVertexBuffer();
+  const float  halfQuadSize = .5f;
+  struct TexturedQuadVertex
+  {
+    Vector2 position;
+    Vector2 textureCoordinates;
+  };
+  TexturedQuadVertex texturedQuadVertexData[4] = {
+    {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)},
+    {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)},
+    {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)},
+    {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}};
+  vertexData.SetData(texturedQuadVertexData, 4);
+
+  unsigned short indexData[6] = {0, 3, 1, 0, 2, 3};
+
+  Geometry geometry = Geometry::New();
+  geometry.AddVertexBuffer(vertexData);
+  geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0]));
+
+  return geometry;
+}
+
 } // namespace Dali