Flutter Engine
 
Loading...
Searching...
No Matches
flutter::testing::PainterTestBase< T > Class Template Reference
Inheritance diagram for flutter::testing::PainterTestBase< T >:
flutter::testing::CanvasTestBase< T >

Public Member Functions

 PainterTestBase ()=default
 
void PretendImpellerIsEnabled (bool impeller)
 
- Public Member Functions inherited from flutter::testing::CanvasTestBase< T >
 CanvasTestBase ()=default
 
sk_sp< SkColorSpace > mock_color_space ()
 

Protected Member Functions

txt::TextStyle makeDecoratedStyle (txt::TextDecorationStyle style)
 
txt::TextStyle makeEmoji ()
 
txt::TextStyle makeStyle ()
 
sk_sp< DisplayListdrawText (const txt::TextStyle &style, const std::u16string &text) const
 
sk_sp< DisplayListdraw (const txt::TextStyle &style) const
 

Detailed Description

template<typename T>
class flutter::testing::PainterTestBase< T >

Definition at line 91 of file paragraph_unittests.cc.

Constructor & Destructor Documentation

◆ PainterTestBase()

template<typename T >
flutter::testing::PainterTestBase< T >::PainterTestBase ( )
default

Member Function Documentation

◆ draw()

template<typename T >
sk_sp< DisplayList > flutter::testing::PainterTestBase< T >::draw ( const txt::TextStyle style) const
inlineprotected

Definition at line 143 of file paragraph_unittests.cc.

143 {
144 auto pb_skia = makeParagraphBuilder();
145 pb_skia.PushStyle(style);
146 pb_skia.AddText(u"Hello World!");
147 pb_skia.Pop();
148
149 auto builder = DisplayListBuilder();
150 auto paragraph = pb_skia.Build();
151 paragraph->Layout(10000);
152 paragraph->Paint(&builder, 0, 0);
153
154 return builder.Build();
155 }

◆ drawText()

template<typename T >
sk_sp< DisplayList > flutter::testing::PainterTestBase< T >::drawText ( const txt::TextStyle style,
const std::u16string &  text 
) const
inlineprotected

Definition at line 128 of file paragraph_unittests.cc.

129 {
130 auto pb_skia = makeParagraphBuilder();
131 pb_skia.PushStyle(style);
132 pb_skia.AddText(text);
133 pb_skia.Pop();
134
135 auto builder = DisplayListBuilder();
136 auto paragraph = pb_skia.Build();
137 paragraph->Layout(10000);
138 paragraph->Paint(&builder, 0, 0);
139
140 return builder.Build();
141 }
std::u16string text

References text.

◆ makeDecoratedStyle()

template<typename T >
txt::TextStyle flutter::testing::PainterTestBase< T >::makeDecoratedStyle ( txt::TextDecorationStyle  style)
inlineprotected

Definition at line 98 of file paragraph_unittests.cc.

98 {
99 auto t_style = txt::TextStyle();
100 t_style.color = SK_ColorBLACK; // default
101 t_style.font_weight = txt::FontWeight::normal;
102 t_style.font_size = 14; // default
103 t_style.decoration = txt::TextDecoration::kUnderline;
104 t_style.decoration_style = style;
105 t_style.decoration_color = SK_ColorBLACK;
106 t_style.font_families.push_back("ahem");
107 return t_style;
108 }
@ normal
Definition font_weight.h:12

References txt::kUnderline, and txt::normal.

◆ makeEmoji()

template<typename T >
txt::TextStyle flutter::testing::PainterTestBase< T >::makeEmoji ( )
inlineprotected

Definition at line 110 of file paragraph_unittests.cc.

110 {
111 auto t_style = txt::TextStyle();
112 t_style.color = SK_ColorBLACK; // default
113 t_style.font_weight = txt::FontWeight::normal;
114 t_style.font_size = 14; // default
115 t_style.font_families.push_back(kEmojiFontName);
116 return t_style;
117 }
static const std::string kEmojiFontName

References flutter::testing::kEmojiFontName, and txt::normal.

◆ makeStyle()

template<typename T >
txt::TextStyle flutter::testing::PainterTestBase< T >::makeStyle ( )
inlineprotected

Definition at line 119 of file paragraph_unittests.cc.

119 {
120 auto t_style = txt::TextStyle();
121 t_style.color = SK_ColorBLACK; // default
122 t_style.font_weight = txt::FontWeight::normal;
123 t_style.font_size = 14; // default
124 t_style.font_families.push_back("ahem");
125 return t_style;
126 }

References txt::normal.

◆ PretendImpellerIsEnabled()

template<typename T >
void flutter::testing::PainterTestBase< T >::PretendImpellerIsEnabled ( bool  impeller)
inline

Definition at line 95 of file paragraph_unittests.cc.

95{ impeller_ = impeller; }

The documentation for this class was generated from the following file: