2011-09-14 12:02:07 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2012-11-14 12:12:53 -08:00
|
|
|
#include <Evas.h>
|
2011-09-14 12:02:07 -07:00
|
|
|
|
2012-11-14 12:12:53 -08:00
|
|
|
#include "evas_suite.h"
|
2011-09-14 12:02:07 -07:00
|
|
|
|
2012-11-14 12:12:53 -08:00
|
|
|
typedef struct _Evas_Test_Case Evas_Test_Case;
|
2011-09-14 12:02:07 -07:00
|
|
|
|
2012-11-14 12:12:53 -08:00
|
|
|
struct _Evas_Test_Case
|
2011-09-14 12:02:07 -07:00
|
|
|
{
|
|
|
|
const char *test_case;
|
|
|
|
void (*build)(TCase *tc);
|
|
|
|
};
|
|
|
|
|
2012-11-14 12:12:53 -08:00
|
|
|
static const Evas_Test_Case etc[] = {
|
|
|
|
{ "Evas", evas_test_init },
|
2013-11-26 04:26:30 -08:00
|
|
|
{ "Object", evas_test_object },
|
2012-11-14 12:12:53 -08:00
|
|
|
{ "Object Textblock", evas_test_textblock },
|
|
|
|
{ "Object Text", evas_test_text },
|
|
|
|
{ "Callbacks", evas_test_callbacks },
|
2013-01-04 09:19:43 -08:00
|
|
|
{ "Render Engines", evas_test_render_engines },
|
2014-02-17 19:35:24 -08:00
|
|
|
{ "Filters", evas_test_filters },
|
2014-03-14 00:00:57 -07:00
|
|
|
{ "Images", evas_test_image_object },
|
2014-10-06 07:27:06 -07:00
|
|
|
{ "Meshes", evas_test_mesh },
|
2015-01-05 23:58:33 -08:00
|
|
|
{ "Masking", evas_test_mask },
|
2011-09-14 12:02:07 -07:00
|
|
|
{ NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
_list_tests(void)
|
|
|
|
{
|
2012-11-14 12:12:53 -08:00
|
|
|
const Evas_Test_Case *itr;
|
2011-09-14 12:02:07 -07:00
|
|
|
|
|
|
|
itr = etc;
|
|
|
|
fputs("Available Test Cases:\n", stderr);
|
|
|
|
for (; itr->test_case; itr++)
|
|
|
|
fprintf(stderr, "\t%s\n", itr->test_case);
|
|
|
|
}
|
|
|
|
static Eina_Bool
|
|
|
|
_use_test(int argc, const char **argv, const char *test_case)
|
|
|
|
{
|
|
|
|
if (argc < 1)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
for (; argc > 0; argc--, argv++)
|
|
|
|
if (strcmp(test_case, *argv) == 0)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Suite *
|
2012-11-14 12:12:53 -08:00
|
|
|
evas_suite_build(int argc, const char **argv)
|
2011-09-14 12:02:07 -07:00
|
|
|
{
|
|
|
|
TCase *tc;
|
|
|
|
Suite *s;
|
|
|
|
int i;
|
|
|
|
|
2012-11-14 12:12:53 -08:00
|
|
|
s = suite_create("Evas");
|
2011-09-14 12:02:07 -07:00
|
|
|
|
|
|
|
for (i = 0; etc[i].test_case; ++i)
|
|
|
|
{
|
|
|
|
if (!_use_test(argc, argv, etc[i].test_case)) continue;
|
|
|
|
tc = tcase_create(etc[i].test_case);
|
|
|
|
|
|
|
|
etc[i].build(tc);
|
|
|
|
|
|
|
|
suite_add_tcase(s, tc);
|
2015-01-30 01:49:54 -08:00
|
|
|
#ifndef _WIN32
|
2011-09-14 12:02:07 -07:00
|
|
|
tcase_set_timeout(tc, 0);
|
2015-01-30 01:49:54 -08:00
|
|
|
#endif
|
2011-09-14 12:02:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
Suite *s;
|
|
|
|
SRunner *sr;
|
|
|
|
int i, failed_count;
|
|
|
|
|
|
|
|
for (i = 1; i < argc; i++)
|
|
|
|
if ((strcmp(argv[i], "-h") == 0) ||
|
|
|
|
(strcmp(argv[i], "--help") == 0))
|
|
|
|
{
|
|
|
|
fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
|
|
|
|
argv[0]);
|
|
|
|
_list_tests();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else if ((strcmp(argv[i], "-l") == 0) ||
|
|
|
|
(strcmp(argv[i], "--list") == 0))
|
|
|
|
{
|
|
|
|
_list_tests();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-01-04 09:19:43 -08:00
|
|
|
putenv("EFL_RUN_IN_TREE=1");
|
|
|
|
|
2012-11-14 12:12:53 -08:00
|
|
|
evas_init();
|
|
|
|
s = evas_suite_build(argc - 1, (const char **)argv + 1);
|
2011-09-14 12:02:07 -07:00
|
|
|
sr = srunner_create(s);
|
|
|
|
|
2013-03-12 05:46:06 -07:00
|
|
|
srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
|
2013-03-12 02:47:28 -07:00
|
|
|
|
2011-09-14 12:02:07 -07:00
|
|
|
srunner_run_all(sr, CK_ENV);
|
|
|
|
failed_count = srunner_ntests_failed(sr);
|
|
|
|
srunner_free(sr);
|
|
|
|
|
2012-11-14 12:12:53 -08:00
|
|
|
evas_shutdown();
|
2011-09-14 12:02:07 -07:00
|
|
|
return (failed_count == 0) ? 0 : 255;
|
|
|
|
}
|