Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
golden_playground_test.h
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#ifndef FLUTTER_IMPELLER_GOLDEN_TESTS_GOLDEN_PLAYGROUND_TEST_H_
6#define FLUTTER_IMPELLER_GOLDEN_TESTS_GOLDEN_PLAYGROUND_TEST_H_
7
8#include <memory>
9
10#include "flutter/impeller/aiks/aiks_context.h"
11#include "flutter/impeller/playground/playground.h"
12#include "flutter/impeller/renderer/render_target.h"
13#include "flutter/testing/testing.h"
15#include "third_party/imgui/imgui.h"
16
17#if FML_OS_MACOSX
18#include "flutter/fml/platform/darwin/scoped_nsautorelease_pool.h"
19#endif
20
21namespace impeller {
22
24 : public ::testing::TestWithParam<PlaygroundBackend> {
25 public:
27 std::function<std::optional<Picture>(AiksContext& renderer)>;
28
30
32
33 void SetUp();
34
35 void TearDown();
36
38
40 std::shared_ptr<TypographerContext> typographer_context);
41
42 bool OpenPlaygroundHere(Picture picture);
43
45
46 static bool ImGuiBegin(const char* name,
47 bool* p_open,
48 ImGuiWindowFlags flags);
49
50 std::shared_ptr<Texture> CreateTextureForFixture(
51 const char* fixture_name,
52 bool enable_mipmapping = false) const;
53
54 RuntimeStage::Map OpenAssetAsRuntimeStage(const char* asset_name) const;
55
56 std::shared_ptr<Context> GetContext() const;
57
58 std::shared_ptr<Context> MakeContext() const;
59
60 Point GetContentScale() const;
61
63
64 ISize GetWindowSize() const;
65
66 [[nodiscard]] fml::Status SetCapabilities(
67 const std::shared_ptr<Capabilities>& capabilities);
68
69 /// TODO(https://github.com/flutter/flutter/issues/139950): Remove this.
70 /// Returns true if `OpenPlaygroundHere` will actually render anything.
71 bool WillRenderSomething() const { return true; }
72
73 protected:
74 void SetWindowSize(ISize size);
75
76 private:
77#if FML_OS_MACOSX
78 // This must be placed first so that the autorelease pool is not destroyed
79 // until the GoldenPlaygroundTestImpl has been destructed.
80 fml::ScopedNSAutoreleasePool autorelease_pool_;
81#endif
82
83 std::shared_ptr<TypographerContext> typographer_context_;
84
85 struct GoldenPlaygroundTestImpl;
86 // This is only a shared_ptr so it can work with a forward declared type.
87 std::shared_ptr<GoldenPlaygroundTestImpl> pimpl_;
88
90
91 GoldenPlaygroundTest& operator=(const GoldenPlaygroundTest&) = delete;
92};
93
94} // namespace impeller
95
96#endif // FLUTTER_IMPELLER_GOLDEN_TESTS_GOLDEN_PLAYGROUND_TEST_H_
std::function< std::optional< Picture >(AiksContext &renderer)> AiksPlaygroundCallback
fml::Status SetCapabilities(const std::shared_ptr< Capabilities > &capabilities)
void SetTypographerContext(std::shared_ptr< TypographerContext > typographer_context)
std::shared_ptr< Context > MakeContext() const
RuntimeStage::Map OpenAssetAsRuntimeStage(const char *asset_name) const
static bool ImGuiBegin(const char *name, bool *p_open, ImGuiWindowFlags flags)
std::shared_ptr< Context > GetContext() const
std::shared_ptr< Texture > CreateTextureForFixture(const char *fixture_name, bool enable_mipmapping=false) const
std::map< RuntimeStageBackend, std::shared_ptr< RuntimeStage > > Map
FlutterSemanticsFlag flags
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
const char * name
Definition fuchsia.cc:50
float Scalar
Definition scalar.h:18
PlaygroundBackend
Definition playground.h:29