[mutter] tests/monitor-manager: Add API to emulate a hotplug event
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] tests/monitor-manager: Add API to emulate a hotplug event
- Date: Wed, 25 Jan 2017 08:33:29 +0000 (UTC)
commit 2e4c516d4325e095e0bc591cada8f17d71edf1a5
Author: Jonas Ådahl <jadahl gmail com>
Date: Wed Dec 7 17:39:53 2016 +0800
tests/monitor-manager: Add API to emulate a hotplug event
Let a test case pass a test setup, which will be used as the new state
emulated by the test backend.
https://bugzilla.gnome.org/show_bug.cgi?id=777732
src/tests/meta-monitor-manager-test.c | 27 +++++++++++++++++++++++++++
src/tests/meta-monitor-manager-test.h | 3 +++
2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/tests/meta-monitor-manager-test.c b/src/tests/meta-monitor-manager-test.c
index c5249cd..262466d 100644
--- a/src/tests/meta-monitor-manager-test.c
+++ b/src/tests/meta-monitor-manager-test.c
@@ -39,6 +39,22 @@ meta_monitor_manager_test_init_test_setup (MetaMonitorTestSetup *test_setup)
_initial_test_setup = test_setup;
}
+void
+meta_monitor_manager_test_emulate_hotplug (MetaMonitorManagerTest *manager_test,
+ MetaMonitorTestSetup *test_setup)
+{
+ MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_test);
+ MetaMonitorTestSetup *old_test_setup;
+
+ old_test_setup = manager_test->test_setup;
+ manager_test->test_setup = test_setup;
+
+ meta_monitor_manager_read_current_config (manager);
+ meta_monitor_manager_on_hotplug (manager);
+
+ g_free (old_test_setup);
+}
+
static void
meta_monitor_manager_test_read_current (MetaMonitorManager *manager)
{
@@ -174,6 +190,14 @@ meta_monitor_manager_test_apply_configuration (MetaMonitorManager *manager,
}
static void
+meta_monitor_manager_test_dispose (GObject *object)
+{
+ MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (object);
+
+ g_clear_pointer (&manager_test->test_setup, g_free);
+}
+
+static void
meta_monitor_manager_test_init (MetaMonitorManagerTest *manager_test)
{
g_assert (_initial_test_setup);
@@ -184,8 +208,11 @@ meta_monitor_manager_test_init (MetaMonitorManagerTest *manager_test)
static void
meta_monitor_manager_test_class_init (MetaMonitorManagerTestClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_CLASS (klass);
+ object_class->dispose = meta_monitor_manager_test_dispose;
+
manager_class->read_current = meta_monitor_manager_test_read_current;
manager_class->apply_configuration = meta_monitor_manager_test_apply_configuration;
}
diff --git a/src/tests/meta-monitor-manager-test.h b/src/tests/meta-monitor-manager-test.h
index 4ad9095..5be27cb 100644
--- a/src/tests/meta-monitor-manager-test.h
+++ b/src/tests/meta-monitor-manager-test.h
@@ -38,4 +38,7 @@ G_DECLARE_FINAL_TYPE (MetaMonitorManagerTest, meta_monitor_manager_test,
void meta_monitor_manager_test_init_test_setup (MetaMonitorTestSetup *test_setup);
+void meta_monitor_manager_test_emulate_hotplug (MetaMonitorManagerTest *manager_test,
+ MetaMonitorTestSetup *test_setup);
+
#endif /* META_MONITOR_MANAGER_TEST_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]