eaeef05bb4e6dff8ee83725af2efeb26102d0402
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-gl-abstraction.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #include "test-gl-abstraction.h"
18
19 namespace Dali
20 {
21
22 TestGlAbstraction::TestGlAbstraction()
23 {
24   Initialize();
25 }
26
27 TestGlAbstraction::~TestGlAbstraction() {}
28
29 void TestGlAbstraction::Initialize()
30 {
31   mCurrentProgram = 0;
32   mCompileStatus = GL_TRUE;
33   mLinkStatus = GL_TRUE;
34
35   mGetAttribLocationResult = 0;
36   mGetErrorResult = 0;
37   mGetStringResult = NULL;
38   mIsBufferResult = 0;
39   mIsEnabledResult = 0;
40   mIsFramebufferResult = 0;
41   mIsProgramResult = 0;
42   mIsRenderbufferResult = 0;
43   mIsShaderResult = 0;
44   mIsTextureResult = 0;
45   mVertexAttribArrayChanged = false;
46
47   mCheckFramebufferStatusResult = 0;
48   mNumBinaryFormats = 1;
49   mBinaryFormats = 1;
50   mProgramBinaryLength = 0;
51
52   mLastAutoTextureIdUsed = 0;
53
54   mLastShaderIdUsed = 0;
55   mLastProgramIdUsed = 0;
56   mLastUniformIdUsed = 0;
57   mLastShaderCompiled = 0;
58
59   mLastBlendEquationRgb   = 0;
60   mLastBlendEquationAlpha = 0;
61   mLastBlendFuncSrcRgb    = 0;
62   mLastBlendFuncDstRgb    = 0;
63   mLastBlendFuncSrcAlpha  = 0;
64   mLastBlendFuncDstAlpha  = 0;
65
66   mUniforms.clear();
67   mProgramUniforms1i.clear();
68   mProgramUniforms1f.clear();
69   mProgramUniforms2f.clear();
70   mProgramUniforms3f.clear();
71   mProgramUniforms4f.clear();
72 }
73
74 } // Namespace dali
75
76 bool BlendEnabled(const Dali::TraceCallStack& callStack)
77 {
78   std::stringstream out;
79   out << GL_BLEND;
80   bool blendEnabled = callStack.FindMethodAndParams("Enable", out.str());
81   return blendEnabled;
82 }
83
84 bool BlendDisabled(const Dali::TraceCallStack& callStack)
85 {
86   std::stringstream out;
87   out << GL_BLEND;
88   bool blendEnabled = callStack.FindMethodAndParams("Disable", out.str());
89   return blendEnabled;
90 }