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_METHOD10(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 const void *)); 107 MOCK_METHOD4(setImageExternal, 108 angle::Result(const gl::Context *, 109 gl::TextureType, 110 egl::Stream *, 111 const egl::Stream::GLTextureDescription &)); 112 MOCK_METHOD3(setEGLImageTarget, 113 angle::Result(const gl::Context *, gl::TextureType, egl::Image *)); 114 MOCK_METHOD1(generateMipmap, angle::Result(const gl::Context *)); 115 MOCK_METHOD2(bindTexImage, angle::Result(const gl::Context *, egl::Surface *)); 116 MOCK_METHOD1(releaseTexImage, angle::Result(const gl::Context *)); 117 118 MOCK_METHOD5(getAttachmentRenderTarget, 119 angle::Result(const gl::Context *, 120 GLenum, 121 const gl::ImageIndex &, 122 GLsizei, 123 FramebufferAttachmentRenderTarget **)); 124 125 MOCK_METHOD6(setStorageMultisample, 126 angle::Result(const gl::Context *, 127 gl::TextureType, 128 GLsizei, 129 GLint, 130 const gl::Extents &, 131 bool)); 132 133 MOCK_METHOD2(setBaseLevel, angle::Result(const gl::Context *, GLuint)); 134 135 MOCK_METHOD3(syncState, 136 angle::Result(const gl::Context *, 137 const gl::Texture::DirtyBits &, 138 gl::Command source)); 139 140 MOCK_METHOD0(destructor, void()); 141 142 protected: 143 gl::TextureState mMockState; 144 }; 145 } // namespace rx 146 147 #endif // LIBANGLE_RENDERER_TEXTUREIMPLMOCK_H_ 148