flutter_flutter/flow/layers/platform_view_layer_unittests.cc
Chris Bracken 08dabe9601
Clean up C++ includes (#21127)
Cleans up header order/grouping for consistency: associated header, C/C++ system/standard library headers, library headers, platform-specific #includes.

Adds <cstring> where strlen, memcpy are being used: there are a bunch of places we use them transitively.

Applies linter-required cleanups. Disables linter on one file due to included RapidJson header. See https://github.com/flutter/flutter/issues/65676

This patch does not cover flutter/shell/platform/darwin. There's a separate, slightly more intensive cleanup for those in progress.
2020-09-11 21:18:35 -07:00

43 lines
1.4 KiB
C++

// 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/platform_view_layer.h"
#include "flutter/flow/testing/layer_test.h"
#include "flutter/flow/testing/mock_layer.h"
#include "flutter/fml/macros.h"
#include "flutter/testing/mock_canvas.h"
namespace flutter {
namespace testing {
using PlatformViewLayerTest = LayerTest;
TEST_F(PlatformViewLayerTest, NullViewEmbedderDoesntPrerollCompositeOrPaint) {
const SkPoint layer_offset = SkPoint::Make(0.0f, 0.0f);
const SkSize layer_size = SkSize::Make(8.0f, 8.0f);
const int64_t view_id = 0;
auto layer =
std::make_shared<PlatformViewLayer>(layer_offset, layer_size, view_id);
layer->Preroll(preroll_context(), SkMatrix());
EXPECT_FALSE(preroll_context()->has_platform_view);
EXPECT_EQ(layer->paint_bounds(),
SkRect::MakeSize(layer_size)
.makeOffset(layer_offset.fX, layer_offset.fY));
EXPECT_TRUE(layer->needs_painting());
#if defined(LEGACY_FUCHSIA_EMBEDDER)
EXPECT_TRUE(layer->needs_system_composite());
#else
EXPECT_FALSE(layer->needs_system_composite());
#endif // LEGACY_FUCHSIA_EMBEDDER
layer->Paint(paint_context());
EXPECT_EQ(paint_context().leaf_nodes_canvas, &mock_canvas());
EXPECT_EQ(mock_canvas().draw_calls(), std::vector<MockCanvas::DrawCall>());
}
} // namespace testing
} // namespace flutter