blob: 44df2893d728bf034e2864f74be6f6e3b9beeab4 [file] [log] [blame]
Lloyd Piquefeb73d72018-12-04 17:23:44 -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
Ady Abrahamb0dbdaa2020-01-06 16:19:42 -080017// TODO(b/129481165): remove the #pragma below and fix conversion issues
18#pragma clang diagnostic push
19#pragma clang diagnostic ignored "-Wconversion"
20
Lloyd Piquefeb73d72018-12-04 17:23:44 -080021#include <gtest/gtest.h>
22
23#include <compositionengine/LayerCreationArgs.h>
Lloyd Piquea38ea7e2019-04-16 18:10:26 -070024#include <compositionengine/LayerFECompositionState.h>
Lloyd Piquefeb73d72018-12-04 17:23:44 -080025#include <compositionengine/impl/Layer.h>
26#include <compositionengine/mock/CompositionEngine.h>
27#include <compositionengine/mock/LayerFE.h>
28
29namespace android::compositionengine {
30namespace {
31
32using testing::StrictMock;
33
Lloyd Piquea38ea7e2019-04-16 18:10:26 -070034struct LayerTest : public testing::Test {
35 struct Layer final : public impl::Layer {
36 explicit Layer(const LayerCreationArgs& args) : mLayerFE(args.layerFE) {}
37 ~Layer() override = default;
38
39 // compositionengine::Layer overrides
40 sp<LayerFE> getLayerFE() const { return mLayerFE.promote(); }
41 const LayerFECompositionState& getFEState() const override { return mFrontEndState; }
42 LayerFECompositionState& editFEState() override { return mFrontEndState; }
43
44 // compositionengine::impl::Layer overrides
45 void dumpFEState(std::string& out) const override { mFrontEndState.dump(out); }
46
47 const wp<LayerFE> mLayerFE;
48 LayerFECompositionState mFrontEndState;
49 };
50
Lloyd Piquefeb73d72018-12-04 17:23:44 -080051 ~LayerTest() override = default;
52
53 StrictMock<mock::CompositionEngine> mCompositionEngine;
54 sp<LayerFE> mLayerFE = new StrictMock<mock::LayerFE>();
Lloyd Piquea38ea7e2019-04-16 18:10:26 -070055 Layer mLayer{LayerCreationArgs{mLayerFE}};
Lloyd Piquefeb73d72018-12-04 17:23:44 -080056};
57
58/* ------------------------------------------------------------------------
59 * Basic construction
60 */
61
62TEST_F(LayerTest, canInstantiateLayer) {}
63
64} // namespace
65} // namespace android::compositionengine
Ady Abrahamb0dbdaa2020-01-06 16:19:42 -080066
67// TODO(b/129481165): remove the #pragma below and fix conversion issues
68#pragma clang diagnostic pop // ignored "-Wconversion"