mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 08:30:42 -05:00
test/utils: Add helper to set custom monitors config
Make the existing implementation a wrapper to avoid changing monitor config tests. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2237>
This commit is contained in:
parent
1f758dd78c
commit
57d1d82ead
@ -25,6 +25,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <X11/Xlib-xcb.h>
|
#include <X11/Xlib-xcb.h>
|
||||||
|
|
||||||
|
#include "backends/meta-monitor-config-store.h"
|
||||||
#include "core/display-private.h"
|
#include "core/display-private.h"
|
||||||
#include "core/window-private.h"
|
#include "core/window-private.h"
|
||||||
#include "meta-test/meta-context-test.h"
|
#include "meta-test/meta-context-test.h"
|
||||||
@ -591,3 +592,25 @@ meta_test_get_plugin_name (void)
|
|||||||
else
|
else
|
||||||
return "libdefault";
|
return "libdefault";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_set_custom_monitor_config (MetaBackend *backend,
|
||||||
|
const char *filename)
|
||||||
|
{
|
||||||
|
MetaMonitorManager *monitor_manager =
|
||||||
|
meta_backend_get_monitor_manager (backend);
|
||||||
|
MetaMonitorConfigManager *config_manager = monitor_manager->config_manager;
|
||||||
|
MetaMonitorConfigStore *config_store;
|
||||||
|
GError *error = NULL;
|
||||||
|
const char *path;
|
||||||
|
|
||||||
|
g_assert_nonnull (config_manager);
|
||||||
|
|
||||||
|
config_store = meta_monitor_config_manager_get_store (config_manager);
|
||||||
|
|
||||||
|
path = g_test_get_filename (G_TEST_DIST, "tests", "monitor-configs",
|
||||||
|
filename, NULL);
|
||||||
|
if (!meta_monitor_config_store_set_custom (config_store, path, NULL,
|
||||||
|
&error))
|
||||||
|
g_error ("Failed to set custom config: %s", error->message);
|
||||||
|
}
|
||||||
|
@ -108,4 +108,8 @@ void meta_test_client_destroy (MetaTestClient *client);
|
|||||||
META_EXPORT
|
META_EXPORT
|
||||||
const char * meta_test_get_plugin_name (void);
|
const char * meta_test_get_plugin_name (void);
|
||||||
|
|
||||||
|
META_EXPORT
|
||||||
|
void meta_set_custom_monitor_config (MetaBackend *backend,
|
||||||
|
const char *filename);
|
||||||
|
|
||||||
#endif /* TEST_UTILS_H */
|
#endif /* TEST_UTILS_H */
|
||||||
|
@ -41,23 +41,7 @@ test_get_gpu (void)
|
|||||||
void
|
void
|
||||||
set_custom_monitor_config (const char *filename)
|
set_custom_monitor_config (const char *filename)
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_get_backend ();
|
meta_set_custom_monitor_config (meta_get_backend (), filename);
|
||||||
MetaMonitorManager *monitor_manager =
|
|
||||||
meta_backend_get_monitor_manager (backend);
|
|
||||||
MetaMonitorConfigManager *config_manager = monitor_manager->config_manager;
|
|
||||||
MetaMonitorConfigStore *config_store;
|
|
||||||
GError *error = NULL;
|
|
||||||
const char *path;
|
|
||||||
|
|
||||||
g_assert_nonnull (config_manager);
|
|
||||||
|
|
||||||
config_store = meta_monitor_config_manager_get_store (config_manager);
|
|
||||||
|
|
||||||
path = g_test_get_filename (G_TEST_DIST, "tests", "monitor-configs",
|
|
||||||
filename, NULL);
|
|
||||||
if (!meta_monitor_config_store_set_custom (config_store, path, NULL,
|
|
||||||
&error))
|
|
||||||
g_error ("Failed to set custom config: %s", error->message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
Loading…
Reference in New Issue
Block a user