mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
tests/monitor-unit-tests: Set initial state during backend construction
This way we can construct CRTCs and Outputs and associated them with the fake GPUs at construction. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
This commit is contained in:
parent
569a183828
commit
2724f36527
@ -184,10 +184,7 @@ create_headless_test_setup (void)
|
|||||||
static void
|
static void
|
||||||
init_tests (int argc, char **argv)
|
init_tests (int argc, char **argv)
|
||||||
{
|
{
|
||||||
MetaMonitorTestSetup *initial_test_setup;
|
meta_monitor_manager_test_init_test_setup (create_headless_test_setup);
|
||||||
|
|
||||||
initial_test_setup = create_headless_test_setup ();
|
|
||||||
meta_monitor_manager_test_init_test_setup (initial_test_setup);
|
|
||||||
|
|
||||||
g_test_add_func ("/headless-start/start", meta_test_headless_start);
|
g_test_add_func ("/headless-start/start", meta_test_headless_start);
|
||||||
g_test_add_func ("/headless-start/monitor-getters",
|
g_test_add_func ("/headless-start/monitor-getters",
|
||||||
|
@ -42,12 +42,12 @@ struct _MetaMonitorManagerTest
|
|||||||
G_DEFINE_TYPE (MetaMonitorManagerTest, meta_monitor_manager_test,
|
G_DEFINE_TYPE (MetaMonitorManagerTest, meta_monitor_manager_test,
|
||||||
META_TYPE_MONITOR_MANAGER)
|
META_TYPE_MONITOR_MANAGER)
|
||||||
|
|
||||||
static MetaMonitorTestSetup *_initial_test_setup = NULL;
|
static CreateTestSetupFunc initial_setup_func;
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_monitor_manager_test_init_test_setup (MetaMonitorTestSetup *test_setup)
|
meta_monitor_manager_test_init_test_setup (CreateTestSetupFunc func)
|
||||||
{
|
{
|
||||||
_initial_test_setup = test_setup;
|
initial_setup_func = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -409,16 +409,24 @@ meta_monitor_manager_test_dispose (GObject *object)
|
|||||||
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (object);
|
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (object);
|
||||||
|
|
||||||
g_clear_pointer (&manager_test->test_setup, g_free);
|
g_clear_pointer (&manager_test->test_setup, g_free);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (meta_monitor_manager_test_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_monitor_manager_test_constructed (GObject *object)
|
||||||
|
{
|
||||||
|
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (object);
|
||||||
|
|
||||||
|
manager_test->test_setup = initial_setup_func ();
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (meta_monitor_manager_test_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_test_init (MetaMonitorManagerTest *manager_test)
|
meta_monitor_manager_test_init (MetaMonitorManagerTest *manager_test)
|
||||||
{
|
{
|
||||||
g_assert (_initial_test_setup);
|
|
||||||
|
|
||||||
manager_test->handles_transforms = TRUE;
|
manager_test->handles_transforms = TRUE;
|
||||||
|
|
||||||
manager_test->test_setup = _initial_test_setup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -428,6 +436,7 @@ meta_monitor_manager_test_class_init (MetaMonitorManagerTestClass *klass)
|
|||||||
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_CLASS (klass);
|
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_CLASS (klass);
|
||||||
|
|
||||||
object_class->dispose = meta_monitor_manager_test_dispose;
|
object_class->dispose = meta_monitor_manager_test_dispose;
|
||||||
|
object_class->constructed = meta_monitor_manager_test_constructed;
|
||||||
|
|
||||||
manager_class->ensure_initial_config = meta_monitor_manager_test_ensure_initial_config;
|
manager_class->ensure_initial_config = meta_monitor_manager_test_ensure_initial_config;
|
||||||
manager_class->apply_monitors_config = meta_monitor_manager_test_apply_monitors_config;
|
manager_class->apply_monitors_config = meta_monitor_manager_test_apply_monitors_config;
|
||||||
|
@ -34,11 +34,13 @@ typedef struct _MetaOutputTest
|
|||||||
float scale;
|
float scale;
|
||||||
} MetaOutputTest;
|
} MetaOutputTest;
|
||||||
|
|
||||||
|
typedef MetaMonitorTestSetup * (* CreateTestSetupFunc) (void);
|
||||||
|
|
||||||
#define META_TYPE_MONITOR_MANAGER_TEST (meta_monitor_manager_test_get_type ())
|
#define META_TYPE_MONITOR_MANAGER_TEST (meta_monitor_manager_test_get_type ())
|
||||||
G_DECLARE_FINAL_TYPE (MetaMonitorManagerTest, meta_monitor_manager_test,
|
G_DECLARE_FINAL_TYPE (MetaMonitorManagerTest, meta_monitor_manager_test,
|
||||||
META, MONITOR_MANAGER_TEST, MetaMonitorManager)
|
META, MONITOR_MANAGER_TEST, MetaMonitorManager)
|
||||||
|
|
||||||
void meta_monitor_manager_test_init_test_setup (MetaMonitorTestSetup *test_setup);
|
void meta_monitor_manager_test_init_test_setup (CreateTestSetupFunc func);
|
||||||
|
|
||||||
void meta_monitor_manager_test_read_current (MetaMonitorManager *manager);
|
void meta_monitor_manager_test_read_current (MetaMonitorManager *manager);
|
||||||
|
|
||||||
|
@ -185,11 +185,11 @@ typedef struct _MonitorTestCaseExpect
|
|||||||
int screen_height;
|
int screen_height;
|
||||||
} MonitorTestCaseExpect;
|
} MonitorTestCaseExpect;
|
||||||
|
|
||||||
typedef struct _MonitorTestCase
|
struct _MonitorTestCase
|
||||||
{
|
{
|
||||||
MonitorTestCaseSetup setup;
|
MonitorTestCaseSetup setup;
|
||||||
MonitorTestCaseExpect expect;
|
MonitorTestCaseExpect expect;
|
||||||
} MonitorTestCase;
|
};
|
||||||
|
|
||||||
void set_custom_monitor_config (const char *filename);
|
void set_custom_monitor_config (const char *filename);
|
||||||
|
|
||||||
|
@ -5614,14 +5614,17 @@ add_monitor_test (const char *test_path,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static MetaMonitorTestSetup *
|
||||||
|
create_initial_test_setup (void)
|
||||||
|
{
|
||||||
|
return create_monitor_test_setup (&initial_test_case.setup,
|
||||||
|
MONITOR_TEST_FLAG_NO_STORED);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
init_monitor_tests (void)
|
init_monitor_tests (void)
|
||||||
{
|
{
|
||||||
MetaMonitorTestSetup *initial_test_setup;
|
meta_monitor_manager_test_init_test_setup (create_initial_test_setup);
|
||||||
|
|
||||||
initial_test_setup = create_monitor_test_setup (&initial_test_case.setup,
|
|
||||||
MONITOR_TEST_FLAG_NO_STORED);
|
|
||||||
meta_monitor_manager_test_init_test_setup (initial_test_setup);
|
|
||||||
|
|
||||||
add_monitor_test ("/backends/monitor/initial-linear-config",
|
add_monitor_test ("/backends/monitor/initial-linear-config",
|
||||||
meta_test_monitor_initial_linear_config);
|
meta_test_monitor_initial_linear_config);
|
||||||
|
@ -20,10 +20,17 @@
|
|||||||
#ifndef MONITOR_UNIT_TESTS_H
|
#ifndef MONITOR_UNIT_TESTS_H
|
||||||
#define MONITOR_UNIT_TESTS_H
|
#define MONITOR_UNIT_TESTS_H
|
||||||
|
|
||||||
|
#include "core/util-private.h"
|
||||||
|
#include "tests/monitor-test-utils.h"
|
||||||
|
|
||||||
|
typedef struct _MonitorTestCase MonitorTestCase;
|
||||||
|
|
||||||
void init_monitor_tests (void);
|
void init_monitor_tests (void);
|
||||||
|
|
||||||
void pre_run_monitor_tests (void);
|
void pre_run_monitor_tests (void);
|
||||||
|
|
||||||
void finish_monitor_tests (void);
|
void finish_monitor_tests (void);
|
||||||
|
|
||||||
|
MonitorTestCase * test_get_initial_monitor_test_case (void);
|
||||||
|
|
||||||
#endif /* MONITOR_UNIT_TESTS_H */
|
#endif /* MONITOR_UNIT_TESTS_H */
|
||||||
|
@ -462,15 +462,17 @@ meta_test_actor_stage_views_hide_parent (void)
|
|||||||
clutter_actor_destroy (outer_container);
|
clutter_actor_destroy (outer_container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static MetaMonitorTestSetup *
|
||||||
|
create_stage_view_test_setup (void)
|
||||||
|
{
|
||||||
|
return create_monitor_test_setup (&initial_test_case_setup,
|
||||||
|
MONITOR_TEST_FLAG_NO_STORED);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_tests (int argc, char **argv)
|
init_tests (int argc, char **argv)
|
||||||
{
|
{
|
||||||
MetaMonitorTestSetup *test_setup;
|
meta_monitor_manager_test_init_test_setup (create_stage_view_test_setup);
|
||||||
|
|
||||||
test_setup = create_monitor_test_setup (&initial_test_case_setup,
|
|
||||||
MONITOR_TEST_FLAG_NO_STORED);
|
|
||||||
|
|
||||||
meta_monitor_manager_test_init_test_setup (test_setup);
|
|
||||||
|
|
||||||
g_test_add_func ("/stage-view/stage-views-exist",
|
g_test_add_func ("/stage-view/stage-views-exist",
|
||||||
meta_test_stage_views_exist);
|
meta_test_stage_views_exist);
|
||||||
|
Loading…
Reference in New Issue
Block a user