Can't test FlView on a server - no display

This commit is contained in:
Robert Ancell
2021-10-29 10:59:07 +13:00
committed by Robert Ancell
parent 24372ebfa9
commit 702af087ba
3 changed files with 2 additions and 13 deletions

View File

@@ -15,21 +15,16 @@
// Checks can make a mock registrar.
TEST(FlPluginRegistrarTest, FlMockRegistrar) {
gtk_init(NULL, NULL);
g_autoptr(FlDartProject) project = fl_dart_project_new();
g_autoptr(FlEngine) engine = make_mock_engine();
FlView* view = fl_view_new(project);
g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
g_autoptr(FlTextureRegistrar) texture_registrar =
fl_texture_registrar_new(engine);
g_autoptr(FlPluginRegistrar) registrar =
fl_mock_plugin_registrar_new(view, messenger, texture_registrar);
fl_mock_plugin_registrar_new(messenger, texture_registrar);
EXPECT_TRUE(FL_IS_MOCK_PLUGIN_REGISTRAR(registrar));
EXPECT_EQ(fl_plugin_registrar_get_messenger(registrar), messenger);
EXPECT_EQ(fl_plugin_registrar_get_texture_registrar(registrar),
texture_registrar);
EXPECT_EQ(fl_plugin_registrar_get_view(registrar), view);
}

View File

@@ -7,7 +7,6 @@
struct _FlMockPluginRegistrar {
GObject parent_instance;
FlView* view;
FlBinaryMessenger* messenger;
FlTextureRegistrar* texture_registrar;
};
@@ -47,8 +46,7 @@ static FlTextureRegistrar* get_texture_registrar(FlPluginRegistrar* registrar) {
}
static FlView* get_view(FlPluginRegistrar* registrar) {
FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar);
return self->view;
return NULL;
}
static void fl_mock_plugin_registrar_iface_init(
@@ -61,12 +59,10 @@ static void fl_mock_plugin_registrar_iface_init(
static void fl_mock_plugin_registrar_init(FlMockPluginRegistrar* self) {}
FlPluginRegistrar* fl_mock_plugin_registrar_new(
FlView* view,
FlBinaryMessenger* messenger,
FlTextureRegistrar* texture_registrar) {
FlMockPluginRegistrar* registrar = FL_MOCK_PLUGIN_REGISTRAR(
g_object_new(fl_mock_plugin_registrar_get_type(), NULL));
registrar->view = view;
registrar->messenger = FL_BINARY_MESSENGER(g_object_ref(messenger));
registrar->texture_registrar =
FL_TEXTURE_REGISTRAR(g_object_ref(texture_registrar));

View File

@@ -5,7 +5,6 @@
#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_plugin_registrar.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_texture_registrar.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_view.h"
G_BEGIN_DECLS
@@ -16,7 +15,6 @@ G_DECLARE_FINAL_TYPE(FlMockPluginRegistrar,
GObject)
FlPluginRegistrar* fl_mock_plugin_registrar_new(
FlView* view,
FlBinaryMessenger* messenger,
FlTextureRegistrar* texture_registrar);