mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 01:50:42 -05:00
monitor-unit-tests: Check tiled monitor adding/removing notification
Check that the moniter manager backends get the tiled monitor added/removed notification. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
78799e58d2
commit
310064601c
@ -25,6 +25,8 @@ struct _MetaMonitorManagerTest
|
|||||||
{
|
{
|
||||||
MetaMonitorManager parent;
|
MetaMonitorManager parent;
|
||||||
|
|
||||||
|
int tiled_monitor_count;
|
||||||
|
|
||||||
MetaMonitorTestSetup *test_setup;
|
MetaMonitorTestSetup *test_setup;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -55,6 +57,12 @@ meta_monitor_manager_test_emulate_hotplug (MetaMonitorManagerTest *manager_test,
|
|||||||
g_free (old_test_setup);
|
g_free (old_test_setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
meta_monitor_manager_test_get_tiled_monitor_count (MetaMonitorManagerTest *manager_test)
|
||||||
|
{
|
||||||
|
return manager_test->tiled_monitor_count;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_test_read_current (MetaMonitorManager *manager)
|
meta_monitor_manager_test_read_current (MetaMonitorManager *manager)
|
||||||
{
|
{
|
||||||
@ -189,6 +197,24 @@ meta_monitor_manager_test_apply_configuration (MetaMonitorManager *manager,
|
|||||||
meta_monitor_manager_rebuild_derived (manager);
|
meta_monitor_manager_rebuild_derived (manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_monitor_manager_test_tiled_monitor_added (MetaMonitorManager *manager,
|
||||||
|
MetaMonitor *monitor)
|
||||||
|
{
|
||||||
|
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (manager);
|
||||||
|
|
||||||
|
manager_test->tiled_monitor_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_monitor_manager_test_tiled_monitor_removed (MetaMonitorManager *manager,
|
||||||
|
MetaMonitor *monitor)
|
||||||
|
{
|
||||||
|
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (manager);
|
||||||
|
|
||||||
|
manager_test->tiled_monitor_count--;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_test_dispose (GObject *object)
|
meta_monitor_manager_test_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
@ -215,4 +241,6 @@ meta_monitor_manager_test_class_init (MetaMonitorManagerTestClass *klass)
|
|||||||
|
|
||||||
manager_class->read_current = meta_monitor_manager_test_read_current;
|
manager_class->read_current = meta_monitor_manager_test_read_current;
|
||||||
manager_class->apply_configuration = meta_monitor_manager_test_apply_configuration;
|
manager_class->apply_configuration = meta_monitor_manager_test_apply_configuration;
|
||||||
|
manager_class->tiled_monitor_added = meta_monitor_manager_test_tiled_monitor_added;
|
||||||
|
manager_class->tiled_monitor_removed = meta_monitor_manager_test_tiled_monitor_removed;
|
||||||
}
|
}
|
||||||
|
@ -41,4 +41,6 @@ void meta_monitor_manager_test_init_test_setup (MetaMonitorTestSetup *test_setup
|
|||||||
void meta_monitor_manager_test_emulate_hotplug (MetaMonitorManagerTest *manager_test,
|
void meta_monitor_manager_test_emulate_hotplug (MetaMonitorManagerTest *manager_test,
|
||||||
MetaMonitorTestSetup *test_setup);
|
MetaMonitorTestSetup *test_setup);
|
||||||
|
|
||||||
|
int meta_monitor_manager_test_get_tiled_monitor_count (MetaMonitorManagerTest *manager_test);
|
||||||
|
|
||||||
#endif /* META_MONITOR_MANAGER_TEST_H */
|
#endif /* META_MONITOR_MANAGER_TEST_H */
|
||||||
|
@ -135,6 +135,7 @@ typedef struct _MonitorTestCaseExpect
|
|||||||
int n_logical_monitors;
|
int n_logical_monitors;
|
||||||
int n_outputs;
|
int n_outputs;
|
||||||
int n_crtcs;
|
int n_crtcs;
|
||||||
|
int n_tiled_monitors;
|
||||||
int screen_width;
|
int screen_width;
|
||||||
int screen_height;
|
int screen_height;
|
||||||
} MonitorTestCaseExpect;
|
} MonitorTestCaseExpect;
|
||||||
@ -246,6 +247,9 @@ check_monitor_configuration (MonitorTestCase *test_case)
|
|||||||
MetaBackend *backend = meta_get_backend ();
|
MetaBackend *backend = meta_get_backend ();
|
||||||
MetaMonitorManager *monitor_manager =
|
MetaMonitorManager *monitor_manager =
|
||||||
meta_backend_get_monitor_manager (backend);
|
meta_backend_get_monitor_manager (backend);
|
||||||
|
MetaMonitorManagerTest *monitor_manager_test =
|
||||||
|
META_MONITOR_MANAGER_TEST (monitor_manager);
|
||||||
|
int tiled_monitor_count;
|
||||||
GList *monitors;
|
GList *monitors;
|
||||||
GList *logical_monitors;
|
GList *logical_monitors;
|
||||||
int n_logical_monitors;
|
int n_logical_monitors;
|
||||||
@ -257,6 +261,10 @@ check_monitor_configuration (MonitorTestCase *test_case)
|
|||||||
g_assert ((int) monitor_manager->n_outputs == test_case->expect.n_outputs);
|
g_assert ((int) monitor_manager->n_outputs == test_case->expect.n_outputs);
|
||||||
g_assert ((int) monitor_manager->n_crtcs == test_case->expect.n_crtcs);
|
g_assert ((int) monitor_manager->n_crtcs == test_case->expect.n_crtcs);
|
||||||
|
|
||||||
|
tiled_monitor_count =
|
||||||
|
meta_monitor_manager_test_get_tiled_monitor_count (monitor_manager_test);
|
||||||
|
g_assert (tiled_monitor_count == test_case->expect.n_tiled_monitors);
|
||||||
|
|
||||||
monitors = meta_monitor_manager_get_monitors (monitor_manager);
|
monitors = meta_monitor_manager_get_monitors (monitor_manager);
|
||||||
g_assert ((int) g_list_length (monitors) == test_case->expect.n_monitors);
|
g_assert ((int) g_list_length (monitors) == test_case->expect.n_monitors);
|
||||||
for (l = monitors, i = 0; l; l = l->next, i++)
|
for (l = monitors, i = 0; l; l = l->next, i++)
|
||||||
@ -724,6 +732,7 @@ meta_test_monitor_tiled_linear_config (void)
|
|||||||
.n_logical_monitors = 1,
|
.n_logical_monitors = 1,
|
||||||
.n_outputs = 2,
|
.n_outputs = 2,
|
||||||
.n_crtcs = 2,
|
.n_crtcs = 2,
|
||||||
|
.n_tiled_monitors = 1,
|
||||||
.screen_width = 800,
|
.screen_width = 800,
|
||||||
.screen_height = 600,
|
.screen_height = 600,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user