mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Move mock objects into separate modules
This commit is contained in:
parent
efe2f3ebfb
commit
24372ebfa9
@ -201,10 +201,13 @@ executable("flutter_linux_unittests") {
|
||||
"fl_texture_registrar_test.cc",
|
||||
"fl_value_test.cc",
|
||||
"testing/fl_test.cc",
|
||||
"testing/mock_binary_messenger_response_handle.cc",
|
||||
"testing/mock_engine.cc",
|
||||
"testing/mock_epoxy.cc",
|
||||
"testing/mock_plugin_registrar.cc",
|
||||
"testing/mock_renderer.cc",
|
||||
"testing/mock_text_input_plugin.cc",
|
||||
"testing/mock_texture_registrar.cc",
|
||||
]
|
||||
|
||||
public_configs = [ "//flutter:config" ]
|
||||
|
||||
@ -11,40 +11,15 @@
|
||||
#include "flutter/shell/platform/linux/fl_engine_private.h"
|
||||
#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
|
||||
#include "flutter/shell/platform/linux/testing/fl_test.h"
|
||||
#include "flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.h"
|
||||
#include "flutter/shell/platform/linux/testing/mock_renderer.h"
|
||||
|
||||
G_DECLARE_FINAL_TYPE(FlMockBinaryMessengerResponseHandle,
|
||||
fl_mock_binary_messenger_response_handle,
|
||||
FL,
|
||||
MOCK_BINARY_MESSENGER_RESPONSE_HANDLE,
|
||||
FlBinaryMessengerResponseHandle)
|
||||
|
||||
G_DECLARE_FINAL_TYPE(FlMockBinaryMessenger,
|
||||
fl_mock_binary_messenger,
|
||||
FL,
|
||||
MOCK_BINARY_MESSENGER,
|
||||
GObject)
|
||||
|
||||
struct _FlMockBinaryMessengerResponseHandle {
|
||||
FlBinaryMessengerResponseHandle parent_instance;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(FlMockBinaryMessengerResponseHandle,
|
||||
fl_mock_binary_messenger_response_handle,
|
||||
fl_binary_messenger_response_handle_get_type());
|
||||
|
||||
static void fl_mock_binary_messenger_response_handle_class_init(
|
||||
FlMockBinaryMessengerResponseHandleClass* klass) {}
|
||||
|
||||
static void fl_mock_binary_messenger_response_handle_init(
|
||||
FlMockBinaryMessengerResponseHandle* self) {}
|
||||
|
||||
static FlMockBinaryMessengerResponseHandle*
|
||||
fl_mock_binary_messenger_response_handle_new() {
|
||||
return FL_MOCK_BINARY_MESSENGER_RESPONSE_HANDLE(
|
||||
g_object_new(fl_mock_binary_messenger_response_handle_get_type(), NULL));
|
||||
}
|
||||
|
||||
struct _FlMockBinaryMessenger {
|
||||
GObject parent_instance;
|
||||
|
||||
|
||||
@ -11,81 +11,7 @@
|
||||
#include "flutter/shell/platform/linux/fl_texture_registrar_private.h"
|
||||
#include "flutter/shell/platform/linux/public/flutter_linux/fl_plugin_registrar.h"
|
||||
#include "flutter/shell/platform/linux/testing/fl_test.h"
|
||||
|
||||
G_DECLARE_FINAL_TYPE(FlMockPluginRegistrar,
|
||||
fl_mock_plugin_registrar,
|
||||
FL,
|
||||
MOCK_PLUGIN_REGISTRAR,
|
||||
GObject)
|
||||
|
||||
struct _FlMockPluginRegistrar {
|
||||
GObject parent_instance;
|
||||
|
||||
FlView* view;
|
||||
FlBinaryMessenger* messenger;
|
||||
FlTextureRegistrar* texture_registrar;
|
||||
};
|
||||
|
||||
static void fl_mock_plugin_registrar_iface_init(
|
||||
FlPluginRegistrarInterface* iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE(
|
||||
FlMockPluginRegistrar,
|
||||
fl_mock_plugin_registrar,
|
||||
G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE(fl_plugin_registrar_get_type(),
|
||||
fl_mock_plugin_registrar_iface_init))
|
||||
|
||||
static void fl_mock_plugin_registrar_dispose(GObject* object) {
|
||||
FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(object);
|
||||
|
||||
g_clear_object(&self->messenger);
|
||||
g_clear_object(&self->texture_registrar);
|
||||
|
||||
G_OBJECT_CLASS(fl_mock_plugin_registrar_parent_class)->dispose(object);
|
||||
}
|
||||
|
||||
static void fl_mock_plugin_registrar_class_init(
|
||||
FlMockPluginRegistrarClass* klass) {
|
||||
G_OBJECT_CLASS(klass)->dispose = fl_mock_plugin_registrar_dispose;
|
||||
}
|
||||
|
||||
static FlBinaryMessenger* get_messenger(FlPluginRegistrar* registrar) {
|
||||
FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar);
|
||||
return self->messenger;
|
||||
}
|
||||
|
||||
static FlTextureRegistrar* get_texture_registrar(FlPluginRegistrar* registrar) {
|
||||
FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar);
|
||||
return self->texture_registrar;
|
||||
}
|
||||
|
||||
static FlView* get_view(FlPluginRegistrar* registrar) {
|
||||
FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar);
|
||||
return self->view;
|
||||
}
|
||||
|
||||
static void fl_mock_plugin_registrar_iface_init(
|
||||
FlPluginRegistrarInterface* iface) {
|
||||
iface->get_messenger = get_messenger;
|
||||
iface->get_texture_registrar = get_texture_registrar;
|
||||
iface->get_view = get_view;
|
||||
}
|
||||
|
||||
static void fl_mock_plugin_registrar_init(FlMockPluginRegistrar* self) {}
|
||||
|
||||
static 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));
|
||||
return FL_PLUGIN_REGISTRAR(registrar);
|
||||
}
|
||||
#include "flutter/shell/platform/linux/testing/mock_plugin_registrar.h"
|
||||
|
||||
// Checks can make a mock registrar.
|
||||
TEST(FlPluginRegistrarTest, FlMockRegistrar) {
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
#include "flutter/shell/platform/linux/public/flutter_linux/fl_pixel_buffer_texture.h"
|
||||
#include "flutter/shell/platform/linux/public/flutter_linux/fl_texture_gl.h"
|
||||
#include "flutter/shell/platform/linux/testing/fl_test.h"
|
||||
#include "flutter/shell/platform/linux/testing/mock_texture_registrar.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
@ -19,97 +20,6 @@ static constexpr uint32_t BUFFER_HEIGHT = 4u;
|
||||
static constexpr uint32_t REAL_BUFFER_WIDTH = 2u;
|
||||
static constexpr uint32_t REAL_BUFFER_HEIGHT = 2u;
|
||||
|
||||
G_DECLARE_FINAL_TYPE(FlMockTextureRegistrar,
|
||||
fl_mock_texture_registrar,
|
||||
FL,
|
||||
MOCK_TEXTURE_REGISTRAR,
|
||||
GObject)
|
||||
|
||||
struct _FlMockTextureRegistrar {
|
||||
GObject parent_instance;
|
||||
FlTexture* texture;
|
||||
gboolean frame_available;
|
||||
};
|
||||
|
||||
static void fl_mock_texture_registrar_iface_init(
|
||||
FlTextureRegistrarInterface* iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE(
|
||||
FlMockTextureRegistrar,
|
||||
fl_mock_texture_registrar,
|
||||
G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE(fl_texture_registrar_get_type(),
|
||||
fl_mock_texture_registrar_iface_init))
|
||||
|
||||
static void fl_mock_texture_registrar_dispose(GObject* object) {
|
||||
FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(object);
|
||||
g_clear_object(&self->texture);
|
||||
G_OBJECT_CLASS(fl_mock_texture_registrar_parent_class)->dispose(object);
|
||||
}
|
||||
|
||||
static void fl_mock_texture_registrar_class_init(
|
||||
FlMockTextureRegistrarClass* klass) {
|
||||
G_OBJECT_CLASS(klass)->dispose = fl_mock_texture_registrar_dispose;
|
||||
}
|
||||
|
||||
static gboolean register_texture(FlTextureRegistrar* registrar,
|
||||
FlTexture* texture) {
|
||||
FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar);
|
||||
if (self->texture != nullptr) {
|
||||
return FALSE;
|
||||
}
|
||||
self->texture = FL_TEXTURE(g_object_ref(texture));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static FlTexture* lookup_texture(FlTextureRegistrar* registrar,
|
||||
int64_t texture_id) {
|
||||
FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar);
|
||||
if (self->texture != nullptr &&
|
||||
fl_texture_get_texture_id(self->texture) == texture_id) {
|
||||
return self->texture;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static gboolean mark_texture_frame_available(FlTextureRegistrar* registrar,
|
||||
FlTexture* texture) {
|
||||
FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar);
|
||||
if (lookup_texture(registrar, fl_texture_get_texture_id(texture)) ==
|
||||
nullptr) {
|
||||
return FALSE;
|
||||
}
|
||||
self->frame_available = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean unregister_texture(FlTextureRegistrar* registrar,
|
||||
FlTexture* texture) {
|
||||
FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar);
|
||||
if (self->texture != texture) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_clear_object(&self->texture);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void fl_mock_texture_registrar_iface_init(
|
||||
FlTextureRegistrarInterface* iface) {
|
||||
iface->register_texture = register_texture;
|
||||
iface->lookup_texture = lookup_texture;
|
||||
iface->mark_texture_frame_available = mark_texture_frame_available;
|
||||
iface->unregister_texture = unregister_texture;
|
||||
}
|
||||
|
||||
static void fl_mock_texture_registrar_init(FlMockTextureRegistrar* self) {}
|
||||
|
||||
static FlMockTextureRegistrar* fl_mock_texture_registrar_new() {
|
||||
return FL_MOCK_TEXTURE_REGISTRAR(
|
||||
g_object_new(fl_mock_texture_registrar_get_type(), nullptr));
|
||||
}
|
||||
|
||||
G_DECLARE_FINAL_TYPE(FlTestRegistrarTexture,
|
||||
fl_test_registrar_texture,
|
||||
FL,
|
||||
@ -163,17 +73,17 @@ TEST(FlTextureRegistrarTest, MockRegistrar) {
|
||||
|
||||
EXPECT_TRUE(fl_texture_registrar_register_texture(
|
||||
FL_TEXTURE_REGISTRAR(registrar), texture));
|
||||
EXPECT_EQ(registrar->texture, texture);
|
||||
EXPECT_EQ(fl_mock_texture_registrar_get_texture(registrar), texture);
|
||||
EXPECT_EQ(
|
||||
fl_texture_registrar_lookup_texture(FL_TEXTURE_REGISTRAR(registrar),
|
||||
fl_texture_get_texture_id(texture)),
|
||||
texture);
|
||||
EXPECT_TRUE(fl_texture_registrar_mark_texture_frame_available(
|
||||
FL_TEXTURE_REGISTRAR(registrar), texture));
|
||||
EXPECT_TRUE(registrar->frame_available);
|
||||
EXPECT_TRUE(fl_mock_texture_registrar_get_frame_available(registrar));
|
||||
EXPECT_TRUE(fl_texture_registrar_unregister_texture(
|
||||
FL_TEXTURE_REGISTRAR(registrar), texture));
|
||||
EXPECT_EQ(registrar->texture, nullptr);
|
||||
EXPECT_EQ(fl_mock_texture_registrar_get_texture(registrar), nullptr);
|
||||
}
|
||||
|
||||
// Test that registering a texture works.
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.h"
|
||||
|
||||
struct _FlMockBinaryMessengerResponseHandle {
|
||||
FlBinaryMessengerResponseHandle parent_instance;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(FlMockBinaryMessengerResponseHandle,
|
||||
fl_mock_binary_messenger_response_handle,
|
||||
fl_binary_messenger_response_handle_get_type());
|
||||
|
||||
static void fl_mock_binary_messenger_response_handle_class_init(
|
||||
FlMockBinaryMessengerResponseHandleClass* klass) {}
|
||||
|
||||
static void fl_mock_binary_messenger_response_handle_init(
|
||||
FlMockBinaryMessengerResponseHandle* self) {}
|
||||
|
||||
FlMockBinaryMessengerResponseHandle*
|
||||
fl_mock_binary_messenger_response_handle_new() {
|
||||
return FL_MOCK_BINARY_MESSENGER_RESPONSE_HANDLE(
|
||||
g_object_new(fl_mock_binary_messenger_response_handle_get_type(), NULL));
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/shell/platform/linux/fl_binary_messenger_private.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE(FlMockBinaryMessengerResponseHandle,
|
||||
fl_mock_binary_messenger_response_handle,
|
||||
FL,
|
||||
MOCK_BINARY_MESSENGER_RESPONSE_HANDLE,
|
||||
FlBinaryMessengerResponseHandle)
|
||||
|
||||
FlMockBinaryMessengerResponseHandle*
|
||||
fl_mock_binary_messenger_response_handle_new();
|
||||
|
||||
G_END_DECLS
|
||||
@ -0,0 +1,74 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/shell/platform/linux/testing/mock_plugin_registrar.h"
|
||||
|
||||
struct _FlMockPluginRegistrar {
|
||||
GObject parent_instance;
|
||||
|
||||
FlView* view;
|
||||
FlBinaryMessenger* messenger;
|
||||
FlTextureRegistrar* texture_registrar;
|
||||
};
|
||||
|
||||
static void fl_mock_plugin_registrar_iface_init(
|
||||
FlPluginRegistrarInterface* iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE(
|
||||
FlMockPluginRegistrar,
|
||||
fl_mock_plugin_registrar,
|
||||
G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE(fl_plugin_registrar_get_type(),
|
||||
fl_mock_plugin_registrar_iface_init))
|
||||
|
||||
static void fl_mock_plugin_registrar_dispose(GObject* object) {
|
||||
FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(object);
|
||||
|
||||
g_clear_object(&self->messenger);
|
||||
g_clear_object(&self->texture_registrar);
|
||||
|
||||
G_OBJECT_CLASS(fl_mock_plugin_registrar_parent_class)->dispose(object);
|
||||
}
|
||||
|
||||
static void fl_mock_plugin_registrar_class_init(
|
||||
FlMockPluginRegistrarClass* klass) {
|
||||
G_OBJECT_CLASS(klass)->dispose = fl_mock_plugin_registrar_dispose;
|
||||
}
|
||||
|
||||
static FlBinaryMessenger* get_messenger(FlPluginRegistrar* registrar) {
|
||||
FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar);
|
||||
return self->messenger;
|
||||
}
|
||||
|
||||
static FlTextureRegistrar* get_texture_registrar(FlPluginRegistrar* registrar) {
|
||||
FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar);
|
||||
return self->texture_registrar;
|
||||
}
|
||||
|
||||
static FlView* get_view(FlPluginRegistrar* registrar) {
|
||||
FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar);
|
||||
return self->view;
|
||||
}
|
||||
|
||||
static void fl_mock_plugin_registrar_iface_init(
|
||||
FlPluginRegistrarInterface* iface) {
|
||||
iface->get_messenger = get_messenger;
|
||||
iface->get_texture_registrar = get_texture_registrar;
|
||||
iface->get_view = get_view;
|
||||
}
|
||||
|
||||
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));
|
||||
return FL_PLUGIN_REGISTRAR(registrar);
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#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
|
||||
|
||||
G_DECLARE_FINAL_TYPE(FlMockPluginRegistrar,
|
||||
fl_mock_plugin_registrar,
|
||||
FL,
|
||||
MOCK_PLUGIN_REGISTRAR,
|
||||
GObject)
|
||||
|
||||
FlPluginRegistrar* fl_mock_plugin_registrar_new(
|
||||
FlView* view,
|
||||
FlBinaryMessenger* messenger,
|
||||
FlTextureRegistrar* texture_registrar);
|
||||
|
||||
G_END_DECLS
|
||||
@ -0,0 +1,100 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/shell/platform/linux/testing/mock_texture_registrar.h"
|
||||
#include "flutter/shell/platform/linux/fl_texture_private.h"
|
||||
|
||||
struct _FlMockTextureRegistrar {
|
||||
GObject parent_instance;
|
||||
FlTexture* texture;
|
||||
gboolean frame_available;
|
||||
};
|
||||
|
||||
static void fl_mock_texture_registrar_iface_init(
|
||||
FlTextureRegistrarInterface* iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE(
|
||||
FlMockTextureRegistrar,
|
||||
fl_mock_texture_registrar,
|
||||
G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE(fl_texture_registrar_get_type(),
|
||||
fl_mock_texture_registrar_iface_init))
|
||||
|
||||
static gboolean register_texture(FlTextureRegistrar* registrar,
|
||||
FlTexture* texture) {
|
||||
FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar);
|
||||
if (self->texture != nullptr) {
|
||||
return FALSE;
|
||||
}
|
||||
self->texture = FL_TEXTURE(g_object_ref(texture));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static FlTexture* lookup_texture(FlTextureRegistrar* registrar,
|
||||
int64_t texture_id) {
|
||||
FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar);
|
||||
if (self->texture != nullptr &&
|
||||
fl_texture_get_texture_id(self->texture) == texture_id) {
|
||||
return self->texture;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static gboolean mark_texture_frame_available(FlTextureRegistrar* registrar,
|
||||
FlTexture* texture) {
|
||||
FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar);
|
||||
if (lookup_texture(registrar, fl_texture_get_texture_id(texture)) ==
|
||||
nullptr) {
|
||||
return FALSE;
|
||||
}
|
||||
self->frame_available = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean unregister_texture(FlTextureRegistrar* registrar,
|
||||
FlTexture* texture) {
|
||||
FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar);
|
||||
if (self->texture != texture) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_clear_object(&self->texture);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void fl_mock_texture_registrar_iface_init(
|
||||
FlTextureRegistrarInterface* iface) {
|
||||
iface->register_texture = register_texture;
|
||||
iface->lookup_texture = lookup_texture;
|
||||
iface->mark_texture_frame_available = mark_texture_frame_available;
|
||||
iface->unregister_texture = unregister_texture;
|
||||
}
|
||||
|
||||
static void fl_mock_texture_registrar_dispose(GObject* object) {
|
||||
FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(object);
|
||||
g_clear_object(&self->texture);
|
||||
G_OBJECT_CLASS(fl_mock_texture_registrar_parent_class)->dispose(object);
|
||||
}
|
||||
|
||||
static void fl_mock_texture_registrar_class_init(
|
||||
FlMockTextureRegistrarClass* klass) {
|
||||
G_OBJECT_CLASS(klass)->dispose = fl_mock_texture_registrar_dispose;
|
||||
}
|
||||
|
||||
static void fl_mock_texture_registrar_init(FlMockTextureRegistrar* self) {}
|
||||
|
||||
FlMockTextureRegistrar* fl_mock_texture_registrar_new() {
|
||||
return FL_MOCK_TEXTURE_REGISTRAR(
|
||||
g_object_new(fl_mock_texture_registrar_get_type(), nullptr));
|
||||
}
|
||||
|
||||
FlTexture* fl_mock_texture_registrar_get_texture(FlMockTextureRegistrar* self) {
|
||||
return self->texture;
|
||||
}
|
||||
|
||||
gboolean fl_mock_texture_registrar_get_frame_available(
|
||||
FlMockTextureRegistrar* self) {
|
||||
return self->frame_available;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/shell/platform/linux/fl_texture_registrar_private.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE(FlMockTextureRegistrar,
|
||||
fl_mock_texture_registrar,
|
||||
FL,
|
||||
MOCK_TEXTURE_REGISTRAR,
|
||||
GObject)
|
||||
|
||||
FlMockTextureRegistrar* fl_mock_texture_registrar_new();
|
||||
|
||||
FlTexture* fl_mock_texture_registrar_get_texture(
|
||||
FlMockTextureRegistrar* registrar);
|
||||
|
||||
gboolean fl_mock_texture_registrar_get_frame_available(
|
||||
FlMockTextureRegistrar* registrar);
|
||||
|
||||
G_END_DECLS
|
||||
Loading…
x
Reference in New Issue
Block a user