test(flatpak): point flatpak tests at the external plugin sources

Rewires the flatpak unit, integration and plugin-manager tests to compile
against plugins/flatpak-provider, and updates plugin-manager.test to treat
flatpak as a runtime-loaded plugin rather than a registered built-in.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
BlackAngelTV committed 2026-08-29 20:34:50 +02:00
1 parent bd13a1404b
commit e81f5ee0cd
2 files changed
+22 -14

No files matched your search

+12 -6
View File
@@ -46,14 +46,16 @@ add_executable(pacman-manager-test tests/pacman-manager.test.cpp src/pacman-mana
target_include_directories(pacman-manager-test PRIVATE include)
add_test(NAME pacman-manager-test COMMAND pacman-manager-test)
add_executable(flatpak-manager-test tests/flatpak-manager.test.cpp src/flatpak-manager.cpp)
target_include_directories(flatpak-manager-test PRIVATE include)
add_executable(flatpak-manager-test tests/flatpak-manager.test.cpp
plugins/flatpak-provider/flatpak-manager.cpp)
target_include_directories(flatpak-manager-test PRIVATE include plugins/flatpak-provider)
add_test(NAME flatpak-manager-test COMMAND flatpak-manager-test)
# Real end-to-end test of the Flatpak provider against the live flatpak CLI
# (installs and uninstalls a small app). Skipped when flatpak is missing.
add_executable(flatpak-integration-test tests/flatpak-integration.test.cpp src/flatpak-manager.cpp)
target_include_directories(flatpak-integration-test PRIVATE include)
add_executable(flatpak-integration-test tests/flatpak-integration.test.cpp
plugins/flatpak-provider/flatpak-manager.cpp)
target_include_directories(flatpak-integration-test PRIVATE include plugins/flatpak-provider)
add_test(NAME flatpak-integration-test COMMAND flatpak-integration-test)
add_executable(package-utils-test tests/package-utils.test.cpp)
@@ -64,8 +66,9 @@ add_test(NAME package-utils-test COMMAND package-utils-test)
# built next to the test binary, so it is only enabled with the plugin option.
if(FWS_BUILD_EXAMPLE_PLUGIN)
add_executable(plugin-manager-test tests/plugin-manager.test.cpp
src/plugin-manager.cpp src/pacman-manager.cpp src/flatpak-manager.cpp)
target_include_directories(plugin-manager-test PRIVATE include)
src/plugin-manager.cpp src/pacman-manager.cpp
plugins/flatpak-provider/flatpak-manager.cpp)
target_include_directories(plugin-manager-test PRIVATE include plugins/flatpak-provider)
target_link_libraries(plugin-manager-test PRIVATE Qt6::Core)
add_dependencies(plugin-manager-test example-provider-plugin)
add_custom_command(TARGET plugin-manager-test POST_BUILD
@@ -73,6 +76,9 @@ if(FWS_BUILD_EXAMPLE_PLUGIN)
$<TARGET_FILE_DIR:plugin-manager-test>/plugins
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:example-provider-plugin>
$<TARGET_FILE_DIR:plugin-manager-test>/plugins/
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:flatpak-provider-plugin>
$<TARGET_FILE_DIR:plugin-manager-test>/plugins/)
add_test(NAME plugin-manager-test COMMAND plugin-manager-test)
endif()
+10 -8
View File
@@ -16,21 +16,23 @@ int main(int argc, char* argv[]) {
PluginManager pm;
pm.registerBuiltin({"pacman", "Pacman", "1.0.0", "Natif Arch Linux", "FWS"},
new PacmanManager());
// Flatpak ships an install hint so the app can offer to install the tool
// (pacman -S flatpak) when it is missing on the system.
pm.registerBuiltin({"flatpak", "Flatpak", "1.0.0", "Flatpak", "FWS",
false, "", false, "flatpak"},
new FlatpakManager());
// Flatpak now ships as an external plugin (dropped next to the test binary
// by CMake, like the sample plugin) rather than a compiled-in provider.
pm.discoverExternal();
// Built-ins + the sample plugin dropped next to the test binary.
// pacman built-in + the flatpak and sample plugins dropped next to the
// test binary.
assert(pm.providers().size() == 3);
// Install hints are exposed per provider; the sample plugin omits its
// optional hint symbol, which must read back as empty.
// optional hint symbol (must read back empty), while the flatpak plugin
// declares the OS package backing its tool.
const auto& providers = pm.providers();
for (const auto& entry : providers) {
if (entry.info.id == "flatpak") assert(entry.info.installHint == "flatpak");
if (entry.info.id == "flatpak") {
assert(!entry.info.builtin);
assert(entry.info.installHint == "flatpak");
}
if (entry.info.id == "sample") assert(entry.info.installHint.empty());
}
assert(pm.findAvailable("flatpak") != nullptr);