[mutter] tests: Add monitor store and config test for output underscanning
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] tests: Add monitor store and config test for output underscanning
- Date: Wed, 25 Jan 2017 08:39:57 +0000 (UTC)
commit e9a82086070314c17a31ed7e922f02bb6da7bb4c
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Jan 17 11:34:23 2017 +0800
tests: Add monitor store and config test for output underscanning
https://bugzilla.gnome.org/show_bug.cgi?id=777732
src/tests/meta-monitor-manager-test.c | 1 +
src/tests/monitor-configs/underscanning.xml | 23 ++++
src/tests/monitor-store-unit-tests.c | 55 ++++++++
src/tests/monitor-unit-tests.c | 184 ++++++++++++++++++++++++++-
4 files changed, 262 insertions(+), 1 deletions(-)
---
diff --git a/src/tests/meta-monitor-manager-test.c b/src/tests/meta-monitor-manager-test.c
index 0ae5fc9..d7b01fa 100644
--- a/src/tests/meta-monitor-manager-test.c
+++ b/src/tests/meta-monitor-manager-test.c
@@ -182,6 +182,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
output->is_primary = output_info->is_primary;
output->is_presentation = output_info->is_presentation;
+ output->is_underscanning = output_info->is_underscanning;
}
/* Disable CRTCs not mentioned in the list */
diff --git a/src/tests/monitor-configs/underscanning.xml b/src/tests/monitor-configs/underscanning.xml
new file mode 100644
index 0000000..7bcd6e7
--- /dev/null
+++ b/src/tests/monitor-configs/underscanning.xml
@@ -0,0 +1,23 @@
+<monitors version="2">
+ <configuration>
+ <logicalmonitor>
+ <x>0</x>
+ <y>0</y>
+ <primary>yes</primary>
+ <monitor>
+ <monitorspec>
+ <connector>DP-1</connector>
+ <vendor>MetaProduct's Inc.</vendor>
+ <product>MetaMonitor</product>
+ <serial>0x123456</serial>
+ </monitorspec>
+ <mode>
+ <width>1024</width>
+ <height>768</height>
+ <rate>60.000495910644531</rate>
+ </mode>
+ <underscanning>yes</underscanning>
+ </monitor>
+ </logicalmonitor>
+ </configuration>
+</monitors>
diff --git a/src/tests/monitor-store-unit-tests.c b/src/tests/monitor-store-unit-tests.c
index 78d1e85..2d48990 100644
--- a/src/tests/monitor-store-unit-tests.c
+++ b/src/tests/monitor-store-unit-tests.c
@@ -176,6 +176,9 @@ check_monitor_configuration (MetaMonitorConfigStore *config_store,
g_assert_cmpfloat (monitor_config->mode_spec->refresh_rate,
==,
test_monitor->mode.refresh_rate);
+ g_assert_cmpint (monitor_config->is_underscanning,
+ ==,
+ test_monitor->is_underscanning);
}
}
}
@@ -394,6 +397,56 @@ meta_test_monitor_store_primary (void)
check_monitor_configurations (&expect);
}
+static void
+meta_test_monitor_store_underscanning (void)
+{
+ MonitorStoreTestExpect expect = {
+ .configurations = {
+ {
+ .logical_monitors = {
+ {
+ .layout = {
+ .x = 0,
+ .y = 0,
+ .width = 1024,
+ .height = 768
+ },
+ .is_primary = TRUE,
+ .is_presentation = FALSE,
+ .monitors = {
+ {
+ .connector = "DP-1",
+ .vendor = "MetaProduct's Inc.",
+ .product = "MetaMonitor",
+ .serial = "0x123456",
+ .is_underscanning = TRUE,
+ .mode = {
+ .width = 1024,
+ .height = 768,
+ .refresh_rate = 60.000495910644531
+ }
+ }
+ },
+ .n_monitors = 1,
+ },
+ },
+ .n_logical_monitors = 1
+ }
+ },
+ .n_configurations = 1
+ };
+
+ if (!is_using_monitor_config_manager ())
+ {
+ g_test_skip ("Not using MetaMonitorConfigManager");
+ return;
+ }
+
+ set_custom_monitor_config ("underscanning.xml");
+
+ check_monitor_configurations (&expect);
+}
+
void
init_monitor_store_tests (void)
{
@@ -403,4 +456,6 @@ init_monitor_store_tests (void)
meta_test_monitor_store_vertical);
g_test_add_func ("/backends/monitor-store/primary",
meta_test_monitor_store_primary);
+ g_test_add_func ("/backends/monitor-store/underscanning",
+ meta_test_monitor_store_underscanning);
}
diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c
index 03db5b6..e666956 100644
--- a/src/tests/monitor-unit-tests.c
+++ b/src/tests/monitor-unit-tests.c
@@ -104,6 +104,7 @@ typedef struct _MonitorTestCaseOutput
MetaTileInfo tile_info;
int scale;
gboolean is_laptop_panel;
+ gboolean is_underscanning;
} MonitorTestCaseOutput;
typedef struct _MonitorTestCaseCrtc
@@ -145,6 +146,7 @@ typedef struct _MonitorTestCaseMonitor
int current_mode;
int width_mm;
int height_mm;
+ gboolean is_underscanning;
} MonitorTestCaseMonitor;
typedef struct _MonitorTestCaseLogicalMonitor
@@ -391,6 +393,9 @@ check_monitor_configuration (MonitorTestCase *test_case)
g_assert (output == output_from_winsys_id (monitor_manager,
winsys_id));
+ g_assert_cmpint (test_case->expect.monitors[i].is_underscanning,
+ ==,
+ output->is_underscanning);
}
meta_monitor_get_physical_dimensions (monitor, &width_mm, &height_mm);
@@ -661,7 +666,8 @@ create_monitor_test_setup (MonitorTestCase *test_case,
.connector_type = (is_laptop_panel ? META_CONNECTOR_TYPE_eDP
: META_CONNECTOR_TYPE_DisplayPort),
.tile_info = test_case->setup.outputs[i].tile_info,
- .scale = scale
+ .scale = scale,
+ .is_underscanning = test_case->setup.outputs[i].is_underscanning
};
}
@@ -1857,6 +1863,88 @@ meta_test_monitor_no_outputs (void)
}
static void
+meta_test_monitor_underscanning_config (void)
+{
+ MonitorTestCase test_case = {
+ .setup = {
+ .modes = {
+ {
+ .width = 1024,
+ .height = 768,
+ .refresh_rate = 60.0
+ }
+ },
+ .n_modes = 1,
+ .outputs = {
+ {
+ .crtc = 0,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 0 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125,
+ .is_underscanning = TRUE,
+ }
+ },
+ .n_outputs = 1,
+ .crtcs = {
+ {
+ .current_mode = 0
+ }
+ },
+ .n_crtcs = 1
+ },
+
+ .expect = {
+ .monitors = {
+ {
+ .outputs = { 0 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 1024,
+ .height = 768,
+ .crtc_modes = {
+ {
+ .output = 0,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125,
+ .is_underscanning = TRUE,
+ }
+ },
+ .n_monitors = 1,
+ .logical_monitors = {
+ {
+ .layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
+ .scale = 1
+ }
+ },
+ .n_logical_monitors = 1,
+ .primary_logical_monitor = 0,
+ .n_outputs = 1,
+ .n_crtcs = 1,
+ .screen_width = 1024,
+ .screen_height = 768
+ }
+ };
+ MetaMonitorTestSetup *test_setup;
+
+ test_setup = create_monitor_test_setup (&test_case,
+ MONITOR_TEST_FLAG_NO_STORED);
+ emulate_hotplug (test_setup);
+ check_monitor_configuration (&test_case);
+}
+
+static void
meta_test_monitor_custom_vertical_config (void)
{
MonitorTestCase test_case = {
@@ -2118,6 +2206,96 @@ meta_test_monitor_custom_primary_config (void)
check_monitor_configuration (&test_case);
}
+static void
+meta_test_monitor_custom_underscanning_config (void)
+{
+ MonitorTestCase test_case = {
+ .setup = {
+ .modes = {
+ {
+ .width = 1024,
+ .height = 768,
+ .refresh_rate = 60.000495910644531
+ }
+ },
+ .n_modes = 1,
+ .outputs = {
+ {
+ .crtc = 0,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 0 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125
+ },
+ },
+ .n_outputs = 1,
+ .crtcs = {
+ {
+ .current_mode = 0
+ },
+ },
+ .n_crtcs = 1
+ },
+
+ .expect = {
+ .monitors = {
+ {
+ .outputs = { 0 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 1024,
+ .height = 768,
+ .crtc_modes = {
+ {
+ .output = 0,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125,
+ .is_underscanning = TRUE,
+ }
+ },
+ .n_monitors = 1,
+ .logical_monitors = {
+ {
+ .layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
+ .scale = 1
+ }
+ },
+ .n_logical_monitors = 1,
+ .primary_logical_monitor = 0,
+ .n_outputs = 1,
+ .n_crtcs = 1,
+ .n_tiled_monitors = 0,
+ .screen_width = 1024,
+ .screen_height = 768
+ }
+ };
+ MetaMonitorTestSetup *test_setup;
+
+ if (!is_using_monitor_config_manager ())
+ {
+ g_test_skip ("Not using MetaMonitorConfigManager");
+ return;
+ }
+
+ test_setup = create_monitor_test_setup (&test_case,
+ MONITOR_TEST_FLAG_NONE);
+ set_custom_monitor_config ("underscanning.xml");
+ emulate_hotplug (test_setup);
+
+ check_monitor_configuration (&test_case);
+}
+
void
init_monitor_tests (void)
{
@@ -2151,9 +2329,13 @@ init_monitor_tests (void)
meta_test_monitor_lid_closed_no_external);
g_test_add_func ("/backends/monitor/no-outputs",
meta_test_monitor_no_outputs);
+ g_test_add_func ("/backends/monitor/underscanning-config",
+ meta_test_monitor_underscanning_config);
g_test_add_func ("/backends/monitor/custom/vertical-config",
meta_test_monitor_custom_vertical_config);
g_test_add_func ("/backends/monitor/custom/primary-config",
meta_test_monitor_custom_primary_config);
+ g_test_add_func ("/backends/monitor/custom/underscanning-config",
+ meta_test_monitor_custom_underscanning_config);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]