tests: Use special purpose backend in unit tests

Use a special purpose backend when running the unit tests. This will
eventually allow testing things like configuration and hot plugging.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl
2016-12-05 18:38:43 +08:00
parent d188949101
commit a251675cc0
6 changed files with 342 additions and 14 deletions

View File

@ -17,6 +17,8 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <glib.h>
#include <stdlib.h>
@ -24,6 +26,8 @@
#include <meta/util.h>
#include "compositor/meta-plugin-manager.h"
#include "core/main-private.h"
#include "tests/meta-backend-test.h"
typedef struct _MetaTestLaterOrderCallbackData
{
@ -213,21 +217,11 @@ main (int argc, char *argv[])
g_option_context_free (ctx);
const char *fake_args[] = { NULL, "--wayland", "--nested" };
fake_args[0] = argv[0];
char **fake_argv = (char**)fake_args;
int fake_argc = G_N_ELEMENTS (fake_args);
ctx = meta_get_option_context ();
if (!g_option_context_parse (ctx, &fake_argc, &fake_argv, &error))
{
g_printerr ("mutter: %s\n", error->message);
exit (1);
}
g_option_context_free (ctx);
meta_plugin_manager_load ("default");
meta_override_compositor_configuration (META_COMPOSITOR_TYPE_WAYLAND,
META_TYPE_BACKEND_TEST);
meta_init ();
meta_register_with_session ();