Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions
fuchsia_test_utils Namespace Reference

Classes

struct  Pixel
 
class  PortableUITest
 
class  Screenshot
 

Functions

bool CheckViewExistsInSnapshot (const fuchsia::ui::observation::geometry::ViewTreeSnapshot &snapshot, zx_koid_t view_ref_koid)
 
bool CheckViewExistsInUpdates (const std::vector< fuchsia::ui::observation::geometry::ViewTreeSnapshot > &updates, zx_koid_t view_ref_koid)
 
std::ostream & operator<< (std::ostream &stream, const Pixel &pixel)
 

Function Documentation

◆ CheckViewExistsInSnapshot()

bool fuchsia_test_utils::CheckViewExistsInSnapshot ( const fuchsia::ui::observation::geometry::ViewTreeSnapshot &  snapshot,
zx_koid_t  view_ref_koid 
)

Returns true if a view with the given |view_ref_koid| exists in a |snapshot| of the view tree, false otherwise.

Definition at line 11 of file check_view.cc.

13 {
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}

◆ CheckViewExistsInUpdates()

bool fuchsia_test_utils::CheckViewExistsInUpdates ( const std::vector< fuchsia::ui::observation::geometry::ViewTreeSnapshot > &  updates,
zx_koid_t  view_ref_koid 
)

Returns true if any of the snapshots of the view tree in |updates| contain a view with the given |view_ref_koid|, false otherwise.

Definition at line 27 of file check_view.cc.

30 {
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}

◆ operator<<()

std::ostream & fuchsia_test_utils::operator<< ( std::ostream &  stream,
const Pixel pixel 
)

Definition at line 46 of file screenshot.cc.

46 {
47 return stream << "{Pixel:" << " r:" << static_cast<unsigned int>(pixel.red)
48 << " g:" << static_cast<unsigned int>(pixel.green)
49 << " b:" << static_cast<unsigned int>(pixel.blue)
50 << " a:" << static_cast<unsigned int>(pixel.alpha) << "}";
51}