[mutter] monitor-unit-tests: Check tiled monitor adding/removing notification
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor-unit-tests: Check tiled monitor adding/removing notification
- Date: Wed, 25 Jan 2017 08:34:54 +0000 (UTC)
commit 310064601cd9298f7454e05a7899053ff867081a
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Dec 13 20:11:48 2016 +0800
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
src/tests/meta-monitor-manager-test.c | 28 ++++++++++++++++++++++++++++
src/tests/meta-monitor-manager-test.h | 2 ++
src/tests/monitor-unit-tests.c | 9 +++++++++
3 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/src/tests/meta-monitor-manager-test.c b/src/tests/meta-monitor-manager-test.c
index 6d100d8..222d19b 100644
--- a/src/tests/meta-monitor-manager-test.c
+++ b/src/tests/meta-monitor-manager-test.c
@@ -25,6 +25,8 @@ struct _MetaMonitorManagerTest
{
MetaMonitorManager parent;
+ int tiled_monitor_count;
+
MetaMonitorTestSetup *test_setup;
};
@@ -55,6 +57,12 @@ meta_monitor_manager_test_emulate_hotplug (MetaMonitorManagerTest *manager_test,
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
meta_monitor_manager_test_read_current (MetaMonitorManager *manager)
{
@@ -190,6 +198,24 @@ meta_monitor_manager_test_apply_configuration (MetaMonitorManager *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
meta_monitor_manager_test_dispose (GObject *object)
{
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (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->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;
}
diff --git a/src/tests/meta-monitor-manager-test.h b/src/tests/meta-monitor-manager-test.h
index fe6ef84..ccaea80 100644
--- a/src/tests/meta-monitor-manager-test.h
+++ b/src/tests/meta-monitor-manager-test.h
@@ -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,
MetaMonitorTestSetup *test_setup);
+int meta_monitor_manager_test_get_tiled_monitor_count (MetaMonitorManagerTest *manager_test);
+
#endif /* META_MONITOR_MANAGER_TEST_H */
diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c
index 6f4a297..4f23d39 100644
--- a/src/tests/monitor-unit-tests.c
+++ b/src/tests/monitor-unit-tests.c
@@ -135,6 +135,7 @@ typedef struct _MonitorTestCaseExpect
int n_logical_monitors;
int n_outputs;
int n_crtcs;
+ int n_tiled_monitors;
int screen_width;
int screen_height;
} MonitorTestCaseExpect;
@@ -246,6 +247,9 @@ check_monitor_configuration (MonitorTestCase *test_case)
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
+ MetaMonitorManagerTest *monitor_manager_test =
+ META_MONITOR_MANAGER_TEST (monitor_manager);
+ int tiled_monitor_count;
GList *monitors;
GList *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_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);
g_assert ((int) g_list_length (monitors) == test_case->expect.n_monitors);
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_outputs = 2,
.n_crtcs = 2,
+ .n_tiled_monitors = 1,
.screen_width = 800,
.screen_height = 600,
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]