blob: 9bb2a3c961e94234f5b078ad094b5e3e42240a40 [file] [log] [blame]
Lloyd Pique2ee39572017-12-20 16:48:10 -08001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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#pragma once
18
19#include <gmock/gmock.h>
20
21#include "RenderEngine/Image.h"
22#include "RenderEngine/Mesh.h"
23#include "RenderEngine/RenderEngine.h"
24#include "RenderEngine/Surface.h"
25#include "RenderEngine/Texture.h"
26
27namespace android {
28namespace RE {
29namespace mock {
30
31class RenderEngine : public RE::RenderEngine {
32public:
33 RenderEngine();
34 ~RenderEngine() override;
35
36 MOCK_METHOD0(createSurface, std::unique_ptr<RE::Surface>());
37 MOCK_METHOD0(createImage, std::unique_ptr<RE::Image>());
38 MOCK_CONST_METHOD0(primeCache, void());
39 MOCK_METHOD1(dump, void(String8&));
40 MOCK_CONST_METHOD0(supportsImageCrop, bool());
41 MOCK_CONST_METHOD0(isCurrent, bool());
42 MOCK_METHOD1(setCurrentSurface, bool(const RE::Surface&));
43 MOCK_METHOD0(resetCurrentSurface, void());
44 MOCK_METHOD0(flush, base::unique_fd());
45 MOCK_METHOD0(finish, bool());
46 MOCK_METHOD1(waitFence, bool(base::unique_fd*));
47 bool waitFence(base::unique_fd fd) override { return waitFence(&fd); };
48 MOCK_METHOD4(clearWithColor, void(float, float, float, float));
49 MOCK_METHOD6(fillRegionWithColor, void(const Region&, uint32_t, float, float, float, float));
50 MOCK_METHOD4(setScissor, void(uint32_t, uint32_t, uint32_t, uint32_t));
51 MOCK_METHOD0(disableScissor, void());
52 MOCK_METHOD2(genTextures, void(size_t, uint32_t*));
53 MOCK_METHOD2(deleteTextures, void(size_t, uint32_t const*));
54 MOCK_METHOD2(bindExternalTextureImage, void(uint32_t, const RE::Image&));
55 MOCK_METHOD5(readPixels, void(size_t, size_t, size_t, size_t, uint32_t*));
56 MOCK_CONST_METHOD0(checkErrors, void());
57 MOCK_METHOD6(setViewportAndProjection,
58 void(size_t, size_t, Rect, size_t, bool, Transform::orientation_flags));
59 MOCK_METHOD4(setupLayerBlending, void(bool, bool, bool, const half4&));
Lloyd Pique2ee39572017-12-20 16:48:10 -080060 MOCK_METHOD1(setupLayerTexturing, void(const Texture&));
61 MOCK_METHOD0(setupLayerBlackedOut, void());
62 MOCK_METHOD4(setupFillWithColor, void(float, float, float, float));
63 MOCK_METHOD1(setupColorTransform, mat4(const mat4&));
64 MOCK_METHOD0(disableTexturing, void());
65 MOCK_METHOD0(disableBlending, void());
Chia-I Wu69bf10f2018-02-20 13:04:50 -080066 MOCK_METHOD1(setSourceY410BT2020, void(bool));
Peiyong Lin34beb7a2018-03-28 11:57:12 -070067 MOCK_METHOD1(setSourceDataSpace, void(ui::Dataspace));
68 MOCK_METHOD1(setOutputDataSpace, void(ui::Dataspace));
Lloyd Pique2ee39572017-12-20 16:48:10 -080069 MOCK_METHOD2(bindNativeBufferAsFrameBuffer,
70 void(ANativeWindowBuffer*, RE::BindNativeBufferAsFramebuffer*));
71 MOCK_METHOD1(unbindNativeBufferAsFrameBuffer, void(RE::BindNativeBufferAsFramebuffer*));
72 MOCK_METHOD1(drawMesh, void(const Mesh&));
73 MOCK_CONST_METHOD0(getMaxTextureSize, size_t());
74 MOCK_CONST_METHOD0(getMaxViewportDims, size_t());
75};
76
77class Surface : public RE::Surface {
78public:
79 Surface();
80 ~Surface() override;
81
82 MOCK_METHOD1(setCritical, void(bool));
83 MOCK_METHOD1(setAsync, void(bool));
84 MOCK_METHOD1(setNativeWindow, void(ANativeWindow*));
85 MOCK_CONST_METHOD0(swapBuffers, void());
86 MOCK_CONST_METHOD0(queryRedSize, int32_t());
87 MOCK_CONST_METHOD0(queryGreenSize, int32_t());
88 MOCK_CONST_METHOD0(queryBlueSize, int32_t());
89 MOCK_CONST_METHOD0(queryAlphaSize, int32_t());
90 MOCK_CONST_METHOD0(queryWidth, int32_t());
91 MOCK_CONST_METHOD0(queryHeight, int32_t());
92};
93
94class Image : public RE::Image {
95public:
96 Image();
97 ~Image() override;
98
99 MOCK_METHOD4(setNativeWindowBuffer,
100 bool(ANativeWindowBuffer* buffer, bool isProtected, int32_t cropWidth,
101 int32_t cropHeight));
102};
103
104} // namespace mock
105} // namespace RE
106} // namespace android