blob: 02a9df1d47be4a56345dc879baa36bdefd9d1daf [file] [log] [blame]
/* * Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <sstream>
#include <gtest/gtest.h>
#include "Hwc2TestLayers.h"
Hwc2TestLayers::Hwc2TestLayers(const std::vector<hwc2_layer_t>& layers,
Hwc2TestCoverage coverage, const Area& displayArea)
{
uint32_t nextZOrder = 0;
for (auto layer : layers) {
mTestLayers.emplace(std::piecewise_construct,
std::forward_as_tuple(layer),
std::forward_as_tuple(coverage, displayArea, nextZOrder++));
}
}
std::string Hwc2TestLayers::dump() const
{
std::stringstream dmp;
for (auto& testLayer : mTestLayers) {
dmp << testLayer.second.dump();
}
return dmp.str();
}
void Hwc2TestLayers::reset()
{
for (auto& testLayer : mTestLayers) {
testLayer.second.reset();
}
}
uint32_t Hwc2TestLayers::getZOrder(hwc2_layer_t layer) const
{
if (mTestLayers.count(layer) == 0) {
[]() { GTEST_FAIL(); }();
}
return mTestLayers.at(layer).getZOrder();
}