Flutter Engine
The Flutter Engine
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/display_list/display_list.h"
11#include "flutter/display_list/image/dl_image.h"
12#include "flutter/impeller/aiks/aiks_context.h"
13#include "flutter/impeller/playground/playground.h"
14#include "flutter/impeller/renderer/render_target.h"
15#include "flutter/testing/testing.h"
17#include "third_party/imgui/imgui.h"
18
19#if FML_OS_MACOSX
20#include "flutter/fml/platform/darwin/scoped_nsautorelease_pool.h"
21#endif
22
23namespace impeller {
24
26 : public ::testing::TestWithParam<PlaygroundBackend> {
27 public:
29 std::function<std::optional<Picture>(AiksContext& renderer)>;
30
31 using AiksDlPlaygroundCallback = std::function<sk_sp<flutter::DisplayList>()>;
32
34
36
37 void SetUp();
38
39 void TearDown();
40
42
44 std::shared_ptr<TypographerContext> typographer_context);
45
47
49
51
53
54 static bool ImGuiBegin(const char* name,
55 bool* p_open,
56 ImGuiWindowFlags flags);
57
58 std::shared_ptr<Texture> CreateTextureForFixture(
59 const char* fixture_name,
60 bool enable_mipmapping = false) const;
61
63 const char* fixture_name,
64 bool enable_mipmapping = false) const;
65
66 RuntimeStage::Map OpenAssetAsRuntimeStage(const char* asset_name) const;
67
68 std::shared_ptr<Context> GetContext() const;
69
70 std::shared_ptr<Context> MakeContext() const;
71
72 Point GetContentScale() const;
73
75
76 ISize GetWindowSize() const;
77
78 [[nodiscard]] fml::Status SetCapabilities(
79 const std::shared_ptr<Capabilities>& capabilities);
80
81 /// TODO(https://github.com/flutter/flutter/issues/139950): Remove this.
82 /// Returns true if `OpenPlaygroundHere` will actually render anything.
83 bool WillRenderSomething() const { return true; }
84
85 protected:
87
88 private:
89#if FML_OS_MACOSX
90 // This must be placed first so that the autorelease pool is not destroyed
91 // until the GoldenPlaygroundTestImpl has been destructed.
92 fml::ScopedNSAutoreleasePool autorelease_pool_;
93#endif
94
95 std::shared_ptr<TypographerContext> typographer_context_;
96
97 struct GoldenPlaygroundTestImpl;
98 // This is only a shared_ptr so it can work with a forward declared type.
99 std::shared_ptr<GoldenPlaygroundTestImpl> pimpl_;
100
102
103 GoldenPlaygroundTest& operator=(const GoldenPlaygroundTest&) = delete;
104};
105
106} // namespace impeller
107
108#endif // FLUTTER_IMPELLER_GOLDEN_TESTS_GOLDEN_PLAYGROUND_TEST_H_
std::function< std::optional< Picture >(AiksContext &renderer)> AiksPlaygroundCallback
sk_sp< flutter::DlImage > CreateDlImageForFixture(const char *fixture_name, bool enable_mipmapping=false) const
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::function< sk_sp< flutter::DisplayList >()> AiksDlPlaygroundCallback
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
Definition: runtime_stage.h:24
FlutterSemanticsFlag flags
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
sk_sp< const SkPicture > picture
Definition: SkRecords.h:299
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
float Scalar
Definition: scalar.h:18
PlaygroundBackend
Definition: playground.h:27