mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-16 12:45:13 +01:00
GApplication: fix bogus testcase
We had a GApplication testcase that handled both open and commandline. This only way that this worked was by implementing the commandline handler without actually setting the HANDLES_COMMAND_LINE flag. This behaviour is now invalid, so just rip out the offending part of the test. https://bugzilla.gnome.org/show_bug.cgi?id=711099
This commit is contained in:
parent
6e0bbd8adb
commit
ffbf866d3b
@ -262,7 +262,8 @@ g_application_impl_method_call (GDBusConnection *connection,
|
|||||||
flags = g_application_get_flags (impl->app);
|
flags = g_application_get_flags (impl->app);
|
||||||
if ((flags & G_APPLICATION_HANDLES_COMMAND_LINE) == 0)
|
if ((flags & G_APPLICATION_HANDLES_COMMAND_LINE) == 0)
|
||||||
{
|
{
|
||||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "Application does not handle command line arguments");
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED,
|
||||||
|
"Application does not handle command line arguments");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,28 +31,6 @@ open (GApplication *application,
|
|||||||
g_print ("\n");
|
g_print ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
command_line (GApplication *application,
|
|
||||||
GApplicationCommandLine *cmdline)
|
|
||||||
{
|
|
||||||
gchar **argv;
|
|
||||||
gint argc;
|
|
||||||
|
|
||||||
argv = g_application_command_line_get_arguments (cmdline, &argc);
|
|
||||||
|
|
||||||
g_application_command_line_print (cmdline, "%d + %d = %d\n", 40, 2, 42);
|
|
||||||
|
|
||||||
g_assert_cmpint (argc, ==, 3);
|
|
||||||
g_assert_cmpstr (argv[0], ==, "./cmd");
|
|
||||||
g_assert_cmpstr (argv[1], ==, "40 +");
|
|
||||||
g_assert_cmpstr (argv[2], ==, "2");
|
|
||||||
g_assert (argv[3] == NULL);
|
|
||||||
g_print ("cmdline '%s' '%s'\n", argv[1], argv[2]);
|
|
||||||
g_strfreev (argv);
|
|
||||||
|
|
||||||
return 42;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -67,7 +45,6 @@ main (int argc, char **argv)
|
|||||||
: 0));
|
: 0));
|
||||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||||
g_signal_connect (app, "open", G_CALLBACK (open), NULL);
|
g_signal_connect (app, "open", G_CALLBACK (open), NULL);
|
||||||
g_signal_connect (app, "command-line", G_CALLBACK (command_line), NULL);
|
|
||||||
#ifdef STANDALONE
|
#ifdef STANDALONE
|
||||||
g_application_set_inactivity_timeout (app, 10000);
|
g_application_set_inactivity_timeout (app, 10000);
|
||||||
#else
|
#else
|
||||||
|
@ -107,7 +107,6 @@ basic (void)
|
|||||||
/* spawn the master */
|
/* spawn the master */
|
||||||
spawn ("activated\n"
|
spawn ("activated\n"
|
||||||
"open file:///a file:///b\n"
|
"open file:///a file:///b\n"
|
||||||
"cmdline '40 +' '2'\n"
|
|
||||||
"exit status: 0\n",
|
"exit status: 0\n",
|
||||||
"./app", NULL);
|
"./app", NULL);
|
||||||
|
|
||||||
@ -115,10 +114,6 @@ basic (void)
|
|||||||
spawn ("exit status: 0\n",
|
spawn ("exit status: 0\n",
|
||||||
"./app", "/a", "/b", NULL);
|
"./app", "/a", "/b", NULL);
|
||||||
|
|
||||||
spawn ("40 + 2 = 42\n"
|
|
||||||
"exit status: 42\n",
|
|
||||||
"./cmd", "40 +", "2", NULL);
|
|
||||||
|
|
||||||
g_main_loop_run (main_loop);
|
g_main_loop_run (main_loop);
|
||||||
|
|
||||||
g_object_unref (c);
|
g_object_unref (c);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user