2017-06-26 04:31:48 -04:00
|
|
|
/* -*- 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/>.
|
|
|
|
*/
|
|
|
|
|
2021-04-20 12:39:53 -04:00
|
|
|
#ifndef META_TEST_UTILS_H
|
|
|
|
#define META_TEST_UTILS_H
|
2017-06-26 04:31:48 -04:00
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/extensions/sync.h>
|
|
|
|
|
|
|
|
#include "meta/window.h"
|
|
|
|
|
2021-05-06 17:34:36 -04:00
|
|
|
#define META_TEST_CLIENT_ERROR meta_test_client_error_quark ()
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-07-22 14:51:34 -04:00
|
|
|
#define META_TEST_LOG_CALL(description, call) \
|
|
|
|
G_STMT_START { \
|
|
|
|
g_debug ("%s: %s: %s", G_STRFUNC, G_STRLOC, description); \
|
|
|
|
call; \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2021-05-06 17:34:36 -04:00
|
|
|
typedef enum _MetaClientError
|
2017-06-26 04:31:48 -04:00
|
|
|
{
|
2021-05-06 17:34:36 -04:00
|
|
|
META_TEST_CLIENT_ERROR_BAD_COMMAND,
|
|
|
|
META_TEST_CLIENT_ERROR_RUNTIME_ERROR,
|
|
|
|
META_TEST_CLIENT_ERROR_ASSERTION_FAILED
|
|
|
|
} MetaClientError;
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:34:36 -04:00
|
|
|
GQuark meta_test_client_error_quark (void);
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:35:44 -04:00
|
|
|
typedef struct _MetaAsyncWaiter MetaAsyncWaiter;
|
2021-05-06 17:34:36 -04:00
|
|
|
typedef struct _MetaTestClient MetaTestClient;
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:35:44 -04:00
|
|
|
gboolean meta_async_waiter_process_x11_event (MetaAsyncWaiter *waiter,
|
|
|
|
MetaX11Display *display,
|
|
|
|
XSyncAlarmNotifyEvent *event);
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:35:44 -04:00
|
|
|
void meta_async_waiter_set_and_wait (MetaAsyncWaiter *waiter);
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:35:44 -04:00
|
|
|
MetaAsyncWaiter * meta_async_waiter_new (void);
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:35:44 -04:00
|
|
|
void meta_async_waiter_destroy (MetaAsyncWaiter *waiter);
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:34:36 -04:00
|
|
|
char * meta_test_client_get_id (MetaTestClient *client);
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:34:36 -04:00
|
|
|
gboolean meta_test_client_process_x11_event (MetaTestClient *client,
|
|
|
|
MetaX11Display *x11_display,
|
|
|
|
XSyncAlarmNotifyEvent *event);
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:34:36 -04:00
|
|
|
gboolean meta_test_client_wait (MetaTestClient *client,
|
|
|
|
GError **error);
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:34:36 -04:00
|
|
|
gboolean meta_test_client_do (MetaTestClient *client,
|
|
|
|
GError **error,
|
|
|
|
...) G_GNUC_NULL_TERMINATED;
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:34:36 -04:00
|
|
|
MetaWindow * meta_test_client_find_window (MetaTestClient *client,
|
|
|
|
const char *window_id,
|
|
|
|
GError **error);
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:34:36 -04:00
|
|
|
void meta_test_client_wait_for_window_shown (MetaTestClient *client,
|
|
|
|
MetaWindow *window);
|
2019-11-01 08:37:22 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:34:36 -04:00
|
|
|
gboolean meta_test_client_quit (MetaTestClient *client,
|
|
|
|
GError **error);
|
2017-08-18 02:23:42 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-11 03:35:04 -04:00
|
|
|
MetaTestClient * meta_test_client_new (MetaContext *context,
|
|
|
|
const char *id,
|
2021-05-06 17:34:36 -04:00
|
|
|
MetaWindowClientType type,
|
|
|
|
GError **error);
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 17:34:36 -04:00
|
|
|
void meta_test_client_destroy (MetaTestClient *client);
|
2017-06-26 04:31:48 -04:00
|
|
|
|
2021-05-06 17:37:35 -04:00
|
|
|
META_EXPORT
|
2021-05-06 18:47:01 -04:00
|
|
|
const char * meta_test_get_plugin_name (void);
|
2018-07-12 16:20:20 -04:00
|
|
|
|
2021-05-06 17:34:36 -04:00
|
|
|
#endif /* TEST_UTILS_H */
|