X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-native-image.h;h=a664107909780008af0864423336e20331eea3c5;hp=2ba56a7ce5be53676302f23c238ebdef91ed21e5;hb=908670e8d7b3447b5201a7f9118cca881cf0a41e;hpb=fa6279fb2830427d5ab569ca14e6ade1557ef2fa diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-native-image.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-native-image.h index 2ba56a7..a664107 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-native-image.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-native-image.h @@ -1,49 +1,101 @@ #ifndef __TEST_NATIVE_IMAGE_H__ #define __TEST_NATIVE_IMAGE_H__ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2018 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // INTERNAL INCLUDES -#include +#include +#include +#include namespace Dali { class TestNativeImage; +class TestNativeImageNoExt; typedef IntrusivePtr TestNativeImagePointer; +typedef IntrusivePtr TestNativeImageNoExtPointer; -class DALI_IMPORT_API TestNativeImage : public Dali::NativeImage +class DALI_CORE_API TestNativeImageExtension: public Dali::NativeImageInterface::Extension { public: - static TestNativeImagePointer New(int width, int height); + inline const char* GetCustomFragmentPreFix(){return "#extension GL_OES_EGL_image_external:require\n";} + inline const char* GetCustomSamplerTypename(){return "samplerExternalOES";} - inline virtual bool GlExtensionCreate() {return true;}; - inline virtual void GlExtensionDestroy() {}; - inline virtual GLenum TargetTexture() {return 1;}; + inline int32_t GetEglImageTextureTarget(){return GL_TEXTURE_EXTERNAL_OES;} + +}; + +class DALI_CORE_API TestNativeImage : public Dali::NativeImageInterface +{ +public: + static TestNativeImagePointer New(uint32_t width, uint32_t height); + + inline void SetGlExtensionCreateResult(bool result){ createResult = result;} + inline virtual bool GlExtensionCreate() { ++mExtensionCreateCalls; return createResult;}; + inline virtual void GlExtensionDestroy() { ++mExtensionDestroyCalls; }; + inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return 0;}; inline virtual void PrepareTexture() {}; - inline virtual unsigned int GetWidth() const {return mWidth;}; - inline virtual unsigned int GetHeight() const {return mHeight;}; - inline virtual Pixel::Format GetPixelFormat() const {return Pixel::RGBA8888;}; + inline virtual uint32_t GetWidth() const {return mWidth;}; + inline virtual uint32_t GetHeight() const {return mHeight;}; + inline virtual bool RequiresBlending() const {return true;}; + inline virtual Dali::NativeImageInterface::Extension* GetExtension() {return mExtension;} private: - TestNativeImage(int width, int height); + TestNativeImage(uint32_t width, uint32_t height); virtual ~TestNativeImage(); - int mWidth; - int mHeight; + uint32_t mWidth; + uint32_t mHeight; +public: + int32_t mExtensionCreateCalls; + int32_t mExtensionDestroyCalls; + int32_t mTargetTextureCalls; + + bool createResult; + TestNativeImageExtension* mExtension; +}; + + +class DALI_CORE_API TestNativeImageNoExt : public Dali::NativeImageInterface +{ +public: + static TestNativeImageNoExtPointer New(uint32_t width, uint32_t height); + + inline void SetGlExtensionCreateResult(bool result){ createResult = result;} + inline virtual bool GlExtensionCreate() { ++mExtensionCreateCalls; return createResult;}; + inline virtual void GlExtensionDestroy() { ++mExtensionDestroyCalls; }; + inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return 1;}; + inline virtual void PrepareTexture() {}; + inline virtual uint32_t GetWidth() const {return mWidth;}; + inline virtual uint32_t GetHeight() const {return mHeight;}; + inline virtual bool RequiresBlending() const {return true;}; + +private: + TestNativeImageNoExt(uint32_t width, uint32_t height); + virtual ~TestNativeImageNoExt(); + + uint32_t mWidth; + uint32_t mHeight; +public: + int32_t mExtensionCreateCalls; + int32_t mExtensionDestroyCalls; + int32_t mTargetTextureCalls; + bool createResult; }; } // Dali