blob: b2318b1d708fa0c620c01ec178ed552376559677 [file] [log] [blame]
Marissa Wall273b1df2016-12-15 12:28:47 -08001/* * Copyright (C) 2016 The Android Open Source Project
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#include <sstream>
17#include <gtest/gtest.h>
18
19#include "Hwc2TestLayers.h"
20
21Hwc2TestLayers::Hwc2TestLayers(const std::vector<hwc2_layer_t>& layers,
22 Hwc2TestCoverage coverage)
23{
24 uint32_t nextZOrder = 0;
25
26 for (auto layer : layers) {
27 mTestLayers.emplace(std::piecewise_construct,
28 std::forward_as_tuple(layer),
29 std::forward_as_tuple(coverage, nextZOrder++));
30 }
31}
32
33std::string Hwc2TestLayers::dump() const
34{
35 std::stringstream dmp;
36 for (auto& testLayer : mTestLayers) {
37 dmp << testLayer.second.dump();
38 }
39 return dmp.str();
40}
41
42void Hwc2TestLayers::reset()
43{
44 for (auto& testLayer : mTestLayers) {
45 testLayer.second.reset();
46 }
47}
48
49uint32_t Hwc2TestLayers::getZOrder(hwc2_layer_t layer) const
50{
51 if (mTestLayers.count(layer) == 0) {
52 []() { GTEST_FAIL(); }();
53 }
54 return mTestLayers.at(layer).getZOrder();
55}