gio/tests/fake-document-portal: Use a sequential ID for docs

It makes things clearer to test
This commit is contained in:
Marco Trevisan (Treviño)
2025-09-20 08:19:36 +02:00
committed by Marco Trevisan
parent ea31be5472
commit ddc324da03
2 changed files with 6 additions and 6 deletions

View File

@@ -349,7 +349,7 @@ on_flatpak_open (GApplication *app,
g_test_message ("on_flatpak_open received file '%s'", g_file_peek_path (files[0])); g_test_message ("on_flatpak_open received file '%s'", g_file_peek_path (files[0]));
/* The file has been exported via the document portal */ /* The file has been exported via the document portal */
f = g_file_new_for_uri ("file:///document-portal/document-id/org.gtk.test.dbusappinfo.flatpak.desktop"); f = g_file_new_for_uri ("file:///document-portal/document-id-0/org.gtk.test.dbusappinfo.flatpak.desktop");
g_assert_true (g_file_equal (files[0], f)); g_assert_true (g_file_equal (files[0], f));
g_object_unref (f); g_object_unref (f);
} }

View File

@@ -96,7 +96,7 @@ on_handle_add_full (FakeDocuments *object,
const gchar * const *permissions, const gchar * const *permissions,
gpointer user_data) gpointer user_data)
{ {
const gchar **doc_ids = NULL; gchar **doc_ids = NULL;
GVariant *extra_out = NULL; GVariant *extra_out = NULL;
gsize length, i; gsize length, i;
@@ -105,20 +105,20 @@ on_handle_add_full (FakeDocuments *object,
else else
length = 0; length = 0;
doc_ids = g_new0 (const gchar *, length + 1 /* NULL terminator */); doc_ids = g_new0 (gchar *, length + 1 /* NULL terminator */);
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
{ {
doc_ids[i] = "document-id"; doc_ids[i] = g_strdup_printf ("document-id-%" G_GSIZE_FORMAT, i);
} }
extra_out = g_variant_new_array (G_VARIANT_TYPE ("{sv}"), NULL, 0); extra_out = g_variant_new_array (G_VARIANT_TYPE ("{sv}"), NULL, 0);
fake_documents_complete_add_full (object, fake_documents_complete_add_full (object,
invocation, invocation,
NULL, NULL,
doc_ids, (const char **) doc_ids,
extra_out); extra_out);
g_free (doc_ids); g_strfreev (doc_ids);
return TRUE; return TRUE;
} }