[Windows] Fix incorrect public C API argument type (flutter/engine#35106)
FlutterDesktopEngineGetTextureRegistrar is used to get the texture registrar associated with an engine object and therefore should take a FlutterDesktopEngineRef parameter. This bug was initially identified and fixed by @knopp in: https://github.com/flutter/engine/pull/27522 This patch replaces that one and adds the simplest possible unit test to get it landed. This also adds an initial unit test for the public Windows C API used to implement the C++ client wrapper. In order to fully test this API, we'll want to support test fixtures similar to what we do in the embedder API tests. See: https://github.com/flutter/flutter/issues/87299 Fixes: https://github.com/flutter/flutter/issues/86617
This commit is contained in:
@@ -2401,6 +2401,7 @@ FILE: ../../../flutter/shell/platform/windows/flutter_windows_engine_unittests.c
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_texture_registrar.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_texture_registrar.h
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_texture_registrar_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_view.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_view.h
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_view_unittests.cc
|
||||
|
||||
@@ -173,6 +173,7 @@ executable("flutter_windows_unittests") {
|
||||
"flutter_window_unittests.cc",
|
||||
"flutter_windows_engine_unittests.cc",
|
||||
"flutter_windows_texture_registrar_unittests.cc",
|
||||
"flutter_windows_unittests.cc",
|
||||
"flutter_windows_view_unittests.cc",
|
||||
"keyboard_key_channel_handler_unittests.cc",
|
||||
"keyboard_key_embedder_handler_unittests.cc",
|
||||
|
||||
@@ -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/windows/public/flutter_windows.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace flutter {
|
||||
|
||||
TEST(FlutterWindowsTest, GetTextureRegistrar) {
|
||||
FlutterDesktopEngineProperties properties;
|
||||
memset(&properties, 0, sizeof(FlutterDesktopEngineProperties));
|
||||
properties.assets_path = L"";
|
||||
properties.icu_data_path = L"icudtl.dat";
|
||||
auto engine = FlutterDesktopEngineCreate(&properties);
|
||||
ASSERT_NE(engine, nullptr);
|
||||
auto texture_registrar = FlutterDesktopEngineGetTextureRegistrar(engine);
|
||||
EXPECT_NE(texture_registrar, nullptr);
|
||||
FlutterDesktopEngineDestroy(engine);
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
@@ -169,8 +169,7 @@ FlutterDesktopEngineGetMessenger(FlutterDesktopEngineRef engine);
|
||||
|
||||
// Returns the texture registrar associated with the engine.
|
||||
FLUTTER_EXPORT FlutterDesktopTextureRegistrarRef
|
||||
FlutterDesktopEngineGetTextureRegistrar(
|
||||
FlutterDesktopTextureRegistrarRef texture_registrar);
|
||||
FlutterDesktopEngineGetTextureRegistrar(FlutterDesktopEngineRef engine);
|
||||
|
||||
// ========== View ==========
|
||||
|
||||
|
||||
Reference in New Issue
Block a user