blob: 9e08f9eddc8c9863a8d6919563b091d7328ca7c4 [file] [log] [blame]
Lloyd Pique35d58242018-12-18 16:33:25 -08001/*
2 * Copyright 2019 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#include <ui/Fence.h>
21#include <ui/FloatRect.h>
22#include <ui/GraphicBuffer.h>
Lloyd Pique35d58242018-12-18 16:33:25 -080023#include <ui/Rect.h>
24#include <ui/Region.h>
25#include <ui/Transform.h>
26
Lloyd Pique3b5a69e2020-01-16 17:51:01 -080027// TODO(b/129481165): remove the #pragma below and fix conversion issues
28#pragma clang diagnostic push
29#pragma clang diagnostic ignored "-Wconversion"
Marin Shalamanovbed7fd32020-12-21 20:02:20 +010030#pragma clang diagnostic ignored "-Wextra"
Lloyd Pique3b5a69e2020-01-16 17:51:01 -080031
32#include <ui/GraphicTypes.h>
Lloyd Pique35d58242018-12-18 16:33:25 -080033#include "DisplayHardware/HWC2.h"
34
Lloyd Pique3b5a69e2020-01-16 17:51:01 -080035// TODO(b/129481165): remove the #pragma below and fix conversion issues
Marin Shalamanovbed7fd32020-12-21 20:02:20 +010036#pragma clang diagnostic pop // ignored "-Wconversion -Wextra"
Lloyd Pique3b5a69e2020-01-16 17:51:01 -080037
Peiyong Line9d809e2020-04-14 13:10:48 -070038namespace android {
Lloyd Pique35d58242018-12-18 16:33:25 -080039namespace HWC2 {
40namespace mock {
41
Peiyong Line9d809e2020-04-14 13:10:48 -070042namespace hal = android::hardware::graphics::composer::hal;
43
44using Error = hal::Error;
45
Lloyd Pique35d58242018-12-18 16:33:25 -080046class Layer : public HWC2::Layer {
47public:
48 Layer();
49 ~Layer() override;
50
Peiyong Line9d809e2020-04-14 13:10:48 -070051 MOCK_CONST_METHOD0(getId, hal::HWLayerId());
Lloyd Pique35d58242018-12-18 16:33:25 -080052
53 MOCK_METHOD2(setCursorPosition, Error(int32_t, int32_t));
54 MOCK_METHOD3(setBuffer,
55 Error(uint32_t, const android::sp<android::GraphicBuffer>&,
56 const android::sp<android::Fence>&));
57 MOCK_METHOD1(setSurfaceDamage, Error(const android::Region&));
Peiyong Line9d809e2020-04-14 13:10:48 -070058 MOCK_METHOD1(setBlendMode, Error(hal::BlendMode));
59 MOCK_METHOD1(setColor, Error(hal::Color));
60 MOCK_METHOD1(setCompositionType, Error(hal::Composition));
Lloyd Pique35d58242018-12-18 16:33:25 -080061 MOCK_METHOD1(setDataspace, Error(android::ui::Dataspace));
62 MOCK_METHOD2(setPerFrameMetadata, Error(const int32_t, const android::HdrMetadata&));
63 MOCK_METHOD1(setDisplayFrame, Error(const android::Rect&));
64 MOCK_METHOD1(setPlaneAlpha, Error(float));
65 MOCK_METHOD1(setSidebandStream, Error(const native_handle_t*));
66 MOCK_METHOD1(setSourceCrop, Error(const android::FloatRect&));
Peiyong Line9d809e2020-04-14 13:10:48 -070067 MOCK_METHOD1(setTransform, Error(hal::Transform));
Lloyd Pique35d58242018-12-18 16:33:25 -080068 MOCK_METHOD1(setVisibleRegion, Error(const android::Region&));
69 MOCK_METHOD1(setZOrder, Error(uint32_t));
Lloyd Pique35d58242018-12-18 16:33:25 -080070
71 MOCK_METHOD1(setColorTransform, Error(const android::mat4&));
Lloyd Pique4603f3c2020-02-11 12:06:56 -080072 MOCK_METHOD3(setLayerGenericMetadata,
73 Error(const std::string&, bool, const std::vector<uint8_t>&));
Alec Mouricdf6cbc2021-11-01 17:21:15 -070074 MOCK_METHOD1(setWhitePointNits, Error(float));
Lloyd Pique35d58242018-12-18 16:33:25 -080075};
76
77} // namespace mock
78} // namespace HWC2
Peiyong Line9d809e2020-04-14 13:10:48 -070079} // namespace android