Remove monitor migration support from v1 monitors.xml format

We'll introduce some new migration code with the next few commits to introduce
a layout_mode property in monitors.xml. This will be significantly easier
without keeping around the old monitor migration code, so drop it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
This commit is contained in:
Jonas Dreßler
2024-02-15 23:33:12 +01:00
committed by Marge Bot
parent 4105827254
commit de56634fd0
27 changed files with 10 additions and 1298 deletions

View File

@ -247,8 +247,6 @@ test_cases += [
'unit-tests.c',
'boxes-tests.c',
'boxes-tests.h',
'monitor-config-migration-unit-tests.c',
'monitor-config-migration-unit-tests.h',
'monitor-store-unit-tests.c',
'monitor-store-unit-tests.h',
'monitor-transform-tests.c',

View File

@ -1,78 +0,0 @@
<monitors version="2">
<configuration>
<migrated/>
<logicalmonitor>
<x>0</x>
<y>0</y>
<monitor>
<monitorspec>
<connector>HDMI-1</connector>
<vendor>DEL</vendor>
<product>DELL P2415Q</product>
<serial>GTTPW67P0WFB</serial>
</monitorspec>
<mode>
<width>3840</width>
<height>2160</height>
<rate>29.981</rate>
</mode>
</monitor>
</logicalmonitor>
<logicalmonitor>
<x>3840</x>
<y>0</y>
<primary>yes</primary>
<monitor>
<monitorspec>
<connector>eDP-1</connector>
<vendor>AUO</vendor>
<product>0x123d</product>
<serial>0x00000000</serial>
</monitorspec>
<mode>
<width>1920</width>
<height>1080</height>
<rate>60.050</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
<configuration>
<migrated/>
<logicalmonitor>
<x>1920</x>
<y>0</y>
<monitor>
<monitorspec>
<connector>DP-2</connector>
<vendor>ACI</vendor>
<product>VX239</product>
<serial>ECLMRS004144</serial>
</monitorspec>
<mode>
<width>1920</width>
<height>1080</height>
<rate>60.000</rate>
</mode>
</monitor>
</logicalmonitor>
<logicalmonitor>
<x>0</x>
<y>0</y>
<primary>yes</primary>
<monitor>
<monitorspec>
<connector>eDP-1</connector>
<vendor>AUO</vendor>
<product>0x123d</product>
<serial>0x00000000</serial>
</monitorspec>
<mode>
<width>1920</width>
<height>1080</height>
<rate>60.049</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
</monitors>

View File

@ -1,72 +0,0 @@
<monitors version="1">
<configuration>
<clone>no</clone>
<output name="HDMI-1">
<vendor>DEL</vendor>
<product>DELL P2415Q</product>
<serial>GTTPW67P0WFB</serial>
<width>3840</width>
<height>2160</height>
<rate>29.981103897094727</rate>
<x>0</x>
<y>0</y>
<rotation>normal</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>no</primary>
<presentation>no</presentation>
<underscanning>no</underscanning>
</output>
<output name="eDP-1">
<vendor>AUO</vendor>
<product>0x123d</product>
<serial>0x00000000</serial>
<width>1920</width>
<height>1080</height>
<rate>60.049972534179688</rate>
<x>3840</x>
<y>0</y>
<rotation>normal</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>yes</primary>
<presentation>no</presentation>
<underscanning>no</underscanning>
</output>
</configuration>
<configuration>
<clone>no</clone>
<output name="DP-2">
<vendor>ACI</vendor>
<product>VX239</product>
<serial>ECLMRS004144</serial>
<width>1920</width>
<height>1080</height>
<rate>60</rate>
<x>1920</x>
<y>0</y>
<rotation>normal</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>no</primary>
<presentation>no</presentation>
<underscanning>no</underscanning>
</output>
<output name="eDP-1">
<vendor>AUO</vendor>
<product>0x123d</product>
<serial>0x00000000</serial>
<width>1920</width>
<height>1080</height>
<rate>60.049468994140625</rate>
<x>0</x>
<y>0</y>
<rotation>normal</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>yes</primary>
<presentation>no</presentation>
<underscanning>no</underscanning>
</output>
</configuration>
</monitors>

View File

@ -1,44 +0,0 @@
<monitors version="2">
<configuration>
<migrated/>
<logicalmonitor>
<x>0</x>
<y>0</y>
<transform>
<rotation>left</rotation>
<flipped>no</flipped>
</transform>
<monitor>
<monitorspec>
<connector>HDMI-1</connector>
<vendor>DEL</vendor>
<product>DELL P2415Q</product>
<serial>GTTPW67P0WFB</serial>
</monitorspec>
<mode>
<width>3840</width>
<height>2160</height>
<rate>29.981</rate>
</mode>
</monitor>
</logicalmonitor>
<logicalmonitor>
<x>2160</x>
<y>0</y>
<primary>yes</primary>
<monitor>
<monitorspec>
<connector>eDP-1</connector>
<vendor>AUO</vendor>
<product>0x123d</product>
<serial>0x00000000</serial>
</monitorspec>
<mode>
<width>1920</width>
<height>1080</height>
<rate>60.050</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
</monitors>

View File

@ -1,37 +0,0 @@
<monitors version="1">
<configuration>
<clone>no</clone>
<output name="HDMI-1">
<vendor>DEL</vendor>
<product>DELL P2415Q</product>
<serial>GTTPW67P0WFB</serial>
<width>2160</width>
<height>3840</height>
<rate>29.981103897094727</rate>
<x>0</x>
<y>0</y>
<rotation>left</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>no</primary>
<presentation>no</presentation>
<underscanning>no</underscanning>
</output>
<output name="eDP-1">
<vendor>AUO</vendor>
<product>0x123d</product>
<serial>0x00000000</serial>
<width>1920</width>
<height>1080</height>
<rate>60.049972534179688</rate>
<x>2160</x>
<y>0</y>
<rotation>normal</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>yes</primary>
<presentation>no</presentation>
<underscanning>no</underscanning>
</output>
</configuration>
</monitors>

View File

@ -1,31 +0,0 @@
<monitors version="2">
<configuration>
<logicalmonitor>
<x>0</x>
<y>0</y>
<scale>1</scale>
<primary>yes</primary>
<monitor>
<monitorspec>
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
</monitorspec>
<mode>
<width>800</width>
<height>600</height>
<rate>60</rate>
</mode>
</monitor>
</logicalmonitor>
<disabled>
<monitorspec>
<connector>DP-2</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x654321</serial>
</monitorspec>
</disabled>
</configuration>
</monitors>

View File

@ -1,31 +0,0 @@
<monitors version="2">
<configuration>
<migrated/>
<logicalmonitor>
<x>0</x>
<y>0</y>
<primary>yes</primary>
<monitor>
<monitorspec>
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
</monitorspec>
<mode>
<width>800</width>
<height>600</height>
<rate>60.000</rate>
</mode>
</monitor>
</logicalmonitor>
<disabled>
<monitorspec>
<connector>DP-2</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x654321</serial>
</monitorspec>
</disabled>
</configuration>
</monitors>

View File

@ -1,26 +0,0 @@
<monitors version="1">
<configuration>
<clone>no</clone>
<output name="DP-1">
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<width>800</width>
<height>600</height>
<rate>60</rate>
<x>0</x>
<y>0</y>
<rotation>normal</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>yes</primary>
<presentation>no</presentation>
<underscanning>no</underscanning>
</output>
<output name="DP-2">
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x654321</serial>
</output>
</configuration>
</monitors>

View File

@ -1,27 +0,0 @@
<monitors version="2">
<configuration>
<logicalmonitor>
<x>0</x>
<y>0</y>
<scale>1</scale>
<primary>yes</primary>
<transform>
<rotation>right</rotation>
<flipped>no</flipped>
</transform>
<monitor>
<monitorspec>
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
</monitorspec>
<mode>
<width>800</width>
<height>600</height>
<rate>60.000</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
</monitors>

View File

@ -1,27 +0,0 @@
<monitors version="2">
<configuration>
<migrated/>
<logicalmonitor>
<x>0</x>
<y>0</y>
<primary>yes</primary>
<transform>
<rotation>right</rotation>
<flipped>no</flipped>
</transform>
<monitor>
<monitorspec>
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
</monitorspec>
<mode>
<width>800</width>
<height>600</height>
<rate>60.000</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
</monitors>

View File

@ -1,21 +0,0 @@
<monitors version="1">
<configuration>
<clone>no</clone>
<output name="DP-1">
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<width>600</width>
<height>800</height>
<rate>60</rate>
<x>0</x>
<y>0</y>
<rotation>right</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>yes</primary>
<presentation>no</presentation>
<underscanning>no</underscanning>
</output>
</configuration>
</monitors>

View File

@ -1,23 +0,0 @@
<monitors version="2">
<configuration>
<migrated/>
<logicalmonitor>
<x>0</x>
<y>0</y>
<primary>yes</primary>
<monitor>
<monitorspec>
<connector>DP-1</connector>
<vendor>DEL</vendor>
<product>DELL P2415Q</product>
<serial>GTTPW67P0WFB</serial>
</monitorspec>
<mode>
<width>3840</width>
<height>2160</height>
<rate>60.000</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
</monitors>

View File

@ -1,37 +0,0 @@
<monitors version="1">
<configuration>
<clone>no</clone>
<output name="DP-1">
<vendor>DEL</vendor>
<product>DELL P2415Q</product>
<serial>GTTPW67P0WFB</serial>
<width>1920</width>
<height>2160</height>
<rate>60</rate>
<x>0</x>
<y>0</y>
<rotation>normal</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>yes</primary>
<presentation>no</presentation>
<underscanning>no</underscanning>
</output>
<output name="DP-2">
<vendor>DEL</vendor>
<product>DELL P2415Q</product>
<serial>GTTPW67P0WFB</serial>
<width>1920</width>
<height>2160</height>
<rate>60</rate>
<x>1920</x>
<y>0</y>
<rotation>normal</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>yes</primary>
<presentation>no</presentation>
<underscanning>no</underscanning>
</output>
</configuration>
</monitors>

View File

@ -1,2 +0,0 @@
<monitors version="2">
</monitors>

View File

@ -1,27 +0,0 @@
<monitors version="2">
<configuration>
<logicalmonitor>
<x>0</x>
<y>0</y>
<scale>1</scale>
<primary>yes</primary>
<transform>
<rotation>left</rotation>
<flipped>no</flipped>
</transform>
<monitor>
<monitorspec>
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
</monitorspec>
<mode>
<width>800</width>
<height>600</height>
<rate>60.001</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
</monitors>

View File

@ -1,27 +0,0 @@
<monitors version="2">
<configuration>
<migrated/>
<logicalmonitor>
<x>0</x>
<y>0</y>
<primary>yes</primary>
<transform>
<rotation>left</rotation>
<flipped>no</flipped>
</transform>
<monitor>
<monitorspec>
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
</monitorspec>
<mode>
<width>800</width>
<height>600</height>
<rate>60.001</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
</monitors>

View File

@ -1,21 +0,0 @@
<monitors version="1">
<configuration>
<clone>no</clone>
<output name="DP-1">
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<width>600</width>
<height>800</height>
<rate>60.000801086425781</rate>
<x>0</x>
<y>0</y>
<rotation>left</rotation>
<reflect_x>no</reflect_x>
<reflect_y>no</reflect_y>
<primary>yes</primary>
<presentation>no</presentation>
<underscanning>no</underscanning>
</output>
</configuration>
</monitors>

View File

@ -1,138 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2017 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "tests/monitor-config-migration-unit-tests.h"
#include <glib.h>
#include <gio/gio.h>
#include "backends/meta-backend-private.h"
#include "backends/meta-monitor-config-manager.h"
#include "backends/meta-monitor-config-store.h"
#include "backends/meta-monitor-manager-private.h"
#include "backends/meta-monitor-config-migration.h"
#include "tests/meta-monitor-test-utils.h"
#include "tests/unit-tests.h"
static void
test_migration (const char *old_config,
const char *new_config)
{
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);
GError *error = NULL;
const char *old_config_path;
g_autoptr (GFile) old_config_file = NULL;
g_autofree char *migrated_path = NULL;
const char *expected_path;
g_autofree char *migrated_data = NULL;
g_autofree char *expected_data = NULL;
g_autoptr (GFile) migrated_file = NULL;
migrated_path = g_build_filename (g_get_tmp_dir (),
"test-migrated-monitors.xml",
NULL);
if (!meta_monitor_config_store_set_custom (config_store, "/dev/null",
migrated_path,
META_MONITORS_CONFIG_FLAG_NONE,
&error))
g_error ("Failed to set custom config store: %s", error->message);
old_config_path = g_test_get_filename (G_TEST_DIST, "tests", "migration",
old_config, NULL);
old_config_file = g_file_new_for_path (old_config_path);
if (!meta_migrate_old_monitors_config (config_store,
old_config_file,
&error))
g_error ("Failed to migrate config: %s", error->message);
expected_path = g_test_get_filename (G_TEST_DIST, "tests", "migration",
new_config, 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_cmpstr (expected_data, ==, migrated_data);
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_config_migration_basic (void)
{
test_migration ("basic-old.xml", "basic-new.xml");
}
static void
meta_test_monitor_config_migration_rotated (void)
{
test_migration ("rotated-old.xml", "rotated-new.xml");
}
static void
meta_test_monitor_config_migration_tiled (void)
{
test_migration ("tiled-old.xml", "tiled-new.xml");
}
static void
meta_test_monitor_config_migration_first_rotated (void)
{
test_migration ("first-rotated-old.xml", "first-rotated-new.xml");
}
static void
meta_test_monitor_config_migration_oneoff (void)
{
test_migration ("oneoff-old.xml", "oneoff-new.xml");
}
static void
meta_test_monitor_config_migration_wiggle (void)
{
test_migration ("wiggle-old.xml", "wiggle-new.xml");
}
void
init_monitor_config_migration_tests (void)
{
g_test_add_func ("/backends/monitor-config-migration/basic",
meta_test_monitor_config_migration_basic);
g_test_add_func ("/backends/monitor-config-migration/rotated",
meta_test_monitor_config_migration_rotated);
g_test_add_func ("/backends/monitor-config-migration/tiled",
meta_test_monitor_config_migration_tiled);
g_test_add_func ("/backends/monitor-config-migration/first-rotated",
meta_test_monitor_config_migration_first_rotated);
g_test_add_func ("/backends/monitor-config-migration/oneoff",
meta_test_monitor_config_migration_oneoff);
g_test_add_func ("/backends/monitor-config-migration/wiggle",
meta_test_monitor_config_migration_wiggle);
}

View File

@ -1,22 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2017 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
void init_monitor_config_migration_tests (void);

View File

@ -23,7 +23,6 @@
#include "backends/meta-crtc.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor.h"
#include "backends/meta-monitor-config-migration.h"
#include "backends/meta-monitor-config-store.h"
#include "backends/meta-output.h"
#include "core/window-private.h"
@ -8418,303 +8417,6 @@ 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 = 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 = "0x123456",
}
},
.n_outputs = 1,
.crtcs = {
{
.current_mode = -1
}
},
.n_crtcs = 1
},
.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
}
},
.n_monitors = 1,
.logical_monitors = {
{
.monitors = { 0 },
.n_monitors = 1,
.layout = { .x = 0, .y = 0, .width = 600, .height = 800 },
.scale = 1,
.transform = MTK_MONITOR_TRANSFORM_270
},
},
.n_logical_monitors = 1,
.primary_logical_monitor = 0,
.n_outputs = 1,
.crtcs = {
{
.current_mode = 0,
.transform = MTK_MONITOR_TRANSFORM_270
}
},
.n_crtcs = 1,
.screen_width = 600,
.screen_height = 800,
}
};
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;
const char *old_config_path;
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);
migrated_path = g_build_filename (g_get_tmp_dir (),
"test-finished-migrated-monitors.xml",
NULL);
if (!meta_monitor_config_store_set_custom (config_store,
"/dev/null",
migrated_path,
META_MONITORS_CONFIG_FLAG_NONE,
&error))
g_error ("Failed to set custom config store files: %s", error->message);
old_config_path = g_test_get_filename (G_TEST_DIST,
"tests", "migration",
"rotated-old.xml",
NULL);
old_config_file = g_file_new_for_path (old_config_path);
if (!meta_migrate_old_monitors_config (config_store,
old_config_file,
&error))
g_error ("Failed to migrate config: %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-new-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_wiggle_discard (void)
{
MonitorTestCase test_case = {
.setup = {
.modes = {
{
.width = 800,
.height = 600,
.refresh_rate = 59.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 = "0x123456",
}
},
.n_outputs = 1,
.crtcs = {
{
.current_mode = -1
}
},
.n_crtcs = 1
},
.expect = {
.monitors = {
{
.outputs = { 0 },
.n_outputs = 1,
.modes = {
{
.width = 800,
.height = 600,
.refresh_rate = 59.0,
.crtc_modes = {
{
.output = 0,
.crtc_mode = 0
}
}
}
},
.n_modes = 1,
.current_mode = 0,
.width_mm = 222,
.height_mm = 125
}
},
.n_monitors = 1,
.logical_monitors = {
{
.monitors = { 0 },
.n_monitors = 1,
.layout = { .x = 0, .y = 0, .width = 800, .height = 600 },
.scale = 1,
.transform = MTK_MONITOR_TRANSFORM_NORMAL
},
},
.n_logical_monitors = 1,
.primary_logical_monitor = 0,
.n_outputs = 1,
.crtcs = {
{
.current_mode = 0,
}
},
.n_crtcs = 1,
.screen_width = 800,
.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;
const char *old_config_path;
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);
migrated_path = g_build_filename (g_get_tmp_dir (),
"test-finished-migrated-monitors.xml",
NULL);
if (!meta_monitor_config_store_set_custom (config_store,
"/dev/null",
migrated_path,
META_MONITORS_CONFIG_FLAG_NONE,
&error))
g_error ("Failed to set custom config store files: %s", error->message);
old_config_path = g_test_get_filename (G_TEST_DIST,
"tests", "migration",
"wiggle-old.xml",
NULL);
old_config_file = g_file_new_for_path (old_config_path);
if (!meta_migrate_old_monitors_config (config_store,
old_config_file,
&error))
g_error ("Failed to migrate config: %s", error->message);
g_test_expect_message ("libmutter", G_LOG_LEVEL_WARNING,
"Failed to finish monitors config migration: "
"Mode not available on monitor");
emulate_hotplug (test_setup);
g_test_assert_expected_messages ();
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",
"wiggle-new-discarded.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)
{
@ -8868,153 +8570,6 @@ meta_test_monitor_wm_tiling (void)
meta_test_client_destroy (test_client);
}
static void
meta_test_monitor_migrated_wiggle (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 = "0x123456",
}
},
.n_outputs = 1,
.crtcs = {
{
.current_mode = -1
}
},
.n_crtcs = 1
},
.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
}
},
.n_monitors = 1,
.logical_monitors = {
{
.monitors = { 0 },
.n_monitors = 1,
.layout = { .x = 0, .y = 0, .width = 600, .height = 800 },
.scale = 1,
.transform = MTK_MONITOR_TRANSFORM_90
},
},
.n_logical_monitors = 1,
.primary_logical_monitor = 0,
.n_outputs = 1,
.crtcs = {
{
.current_mode = 0,
.transform = MTK_MONITOR_TRANSFORM_90
}
},
.n_crtcs = 1,
.screen_width = 600,
.screen_height = 800,
}
};
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;
const char *old_config_path;
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);
migrated_path = g_build_filename (g_get_tmp_dir (),
"test-finished-migrated-monitors.xml",
NULL);
if (!meta_monitor_config_store_set_custom (config_store,
"/dev/null",
migrated_path,
META_MONITORS_CONFIG_FLAG_NONE,
&error))
g_error ("Failed to set custom config store files: %s", error->message);
old_config_path = g_test_get_filename (G_TEST_DIST,
"tests", "migration",
"wiggle-old.xml",
NULL);
old_config_file = g_file_new_for_path (old_config_path);
if (!meta_migrate_old_monitors_config (config_store,
old_config_file,
&error))
g_error ("Failed to migrate config: %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",
"wiggle-new-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_supported_integer_scales (void)
{
@ -10105,13 +9660,6 @@ 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/wiggle",
meta_test_monitor_migrated_wiggle);
add_monitor_test ("/backends/monitor/migrated/wiggle-discard",
meta_test_monitor_migrated_wiggle_discard);
add_monitor_test ("/backends/monitor/wm/tiling",
meta_test_monitor_wm_tiling);

View File

@ -33,7 +33,6 @@
#include "meta/compositor.h"
#include "meta/meta-context.h"
#include "tests/boxes-tests.h"
#include "tests/monitor-config-migration-unit-tests.h"
#include "tests/monitor-store-unit-tests.h"
#include "tests/monitor-transform-tests.h"
#include "tests/meta-test-utils.h"
@ -208,7 +207,6 @@ init_tests (void)
meta_test_util_later_schedule_from_later);
init_monitor_store_tests ();
init_monitor_config_migration_tests ();
init_boxes_tests ();
init_monitor_transform_tests ();
init_orientation_manager_tests ();