![]() |
![]() |
![]() |
Evolution-Data-Server Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#define E_TEST_SERVER_UTILS_SERVICE (fixture, service_type) void (*ETestSourceCustomizeFunc) (ESource *scratch
,ETestServerClosure *closure
); enum ETestServiceType; struct ETestServerClosure; ETestService; struct ETestServerFixture; enum ETestServerFlags; void e_test_server_utils_setup (ETestServerFixture *fixture
,gconstpointer user_data
); void e_test_server_utils_teardown (ETestServerFixture *fixture
,gconstpointer user_data
); gint e_test_server_utils_run (void
); gint e_test_server_utils_run_full (ETestServerFlags flags
);
This test fixture provides an encapsulated testing environment for test cases to test EBookClient and ECalClient.
The ETestServerFixture should be used as a fixture and must be coupled with the ETestServerClosure to configure how the test fixture will operate.
Both the ETestServerFixture and ETestServerClosure can be extended with
more complex test fixtures, which must remember to call e_test_server_utils_setup()
and e_test_server_utils_teardown()
in thier fixture's setup and teardown routines.
#define E_TEST_SERVER_UTILS_SERVICE(fixture, service_type)
A convenience macro to fetch the service for a given test case:
1 |
EBookClient *book = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient); |
|
An ETestServerFixture |
|
The type to cast for the service in use |
void (*ETestSourceCustomizeFunc) (ESource *scratch
,ETestServerClosure *closure
);
This can be used to parameterize the addressbook or calendar scratch
ESource
before creating/committing it.
|
The scratch ESource template being used to create an addressbook or calendar |
|
The ETestServerClosure for this test case |
typedef enum { E_TEST_SERVER_NONE = 0, E_TEST_SERVER_ADDRESS_BOOK, E_TEST_SERVER_DIRECT_ADDRESS_BOOK, E_TEST_SERVER_CALENDAR, E_TEST_SERVER_DEPRECATED_ADDRESS_BOOK, E_TEST_SERVER_DEPRECATED_CALENDAR } ETestServiceType;
The type of service to test
Only the ESourceRegistry will be created | |
An EBookCLient will be created and opened for the test | |
An EBookCLient in direct read access mode will be created and opened for the test | |
An ECalClient will be created and opened for the test | |
An EBook will be created and opened for the test | |
struct ETestServerClosure { ETestServiceType type; ETestSourceCustomizeFunc customize; gint calendar_source_type; gboolean keep_work_directory; GDestroyNotify destroy_closure_func; gboolean use_async_connect; };
This structure provides the parameters for the ETestServerFixture tests, it can be included as the first member of a derived structure for any tests deriving from the ETestServerFixture test type
ETestServiceType |
|
ETestSourceCustomizeFunc |
An ETestSourceCustomizeFunc to use to parameterize the scratch ESource, or NULL
|
gint |
An ECalClientSourceType or ECalSourceType; for E_TEST_SERVER_CALENDAR
and E_TEST_SERVER_DEPRECATED_CALENDAR tests |
gboolean |
If specified, the work directory will not be deleted between tests |
GDestroyNotify |
A function to destroy an allocated ETestServerClosure, this it typically used by sub-fixtures which embed this structure in their closures. |
gboolean |
Specifies whether a synchronous or asyncrhonous API should be used to create the EClient you plan to test. |
typedef union { gpointer generic; EBookClient *book_client; ECalClient *calendar_client; EBook *book; ECal *calendar; } ETestService;
A union of service types, holds the object to test in a ETestServerFixture.
gpointer |
A generic pointer for the test service. |
EBookClient * |
An EBookClient, created for E_TEST_SERVER_ADDRESS_BOOK tests |
ECalClient * |
An ECalClient, created for E_TEST_SERVER_CALENDAR tests |
EBook * |
An EBook, created for E_TEST_SERVER_DEPRECATED_ADDRESS_BOOK tests |
ECal * |
An ECal, created for E_TEST_SERVER_DEPRECATED_CALENDAR tests |
struct ETestServerFixture { GMainLoop *loop; GTestDBus *dbus; ESourceRegistry *registry; ETestService service; gchar *source_name; };
A fixture for running tests on the Evolution Data Server components in an encapsulated D-Bus environment.
GMainLoop * |
A Main loop to run traffic in |
GTestDBus * |
The D-Bus test scaffold |
ESourceRegistry * |
An ESourceRegistry |
ETestService |
The ETestService |
gchar * |
This can be given an allocated string before calling e_test_server_utils_setup() and will be the ESource UID
for the test addressbook or calendar, leaving this NULL will result in a suitable unique id being generated for the test. |
typedef enum { E_TEST_SERVER_KEEP_WORK_DIRECTORY = (1 << 0) } ETestServerFlags;
void e_test_server_utils_setup (ETestServerFixture *fixture
,gconstpointer user_data
);
A setup function for the ETestServerFixture fixture
|
A ETestServerFixture |
|
A ETestServerClosure or derived structure provided by the test. |
void e_test_server_utils_teardown (ETestServerFixture *fixture
,gconstpointer user_data
);
A teardown function for the ETestServerFixture fixture
|
A ETestServerFixture |
|
A ETestServerClosure or derived structure provided by the test. |