1 // 2 // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // TextureImpl_mock.h: Defines a mock of the TextureImpl class. 8 9 #ifndef LIBANGLE_RENDERER_TEXTUREIMPLMOCK_H_ 10 #define LIBANGLE_RENDERER_TEXTUREIMPLMOCK_H_ 11 12 #include "gmock/gmock.h" 13 14 #include "libANGLE/renderer/TextureImpl.h" 15 16 namespace rx 17 { 18 19 class MockTextureImpl : public TextureImpl 20 { 21 public: MockTextureImpl()22 MockTextureImpl() : TextureImpl(mMockState), mMockState(gl::TextureType::_2D) {} ~MockTextureImpl()23 virtual ~MockTextureImpl() { destructor(); } 24 MOCK_METHOD9(setImage, 25 angle::Result(const gl::Context *, 26 const gl::ImageIndex &, 27 GLenum, 28 const gl::Extents &, 29 GLenum, 30 GLenum, 31 const gl::PixelUnpackState &, 32 gl::Buffer *, 33 const uint8_t *)); 34 MOCK_METHOD8(setSubImage, 35 angle::Result(const gl::Context *, 36 const gl::ImageIndex &, 37 const gl::Box &, 38 GLenum, 39 GLenum, 40 const gl::PixelUnpackState &, 41 gl::Buffer *, 42 const uint8_t *)); 43 MOCK_METHOD7(setCompressedImage, 44 angle::Result(const gl::Context *, 45 const gl::ImageIndex &, 46 GLenum, 47 const gl::Extents &, 48 const gl::PixelUnpackState &, 49 size_t, 50 const uint8_t *)); 51 MOCK_METHOD7(setCompressedSubImage, 52 angle::Result(const gl::Context *, 53 const gl::ImageIndex &, 54 const gl::Box &, 55 GLenum, 56 const gl::PixelUnpackState &, 57 size_t, 58 const uint8_t *)); 59 MOCK_METHOD5(copyImage, 60 angle::Result(const gl::Context *, 61 const gl::ImageIndex &, 62 const gl::Rectangle &, 63 GLenum, 64 gl::Framebuffer *)); 65 MOCK_METHOD5(copySubImage, 66 angle::Result(const gl::Context *, 67 const gl::ImageIndex &, 68 const gl::Offset &, 69 const gl::Rectangle &, 70 gl::Framebuffer *)); 71 MOCK_METHOD9(copyTexture, 72 angle::Result(const gl::Context *, 73 const gl::ImageIndex &, 74 GLenum, 75 GLenum, 76 GLint, 77 bool, 78 bool, 79 bool, 80 const gl::Texture *)); 81 MOCK_METHOD9(copySubTexture, 82 angle::Result(const gl::Context *, 83 const gl::ImageIndex &, 84 const gl::Offset &, 85 GLint, 86 const gl::Box &, 87 bool, 88 bool, 89 bool, 90 const gl::Texture *)); 91 MOCK_METHOD2(copyCompressedTexture, 92 angle::Result(const gl::Context *, const gl::Texture *source)); 93 MOCK_METHOD5( 94 setStorage, 95 angle::Result(const gl::Context *, gl::TextureType, size_t, GLenum, const gl::Extents &)); 96 MOCK_METHOD9(setStorageExternalMemory, 97 angle::Result(const gl::Context *, 98 gl::TextureType, 99 size_t, 100 GLenum, 101 const gl::Extents &, 102 gl::MemoryObject *, 103 GLuint64, 104 GLbitfield, 105 GLbitfield)); 106 MOCK_METHOD4(setImageExternal, 107 angle::Result(const gl::Context *, 108 gl::TextureType, 109 egl::Stream *, 110 const egl::Stream::GLTextureDescription &)); 111 MOCK_METHOD3(setEGLImageTarget, 112 angle::Result(const gl::Context *, gl::TextureType, egl::Image *)); 113 MOCK_METHOD1(generateMipmap, angle::Result(const gl::Context *)); 114 MOCK_METHOD2(bindTexImage, angle::Result(const gl::Context *, egl::Surface *)); 115 MOCK_METHOD1(releaseTexImage, angle::Result(const gl::Context *)); 116 117 MOCK_METHOD5(getAttachmentRenderTarget, 118 angle::Result(const gl::Context *, 119 GLenum, 120 const gl::ImageIndex &, 121 GLsizei, 122 FramebufferAttachmentRenderTarget **)); 123 124 MOCK_METHOD6(setStorageMultisample, 125 angle::Result(const gl::Context *, 126 gl::TextureType, 127 GLsizei, 128 GLint, 129 const gl::Extents &, 130 bool)); 131 132 MOCK_METHOD2(setBaseLevel, angle::Result(const gl::Context *, GLuint)); 133 134 MOCK_METHOD3(syncState, 135 angle::Result(const gl::Context *, 136 const gl::Texture::DirtyBits &, 137 gl::Command source)); 138 139 MOCK_METHOD0(destructor, void()); 140 141 protected: 142 gl::TextureState mMockState; 143 }; 144 } // namespace rx 145 146 #endif // LIBANGLE_RENDERER_TEXTUREIMPLMOCK_H_ 147