diff --git a/src/tests/migration/horizontal-strip-finished.xml b/src/tests/migration/horizontal-strip-finished.xml
new file mode 100644
index 000000000..743919a61
--- /dev/null
+++ b/src/tests/migration/horizontal-strip-finished.xml
@@ -0,0 +1,154 @@
+
+
+ logical
+
+ 0
+ 150
+ 2
+
+
+ DP-1
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456a
+
+
+ 800
+ 600
+ 60.000
+
+
+
+
+ 400
+ 0
+ 1
+
+
+ DP-2
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456b
+
+
+ 800
+ 600
+ 60.000
+
+
+
+
+ 1200
+ 199
+ 2.985074520111084
+ yes
+
+
+ DP-3
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456c
+
+
+ 800
+ 600
+ 60.000
+
+
+
+
+ 1468
+ 0
+ 1
+
+
+ DP-4
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456d
+
+
+ 800
+ 600
+ 60.000
+
+
+
+
+
+ physical
+
+ 0
+ 0
+ 2
+
+
+ DP-1
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456a
+
+
+ 800
+ 600
+ 60.000
+
+
+
+
+ 800
+ 550
+ 1
+
+
+ DP-2
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456b
+
+
+ 800
+ 600
+ 60.000
+
+
+
+
+ 1600
+ 550
+ 3
+ yes
+
+
+ DP-3
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456c
+
+
+ 800
+ 600
+ 60.000
+
+
+
+
+ 2400
+ 900
+ 1
+
+
+ DP-4
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456d
+
+
+ 800
+ 600
+ 60.000
+
+
+
+
+
diff --git a/src/tests/migration/horizontal-strip.xml b/src/tests/migration/horizontal-strip.xml
new file mode 100644
index 000000000..3149014a8
--- /dev/null
+++ b/src/tests/migration/horizontal-strip.xml
@@ -0,0 +1,77 @@
+
+
+
+ 0
+ 0
+ 2
+
+
+ DP-1
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456a
+
+
+ 800
+ 600
+ 60.000
+
+
+
+
+ 800
+ 550
+ 1
+
+
+ DP-2
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456b
+
+
+ 800
+ 600
+ 60.000
+
+
+
+
+ 1600
+ 550
+ 3
+ yes
+
+
+ DP-3
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456c
+
+
+ 800
+ 600
+ 60.000
+
+
+
+
+ 2400
+ 900
+ 1
+
+
+ DP-4
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456d
+
+
+ 800
+ 600
+ 60.000
+
+
+
+
+
diff --git a/src/tests/migration/rotated-finished.xml b/src/tests/migration/rotated-finished.xml
new file mode 100644
index 000000000..37dce6974
--- /dev/null
+++ b/src/tests/migration/rotated-finished.xml
@@ -0,0 +1,126 @@
+
+
+ logical
+
+ 0
+ 0
+ 1
+ yes
+
+ right
+ no
+
+
+
+ DP-1
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456a
+
+
+ 1920
+ 1080
+ 60.000
+
+
+
+
+ 1080
+ 0
+ 2
+
+
+ DP-2
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456b
+
+
+ 1920
+ 1080
+ 60.000
+
+
+
+
+ 600
+ 1920
+ 1
+
+
+ DP-3
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456c
+
+
+ 1920
+ 1080
+ 60.000
+
+
+
+
+
+ physical
+
+ 0
+ 0
+ 1
+ yes
+
+ right
+ no
+
+
+
+ DP-1
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456a
+
+
+ 1920
+ 1080
+ 60.000
+
+
+
+
+ 1080
+ 0
+ 2
+
+
+ DP-2
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456b
+
+
+ 1920
+ 1080
+ 60.000
+
+
+
+
+ 600
+ 1920
+ 1
+
+
+ DP-3
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456c
+
+
+ 1920
+ 1080
+ 60.000
+
+
+
+
+
diff --git a/src/tests/migration/rotated.xml b/src/tests/migration/rotated.xml
new file mode 100644
index 000000000..2a21a6252
--- /dev/null
+++ b/src/tests/migration/rotated.xml
@@ -0,0 +1,63 @@
+
+
+
+ 0
+ 0
+ 1
+ yes
+
+ right
+ no
+
+
+
+ DP-1
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456a
+
+
+ 1920
+ 1080
+ 60.000
+
+
+
+
+ 1080
+ 0
+ 2
+
+
+ DP-2
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456b
+
+
+ 1920
+ 1080
+ 60.000
+
+
+
+
+ 600
+ 1920
+ 1
+
+
+ DP-3
+ MetaProduct's Inc.
+ MetaMonitor
+ 0x123456c
+
+
+ 1920
+ 1080
+ 60.000
+
+
+
+
+
diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c
index 0519f0db3..80730a58f 100644
--- a/src/tests/monitor-unit-tests.c
+++ b/src/tests/monitor-unit-tests.c
@@ -8417,6 +8417,518 @@ meta_test_monitor_custom_lid_switch_config (void)
check_monitor_test_clients_state ();
}
+static void
+meta_test_monitor_migrated_rotated (void)
+{
+ MonitorTestCase test_case = {
+ .setup = {
+ .modes = {
+ {
+ .width = 1920,
+ .height = 1080,
+ .refresh_rate = 60.0
+ }
+ },
+ .n_modes = 1,
+ .outputs = {
+ {
+ .crtc = -1,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 0 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125,
+ .serial = "0x123456a",
+ },
+ {
+ .crtc = -1,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 1 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125,
+ .serial = "0x123456b",
+ },
+ {
+ .crtc = -1,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 2 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125,
+ .serial = "0x123456c",
+ }
+ },
+ .n_outputs = 3,
+ .crtcs = {
+ {
+ .current_mode = 0
+ },
+ {
+ .current_mode = 0
+ },
+ {
+ .current_mode = 0
+ }
+ },
+ .n_crtcs = 3
+ },
+
+ .expect = {
+ .monitors = {
+ {
+ .outputs = { 0 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 1920,
+ .height = 1080,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 0,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125
+ },
+ {
+ .outputs = { 1 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 1920,
+ .height = 1080,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 1,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125
+ },
+ {
+ .outputs = { 2 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 1920,
+ .height = 1080,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 2,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125
+ }
+ },
+ .n_monitors = 3,
+ .logical_monitors = {
+ {
+ .monitors = { 0 },
+ .n_monitors = 1,
+ .layout = { .x = 0, .y = 0, .width = 1080, .height = 1920 },
+ .scale = 1,
+ .transform = MTK_MONITOR_TRANSFORM_270
+ },
+ {
+ .monitors = { 1 },
+ .n_monitors = 1,
+ .layout = { .x = 1080, .y = 0, .width = 960, .height = 540 },
+ .scale = 2
+ },
+ {
+ .monitors = { 2 },
+ .n_monitors = 1,
+ .layout = { .x = 600, .y = 1920, .width = 1920, .height = 1080 },
+ .scale = 1
+ }
+ },
+ .n_logical_monitors = 3,
+ .primary_logical_monitor = 0,
+ .n_outputs = 3,
+ .crtcs = {
+ {
+ .current_mode = 0,
+ .transform = MTK_MONITOR_TRANSFORM_270
+ },
+ {
+ .current_mode = 0,
+ .x = 1080
+ },
+ {
+ .current_mode = 0,
+ .x = 600,
+ .y = 1920
+ }
+ },
+ .n_crtcs = 3,
+ .screen_width = 2520,
+ .screen_height = 3000,
+ }
+ };
+ MetaMonitorTestSetup *test_setup;
+ MetaBackend *backend = meta_context_get_backend (test_context);
+ MetaMonitorManager *monitor_manager =
+ meta_backend_get_monitor_manager (backend);
+ MetaMonitorConfigManager *config_manager = monitor_manager->config_manager;
+ MetaMonitorConfigStore *config_store =
+ meta_monitor_config_manager_get_store (config_manager);
+ g_autofree char *migrated_path = NULL;
+ g_autofree char *old_config_path = NULL;
+ g_autoptr (GFile) old_config_file = NULL;
+ GError *error = NULL;
+ const char *expected_path;
+ g_autofree char *migrated_data = NULL;
+ g_autofree char *expected_data = NULL;
+ g_autoptr (GFile) migrated_file = NULL;
+
+ test_setup = meta_create_monitor_test_setup (test_backend,
+ &test_case.setup,
+ MONITOR_TEST_FLAG_NONE);
+
+ old_config_path = g_test_build_filename (G_TEST_DIST,
+ "tests", "migration",
+ "rotated.xml",
+ NULL);
+
+ migrated_path = g_build_filename (g_get_tmp_dir (),
+ "test-finished-migrated-monitors.xml",
+ NULL);
+
+ if (!meta_monitor_config_store_set_custom (config_store,
+ old_config_path,
+ migrated_path,
+ META_MONITORS_CONFIG_FLAG_NONE,
+ &error))
+ g_error ("Failed to set custom config store files: %s", error->message);
+
+ emulate_hotplug (test_setup);
+
+ META_TEST_LOG_CALL ("Checking monitor configuration",
+ meta_check_monitor_configuration (test_context,
+ &test_case.expect));
+ check_monitor_test_clients_state ();
+
+ expected_path = g_test_get_filename (G_TEST_DIST,
+ "tests", "migration",
+ "rotated-finished.xml",
+ NULL);
+ expected_data = meta_read_file (expected_path);
+ migrated_data = meta_read_file (migrated_path);
+
+ g_assert_nonnull (expected_data);
+ g_assert_nonnull (migrated_data);
+
+ g_assert (strcmp (expected_data, migrated_data) == 0);
+
+ migrated_file = g_file_new_for_path (migrated_path);
+ if (!g_file_delete (migrated_file, NULL, &error))
+ g_error ("Failed to remove test data output file: %s", error->message);
+}
+
+static void
+meta_test_monitor_migrated_horizontal_strip (void)
+{
+ MonitorTestCase test_case = {
+ .setup = {
+ .modes = {
+ {
+ .width = 800,
+ .height = 600,
+ .refresh_rate = 60.0
+ }
+ },
+ .n_modes = 1,
+ .outputs = {
+ {
+ .crtc = -1,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 0 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125,
+ .serial = "0x123456a",
+ },
+ {
+ .crtc = -1,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 1 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125,
+ .serial = "0x123456b",
+ },
+ {
+ .crtc = -1,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 2 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125,
+ .serial = "0x123456c",
+ },
+ {
+ .crtc = -1,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 3 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125,
+ .serial = "0x123456d",
+ }
+ },
+ .n_outputs = 4,
+ .crtcs = {
+ {
+ .current_mode = 0
+ },
+ {
+ .current_mode = 0
+ },
+ {
+ .current_mode = 0
+ },
+ {
+ .current_mode = 0
+ }
+ },
+ .n_crtcs = 4
+ },
+
+ .expect = {
+ .monitors = {
+ {
+ .outputs = { 0 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 800,
+ .height = 600,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 0,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125
+ },
+ {
+ .outputs = { 1 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 800,
+ .height = 600,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 1,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125
+ },
+ {
+ .outputs = { 2 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 800,
+ .height = 600,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 2,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125
+ },
+ {
+ .outputs = { 3 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 800,
+ .height = 600,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 3,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125
+ }
+ },
+ .n_monitors = 4,
+ .logical_monitors = {
+ {
+ .monitors = { 0 },
+ .n_monitors = 1,
+ .layout = { .x = 0, .y = 150, .width = 400, .height = 300 },
+ .scale = 2
+ },
+ {
+ .monitors = { 1 },
+ .n_monitors = 1,
+ .layout = { .x = 400, .y = 0, .width = 800, .height = 600 },
+ .scale = 1
+ },
+ {
+ .monitors = { 2 },
+ .n_monitors = 1,
+ .layout = { .x = 1200, .y = 199, .width = 268, .height = 201 },
+ .scale = 2.985074520111084
+ },
+ {
+ .monitors = { 3 },
+ .n_monitors = 1,
+ .layout = { .x = 1468, .y = 0, .width = 800, .height = 600 },
+ .scale = 1
+ }
+ },
+ .n_logical_monitors = 4,
+ .primary_logical_monitor = 2,
+ .n_outputs = 4,
+ .crtcs = {
+ {
+ .current_mode = 0,
+ .y = 150
+ },
+ {
+ .current_mode = 0,
+ .x = 400
+ },
+ {
+ .current_mode = 0,
+ .x = 1200,
+ .y = 199
+ },
+ {
+ .current_mode = 0,
+ .x = 1468
+ }
+ },
+ .n_crtcs = 4,
+ .screen_width = 2268,
+ .screen_height = 600,
+ }
+ };
+ MetaMonitorTestSetup *test_setup;
+ MetaBackend *backend = meta_context_get_backend (test_context);
+ MetaMonitorManager *monitor_manager =
+ meta_backend_get_monitor_manager (backend);
+ MetaMonitorConfigManager *config_manager = monitor_manager->config_manager;
+ MetaMonitorConfigStore *config_store =
+ meta_monitor_config_manager_get_store (config_manager);
+ g_autofree char *migrated_path = NULL;
+ g_autofree char *old_config_path = NULL;
+ g_autoptr (GFile) old_config_file = NULL;
+ GError *error = NULL;
+ const char *expected_path;
+ g_autofree char *migrated_data = NULL;
+ g_autofree char *expected_data = NULL;
+ g_autoptr (GFile) migrated_file = NULL;
+
+ test_setup = meta_create_monitor_test_setup (test_backend,
+ &test_case.setup,
+ MONITOR_TEST_FLAG_NONE);
+
+ old_config_path = g_test_build_filename (G_TEST_DIST,
+ "tests", "migration",
+ "horizontal-strip.xml",
+ NULL);
+
+ migrated_path = g_build_filename (g_get_tmp_dir (),
+ "test-finished-migrated-monitors.xml",
+ NULL);
+
+ if (!meta_monitor_config_store_set_custom (config_store,
+ old_config_path,
+ migrated_path,
+ META_MONITORS_CONFIG_FLAG_NONE,
+ &error))
+ g_error ("Failed to set custom config store files: %s", error->message);
+
+ emulate_hotplug (test_setup);
+
+ META_TEST_LOG_CALL ("Checking monitor configuration",
+ meta_check_monitor_configuration (test_context,
+ &test_case.expect));
+ check_monitor_test_clients_state ();
+
+ expected_path = g_test_get_filename (G_TEST_DIST,
+ "tests", "migration",
+ "horizontal-strip-finished.xml",
+ NULL);
+ expected_data = meta_read_file (expected_path);
+ migrated_data = meta_read_file (migrated_path);
+
+ g_assert_nonnull (expected_data);
+ g_assert_nonnull (migrated_data);
+
+ g_assert (strcmp (expected_data, migrated_data) == 0);
+
+ migrated_file = g_file_new_for_path (migrated_path);
+ if (!g_file_delete (migrated_file, NULL, &error))
+ g_error ("Failed to remove test data output file: %s", error->message);
+}
+
static void
meta_test_monitor_custom_detached_groups (void)
{
@@ -9660,6 +10172,11 @@ init_monitor_tests (void)
add_monitor_test ("/backends/monitor/custom/detached-groups",
meta_test_monitor_custom_detached_groups);
+ add_monitor_test ("/backends/monitor/migrated/rotated",
+ meta_test_monitor_migrated_rotated);
+ add_monitor_test ("/backends/monitor/migrated/horizontal-strip",
+ meta_test_monitor_migrated_horizontal_strip);
+
add_monitor_test ("/backends/monitor/wm/tiling",
meta_test_monitor_wm_tiling);