Flutter Engine
The Flutter Engine
check_view.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "check_view.h"
6
7#include "flutter/fml/logging.h"
8
10
12 const fuchsia::ui::observation::geometry::ViewTreeSnapshot& snapshot,
13 zx_koid_t view_ref_koid) {
14 if (!snapshot.has_views()) {
15 return false;
16 }
17
18 auto snapshot_count =
19 std::count_if(snapshot.views().begin(), snapshot.views().end(),
20 [view_ref_koid](const auto& view) {
21 return view.view_ref_koid() == view_ref_koid;
22 });
23
24 return snapshot_count > 0;
25}
26
28 const std::vector<fuchsia::ui::observation::geometry::ViewTreeSnapshot>&
29 updates,
30 zx_koid_t view_ref_koid) {
31 auto update_count = std::count_if(
32 updates.begin(), updates.end(), [view_ref_koid](auto& snapshot) {
33 return CheckViewExistsInSnapshot(snapshot, view_ref_koid);
34 });
35
36 return update_count > 0;
37}
38
39} // namespace fuchsia_test_utils
bool CheckViewExistsInUpdates(const std::vector< fuchsia::ui::observation::geometry::ViewTreeSnapshot > &updates, zx_koid_t view_ref_koid)
Definition: check_view.cc:27
bool CheckViewExistsInSnapshot(const fuchsia::ui::observation::geometry::ViewTreeSnapshot &snapshot, zx_koid_t view_ref_koid)
Definition: check_view.cc:11