Revert "Add a unit test for PhysicalShapeLayer (#8616)" (flutter/engine#8627)
This reverts commit 6f4740c284.
This commit is contained in:
@@ -89,7 +89,6 @@ FILE: ../../../flutter/flow/layers/performance_overlay_layer.h
|
||||
FILE: ../../../flutter/flow/layers/performance_overlay_layer_unittests.cc
|
||||
FILE: ../../../flutter/flow/layers/physical_shape_layer.cc
|
||||
FILE: ../../../flutter/flow/layers/physical_shape_layer.h
|
||||
FILE: ../../../flutter/flow/layers/physical_shape_layer_unittests.cc
|
||||
FILE: ../../../flutter/flow/layers/picture_layer.cc
|
||||
FILE: ../../../flutter/flow/layers/picture_layer.h
|
||||
FILE: ../../../flutter/flow/layers/platform_view_layer.cc
|
||||
|
||||
@@ -98,7 +98,6 @@ executable("flow_unittests") {
|
||||
"flow_test_utils.cc",
|
||||
"flow_test_utils.h",
|
||||
"layers/performance_overlay_layer_unittests.cc",
|
||||
"layers/physical_shape_layer_unittests.cc",
|
||||
"matrix_decomposition_unittests.cc",
|
||||
"raster_cache_unittests.cc",
|
||||
]
|
||||
|
||||
@@ -27,7 +27,8 @@ void ContainerLayer::PrerollChildren(PrerollContext* context,
|
||||
const SkMatrix& child_matrix,
|
||||
SkRect* child_paint_bounds) {
|
||||
for (auto& layer : layers_) {
|
||||
layer->Preroll(context, child_matrix);
|
||||
PrerollContext child_context = *context;
|
||||
layer->Preroll(&child_context, child_matrix);
|
||||
|
||||
if (layer->needs_system_composite()) {
|
||||
set_needs_system_composite(true);
|
||||
|
||||
@@ -47,7 +47,6 @@ void PhysicalShapeLayer::Preroll(PrerollContext* context,
|
||||
total_elevation_ = context->total_elevation;
|
||||
SkRect child_paint_bounds;
|
||||
PrerollChildren(context, matrix, &child_paint_bounds);
|
||||
context->total_elevation -= elevation_;
|
||||
|
||||
if (elevation_ == 0) {
|
||||
set_paint_bounds(path_.getBounds());
|
||||
|
||||
@@ -52,8 +52,6 @@ class PhysicalShapeLayer : public ContainerLayer {
|
||||
bool isRect_;
|
||||
SkRRect frameRRect_;
|
||||
Clip clip_behavior_;
|
||||
|
||||
friend class PhysicalShapeLayer_TotalElevation_Test;
|
||||
};
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/flow/layers/physical_shape_layer.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace flow {
|
||||
|
||||
TEST(PhysicalShapeLayer, TotalElevation) {
|
||||
std::shared_ptr<PhysicalShapeLayer> layers[4];
|
||||
|
||||
for (int i = 0; i < 4; i += 1) {
|
||||
layers[i] = std::make_shared<PhysicalShapeLayer>(Clip::none);
|
||||
layers[i]->set_elevation((float)(i + 1));
|
||||
}
|
||||
|
||||
layers[0]->Add(layers[1]);
|
||||
layers[0]->Add(layers[2]);
|
||||
layers[2]->Add(layers[3]);
|
||||
|
||||
const Stopwatch unused_stopwatch;
|
||||
TextureRegistry unused_texture_registry;
|
||||
PrerollContext preroll_context{
|
||||
nullptr, // raster_cache (don't consult the cache)
|
||||
nullptr, // gr_context (used for the raster cache)
|
||||
nullptr, // external view embedder
|
||||
nullptr, // SkColorSpace* dst_color_space
|
||||
kGiantRect, // SkRect cull_rect
|
||||
unused_stopwatch, // frame time (dont care)
|
||||
unused_stopwatch, // engine time (dont care)
|
||||
unused_texture_registry, // texture registry (not supported)
|
||||
false, // checkerboard_offscreen_layers
|
||||
0.0f, // total elevation
|
||||
};
|
||||
|
||||
SkMatrix identity;
|
||||
identity.setIdentity();
|
||||
|
||||
layers[0]->Preroll(&preroll_context, identity);
|
||||
|
||||
// It should look like this:
|
||||
// layers[0] +1.0f
|
||||
// | \
|
||||
// | \
|
||||
// | \
|
||||
// | layers[2] +3.0f
|
||||
// | |
|
||||
// | layers[3] +4.0f
|
||||
// |
|
||||
// |
|
||||
// layers[1] + 2.0f
|
||||
EXPECT_EQ(layers[0]->total_elevation_, 1.0f);
|
||||
EXPECT_EQ(layers[1]->total_elevation_, 3.0f);
|
||||
EXPECT_EQ(layers[2]->total_elevation_, 4.0f);
|
||||
EXPECT_EQ(layers[3]->total_elevation_, 8.0f);
|
||||
}
|
||||
|
||||
} // namespace flow
|
||||
Reference in New Issue
Block a user