forked from firka/flutter
[Linux] add GTest printer for FlValue (flutter/engine#32652)
Improves test failure messages when matching FlValue arguments. For example, before: Expected arg #2: has setting ("platformBrightness", 0x32f0980) Actual: 0x7f81ec005990, 0x32f0900 And after: Expected arg #2: has setting ("platformBrightness", dark) Actual: 0x27bded0, {textScaleFactor: 0.0, alwaysUse24HourFormat: false, platformBrightness: light}
This commit is contained in:
@@ -62,3 +62,8 @@ FlEngine* make_mock_engine_with_project(FlDartProject* project) {
|
||||
|
||||
return static_cast<FlEngine*>(g_object_ref(engine));
|
||||
}
|
||||
|
||||
void PrintTo(FlValue* v, std::ostream* os) {
|
||||
g_autofree gchar* s = fl_value_to_string(v);
|
||||
*os << s;
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
#define FLUTTER_SHELL_PLATFORM_LINUX_FL_TEST_H_
|
||||
|
||||
#include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.h"
|
||||
#include "flutter/shell/platform/linux/public/flutter_linux/fl_value.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdint.h>
|
||||
#include <ostream>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -27,6 +29,9 @@ FlEngine* make_mock_engine();
|
||||
// platform messages.
|
||||
FlEngine* make_mock_engine_with_project(FlDartProject* project);
|
||||
|
||||
// GTest printer for FlValue.
|
||||
void PrintTo(FlValue* v, std::ostream* os);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TEST_H_
|
||||
|
||||
Reference in New Issue
Block a user