From: David Steele Date: Fri, 26 Feb 2021 17:27:49 +0000 (+0000) Subject: Test harness updates X-Git-Tag: graphics-backend-pre-release-2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3807953d55f788a41339af3da14822c2c01c32e4;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Test harness updates Change-Id: I512d0933dacdfbd4f21085e7495d3bc0dd906c68 --- diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp index e678074..3a4e127 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp @@ -72,4 +72,46 @@ Geometry CreateQuadGeometry(void) return geometry; } +Property::Map CreateModelVertexFormat() +{ + Property::Map modelVF; + modelVF["aPosition"] = Property::VECTOR3; + modelVF["aNormal"] = Property::VECTOR3; + modelVF["aTexCoord1"] = Property::VECTOR3; + modelVF["aTexCoord2"] = Property::VECTOR3; + modelVF["aBoneIndex[0]"] = Property::INTEGER; + modelVF["aBoneIndex[1]"] = Property::INTEGER; + modelVF["aBoneIndex[2]"] = Property::INTEGER; + modelVF["aBoneIndex[3]"] = Property::INTEGER; + modelVF["aBoneWeights[0]"] = Property::FLOAT; + modelVF["aBoneWeights[1]"] = Property::FLOAT; + modelVF["aBoneWeights[2]"] = Property::FLOAT; + modelVF["aBoneWeights[3]"] = Property::FLOAT; + return modelVF; +} + +Geometry CreateModelGeometry(Property::Map& vf) +{ + VertexBuffer vertexData = VertexBuffer::New(vf); + + struct Vertex + { + Vector3 position; + Vector3 diffuseTexCoords; + Vector3 metalRoughTexCoords; + int boneIndices[4]; + float boneWeights[4]; + }; + + Vertex verts[30]; + vertexData.SetData(verts, 30); + unsigned short indexData[40]; + + Geometry geometry = Geometry::New(); + geometry.AddVertexBuffer(vertexData); + geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0])); + + return geometry; +} + } // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.h index d5c61b0..adcf78e 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.h @@ -2,7 +2,7 @@ #define MESH_BUILDER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -23,11 +23,13 @@ namespace Dali { -Shader CreateShader(); -TextureSet CreateTextureSet(); -TextureSet CreateTextureSet(Texture texture); -Geometry CreateQuadGeometry(); -VertexBuffer CreateVertexBuffer(); +Shader CreateShader(); +TextureSet CreateTextureSet(); +TextureSet CreateTextureSet(Texture texture); +Geometry CreateQuadGeometry(); +Geometry CreateModelGeometry(Property::Map& vf); +VertexBuffer CreateVertexBuffer(); +Property::Map CreateModelVertexFormat(); } // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp index 220e5e5..adacc11 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp @@ -21,7 +21,6 @@ #include "test-graphics-reflection.h" #include "test-graphics-sampler.h" #include "test-graphics-shader.h" -#include "test-graphics-program.h" #include "test-graphics-texture.h" #include @@ -793,7 +792,8 @@ bool TestGraphicsController::PipelineEquals(const Graphics::Pipeline& pipeline0, bool TestGraphicsController::GetProgramParameter(Graphics::Program& program, uint32_t parameterId, void* outData ) { mCallStack.PushCall("GetProgramParameter", ""); - return false; + auto graphicsProgram = Uncast(&program); + return graphicsProgram->GetParameter(parameterId, outData); } } // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.cpp index db5a9f7..1b23380 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.cpp @@ -23,6 +23,15 @@ TestGraphicsProgram::TestGraphicsProgram(TestGlAbstraction& gl, const Graphics:: mCreateInfo(createInfo), mReflection(gl, vertexFormats) { + mId = 0;//mGl.CreateProgram(); } +bool TestGraphicsProgram::GetParameter(uint32_t parameterId, void* outData ) +{ + reinterpret_cast(outData)[0] = mId; + return true; +} + + + } // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.h index 2bd04de..d5f5b85 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.h @@ -42,8 +42,11 @@ public: return mReflection; } + bool GetParameter(uint32_t parameterId, void* outData ); + public: TestGlAbstraction& mGl; + uint32_t mId; Graphics::ProgramCreateInfo mCreateInfo; TestGraphicsReflection mReflection; };