Use a valid app when testing extension activation
This commit is contained in:
parent
164bd5b265
commit
331537201a
1 changed files with 9 additions and 4 deletions
|
@ -33,8 +33,10 @@ extension_deactivate_cb (MidoriExtension* extension)
|
||||||
static void
|
static void
|
||||||
extension_create (void)
|
extension_create (void)
|
||||||
{
|
{
|
||||||
|
MidoriApp* app;
|
||||||
MidoriExtension* extension;
|
MidoriExtension* extension;
|
||||||
|
|
||||||
|
app = midori_app_new ();
|
||||||
extension = g_object_new (MIDORI_TYPE_EXTENSION, NULL);
|
extension = g_object_new (MIDORI_TYPE_EXTENSION, NULL);
|
||||||
g_assert (!midori_extension_is_prepared (extension));
|
g_assert (!midori_extension_is_prepared (extension));
|
||||||
g_object_set (extension, "name", "TestExtension",
|
g_object_set (extension, "name", "TestExtension",
|
||||||
|
@ -48,8 +50,9 @@ extension_create (void)
|
||||||
G_CALLBACK (extension_activate_cb), NULL);
|
G_CALLBACK (extension_activate_cb), NULL);
|
||||||
g_assert (midori_extension_is_prepared (extension));
|
g_assert (midori_extension_is_prepared (extension));
|
||||||
g_assert (!midori_extension_is_active (extension));
|
g_assert (!midori_extension_is_active (extension));
|
||||||
g_signal_emit_by_name (extension, "activate", NULL);
|
g_signal_emit_by_name (extension, "activate", app);
|
||||||
g_assert (midori_extension_is_active (extension));
|
g_assert (midori_extension_is_active (extension));
|
||||||
|
g_assert (midori_extension_get_app (extension) == app);
|
||||||
g_assert (g_object_get_data (G_OBJECT (extension), "activated") == magic);
|
g_assert (g_object_get_data (G_OBJECT (extension), "activated") == magic);
|
||||||
g_signal_connect (extension, "deactivate",
|
g_signal_connect (extension, "deactivate",
|
||||||
G_CALLBACK (extension_deactivate_cb), NULL);
|
G_CALLBACK (extension_deactivate_cb), NULL);
|
||||||
|
@ -75,18 +78,20 @@ extension_mock_object (void)
|
||||||
static void
|
static void
|
||||||
extension_settings (void)
|
extension_settings (void)
|
||||||
{
|
{
|
||||||
|
MidoriApp* app;
|
||||||
MidoriExtension* extension;
|
MidoriExtension* extension;
|
||||||
gboolean nihilist;
|
gboolean nihilist;
|
||||||
gint age;
|
gint age;
|
||||||
const gchar* lastname;
|
const gchar* lastname;
|
||||||
|
|
||||||
|
app = midori_app_new ();
|
||||||
extension = extension_mock_object ();
|
extension = extension_mock_object ();
|
||||||
midori_extension_install_boolean (extension, "nihilist", TRUE);
|
midori_extension_install_boolean (extension, "nihilist", TRUE);
|
||||||
nihilist = midori_extension_get_boolean (extension, "nihilist");
|
nihilist = midori_extension_get_boolean (extension, "nihilist");
|
||||||
g_assert (!nihilist);
|
g_assert (!nihilist);
|
||||||
g_signal_connect (extension, "activate",
|
g_signal_connect (extension, "activate",
|
||||||
G_CALLBACK (extension_activate_cb), NULL);
|
G_CALLBACK (extension_activate_cb), NULL);
|
||||||
g_signal_emit_by_name (extension, "activate", NULL);
|
g_signal_emit_by_name (extension, "activate", app);
|
||||||
nihilist = midori_extension_get_boolean (extension, "nihilist");
|
nihilist = midori_extension_get_boolean (extension, "nihilist");
|
||||||
g_assert (nihilist);
|
g_assert (nihilist);
|
||||||
midori_extension_set_boolean (extension, "nihilist", FALSE);
|
midori_extension_set_boolean (extension, "nihilist", FALSE);
|
||||||
|
@ -100,7 +105,7 @@ extension_settings (void)
|
||||||
g_assert_cmpint (age, ==, 0);
|
g_assert_cmpint (age, ==, 0);
|
||||||
g_signal_connect (extension, "activate",
|
g_signal_connect (extension, "activate",
|
||||||
G_CALLBACK (extension_activate_cb), NULL);
|
G_CALLBACK (extension_activate_cb), NULL);
|
||||||
g_signal_emit_by_name (extension, "activate", NULL);
|
g_signal_emit_by_name (extension, "activate", app);
|
||||||
age = midori_extension_get_integer (extension, "age");
|
age = midori_extension_get_integer (extension, "age");
|
||||||
g_assert_cmpint (age, ==, 88);
|
g_assert_cmpint (age, ==, 88);
|
||||||
midori_extension_set_integer (extension, "age", 66);
|
midori_extension_set_integer (extension, "age", 66);
|
||||||
|
@ -114,7 +119,7 @@ extension_settings (void)
|
||||||
g_assert_cmpstr (lastname, ==, NULL);
|
g_assert_cmpstr (lastname, ==, NULL);
|
||||||
g_signal_connect (extension, "activate",
|
g_signal_connect (extension, "activate",
|
||||||
G_CALLBACK (extension_activate_cb), NULL);
|
G_CALLBACK (extension_activate_cb), NULL);
|
||||||
g_signal_emit_by_name (extension, "activate", NULL);
|
g_signal_emit_by_name (extension, "activate", app);
|
||||||
lastname = midori_extension_get_string (extension, "lastname");
|
lastname = midori_extension_get_string (extension, "lastname");
|
||||||
g_assert_cmpstr (lastname, ==, "Thomas Mann");
|
g_assert_cmpstr (lastname, ==, "Thomas Mann");
|
||||||
midori_extension_set_string (extension, "lastname", "Theodor Fontane");
|
midori_extension_set_string (extension, "lastname", "Theodor Fontane");
|
||||||
|
|
Loading…
Reference in a new issue