Lloyd Pique | feb73d7 | 2018-12-04 17:23:44 -0800 | [diff] [blame] | 1 | /* |
| 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 Abraham | b0dbdaa | 2020-01-06 16:19:42 -0800 | [diff] [blame^] | 17 | // TODO(b/129481165): remove the #pragma below and fix conversion issues |
| 18 | #pragma clang diagnostic push |
| 19 | #pragma clang diagnostic ignored "-Wconversion" |
| 20 | |
Lloyd Pique | feb73d7 | 2018-12-04 17:23:44 -0800 | [diff] [blame] | 21 | #include <gtest/gtest.h> |
| 22 | |
| 23 | #include <compositionengine/LayerCreationArgs.h> |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 24 | #include <compositionengine/LayerFECompositionState.h> |
Lloyd Pique | feb73d7 | 2018-12-04 17:23:44 -0800 | [diff] [blame] | 25 | #include <compositionengine/impl/Layer.h> |
| 26 | #include <compositionengine/mock/CompositionEngine.h> |
| 27 | #include <compositionengine/mock/LayerFE.h> |
| 28 | |
| 29 | namespace android::compositionengine { |
| 30 | namespace { |
| 31 | |
| 32 | using testing::StrictMock; |
| 33 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 34 | struct 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 Pique | feb73d7 | 2018-12-04 17:23:44 -0800 | [diff] [blame] | 51 | ~LayerTest() override = default; |
| 52 | |
| 53 | StrictMock<mock::CompositionEngine> mCompositionEngine; |
| 54 | sp<LayerFE> mLayerFE = new StrictMock<mock::LayerFE>(); |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 55 | Layer mLayer{LayerCreationArgs{mLayerFE}}; |
Lloyd Pique | feb73d7 | 2018-12-04 17:23:44 -0800 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | /* ------------------------------------------------------------------------ |
| 59 | * Basic construction |
| 60 | */ |
| 61 | |
| 62 | TEST_F(LayerTest, canInstantiateLayer) {} |
| 63 | |
| 64 | } // namespace |
| 65 | } // namespace android::compositionengine |
Ady Abraham | b0dbdaa | 2020-01-06 16:19:42 -0800 | [diff] [blame^] | 66 | |
| 67 | // TODO(b/129481165): remove the #pragma below and fix conversion issues |
| 68 | #pragma clang diagnostic pop // ignored "-Wconversion" |