summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Michael <cp.michael@samsung.com>2020-01-08 10:19:16 -0500
committerChristopher Michael <cp.michael@samsung.com>2020-01-08 10:23:30 -0500
commit594ed747a74e181256f4d095b7f0cc841127a921 (patch)
tree65c23943a14eb842d820ca81df005df94fce6bac
parent43ad91ee406cbcc5715486813324a2eecbd5ece4 (diff)
Revert "tests/ecore_wl2: Add test for ecore_wl2_window_xxx functions"
This commit reverts some additional tests which were added. The reason for the revert is that these tests can occasionally cause the ecore_wl2 test suite to timeout/stall. This reverts commit 4ea865623df83b78830dc253bcddd7e64a7810ca.
-rw-r--r--src/tests/ecore_wl2/ecore_wl2_test_window.c509
-rw-r--r--src/tests/ecore_wl2/meson.build10
2 files changed, 5 insertions, 514 deletions
diff --git a/src/tests/ecore_wl2/ecore_wl2_test_window.c b/src/tests/ecore_wl2/ecore_wl2_test_window.c
index c69f8eb342..d47f314b61 100644
--- a/src/tests/ecore_wl2/ecore_wl2_test_window.c
+++ b/src/tests/ecore_wl2/ecore_wl2_test_window.c
@@ -7,44 +7,19 @@
7#include <Eina.h> 7#include <Eina.h>
8#include <Ecore.h> 8#include <Ecore.h>
9#include <Ecore_Wl2.h> 9#include <Ecore_Wl2.h>
10#include <wayland-egl.h>
11
12#ifdef GL_GLES
13#include <EGL/egl.h>
14#include <GLES2/gl2.h>
15#endif
16 10
17#include "ecore_wl2_suite.h" 11#include "ecore_wl2_suite.h"
18 12
19#define WIDTH 480 13#define WIDTH 480
20#define HEIGHT 360 14#define HEIGHT 360
21 15
22typedef struct _Test_Data
23{
24 Ecore_Wl2_Display *display;
25 Ecore_Wl2_Window *win;
26 Ecore_Wl2_Frame_Cb_Handle *frame_callback_handler;
27 Ecore_Event_Handler *handler;
28
29 struct wl_surface *surface;
30 struct wl_egl_window *egl_window;
31
32 int width;
33 int height;
34 int frame_callback_count;
35
36#ifdef GL_GLES
37 EGLDisplay egl_display;
38 EGLConfig egl_conf;
39 EGLSurface egl_surface;
40 EGLContext egl_context;
41#endif
42} Test_Data;
43
44static Ecore_Wl2_Display * 16static Ecore_Wl2_Display *
45_display_connect(void) 17_display_connect(void)
46{ 18{
47 return ecore_wl2_display_connect(NULL); 19 Ecore_Wl2_Display *disp;
20
21 disp = ecore_wl2_display_connect(NULL);
22 return disp;
48} 23}
49 24
50static Ecore_Wl2_Window * 25static Ecore_Wl2_Window *
@@ -59,45 +34,6 @@ _surface_get(Ecore_Wl2_Window *win)
59 return ecore_wl2_window_surface_get(win); 34 return ecore_wl2_window_surface_get(win);
60} 35}
61 36
62#ifdef GL_GLES
63static void
64_init_egl(Test_Data *td)
65{
66 eglBindAPI(EGL_OPENGL_API);
67 EGLint num_config;
68
69 EGLint attributes[] = {
70 EGL_RED_SIZE, 8,
71 EGL_GREEN_SIZE, 8,
72 EGL_BLUE_SIZE, 8,
73 EGL_NONE
74 };
75
76 td->egl_display =
77 eglGetDisplay((EGLNativeDisplayType)ecore_wl2_display_get(td->display));
78 eglInitialize(td->egl_display, NULL, NULL);
79 eglChooseConfig(td->egl_display, attributes, &td->egl_conf, 1, &num_config);
80 td->egl_context =
81 eglCreateContext(td->egl_display, td->egl_conf, EGL_NO_CONTEXT, NULL);
82
83 td->egl_window = wl_egl_window_create(td->surface, td->width, td->height);
84 td->egl_surface =
85 eglCreateWindowSurface(td->egl_display, td->egl_conf, td->egl_window, NULL);
86
87 eglMakeCurrent(td->egl_display, td->egl_surface, td->egl_surface,
88 td->egl_context);
89}
90
91static void
92_term_egl(Test_Data *td)
93{
94 eglDestroySurface(td->egl_display, td->egl_surface);
95 wl_egl_window_destroy(td->egl_window);
96 eglDestroyContext(td->egl_display, td->egl_context);
97 eglTerminate(td->egl_display);
98}
99#endif
100
101EFL_START_TEST(wl2_window_new) 37EFL_START_TEST(wl2_window_new)
102{ 38{
103 Ecore_Wl2_Display *disp; 39 Ecore_Wl2_Display *disp;
@@ -399,97 +335,6 @@ EFL_START_TEST(wl2_window_type)
399} 335}
400EFL_END_TEST 336EFL_END_TEST
401 337
402#ifdef GL_GLES
403static void
404_test_activated_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data)
405{
406 Test_Data *td = data;
407
408 td->frame_callback_count++;
409 if (td->frame_callback_count % 4 == 0)
410 glClearColor(0.0, 1.0, 0.0, 0.0);
411 else if (td->frame_callback_count % 4 == 1)
412 glClearColor(0.0, 0.0, 1.0, 0.0);
413 else if (td->frame_callback_count % 4 == 2)
414 glClearColor(0.0, 0.0, 0.0, 1.0);
415 else
416 glClearColor(1.0, 0.0, 0.0, 0.0);
417 glClear(GL_COLOR_BUFFER_BIT);
418 glFlush();
419
420 eglSwapBuffers(td->egl_display, td->egl_surface);
421
422 ecore_wl2_window_commit(td->win, EINA_TRUE);
423}
424
425static Eina_Bool
426_test_activated_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
427{
428 Test_Data *td = data;
429
430 td->frame_callback_handler =
431 ecore_wl2_window_frame_callback_add(td->win,
432 _test_activated_frame_cb, td);
433 ecore_wl2_window_commit(td->win, EINA_TRUE);
434
435 return ECORE_CALLBACK_PASS_ON;
436}
437
438static Eina_Bool
439_test_activated_window_activate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
440{
441 //TC Pass
442 ecore_main_loop_quit();
443
444 return ECORE_CALLBACK_PASS_ON;
445}
446
447EFL_START_TEST(wl2_window_activated)
448{
449 Test_Data *td;
450
451 ecore_wl2_init();
452
453 td = calloc(1, sizeof(Test_Data));
454 td->width = WIDTH;
455 td->height = HEIGHT;
456 td->frame_callback_count = 0;
457
458 td->display = _display_connect();
459 ck_assert(td->display != NULL);
460
461 td->win = _window_create(td->display);
462 ck_assert(td->win != NULL);
463
464 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
465
466 td->surface = _surface_get(td->win);
467 ck_assert(td->surface != NULL);
468
469 ecore_wl2_window_show(td->win);
470
471 _init_egl(td);
472 td->handler =
473 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
474 _test_activated_configure_complete, td);
475 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ACTIVATE,
476 _test_activated_window_activate, NULL);
477
478 ecore_main_loop_begin();
479
480 _term_egl(td);
481 ecore_wl2_shutdown();
482 free(td);
483}
484EFL_END_TEST
485#else
486EFL_START_TEST(wl2_window_activated)
487{
488 fail_if("No GL enabled GL should be enabled for API test");
489}
490EFL_END_TEST
491#endif
492
493EFL_START_TEST(wl2_window_aspect) 338EFL_START_TEST(wl2_window_aspect)
494{ 339{
495 Ecore_Wl2_Display *disp; 340 Ecore_Wl2_Display *disp;
@@ -597,344 +442,6 @@ EFL_START_TEST(wl2_window_role)
597} 442}
598EFL_END_TEST 443EFL_END_TEST
599 444
600static void
601_test_commit_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data)
602{
603 Test_Data *td = data;
604 td->frame_callback_count++;
605 ecore_main_loop_quit();
606}
607
608static Eina_Bool
609_test_commit_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
610{
611 Test_Data *td = data;
612
613 td->frame_callback_handler =
614 ecore_wl2_window_frame_callback_add(td->win, _test_commit_frame_cb, td);
615 ecore_wl2_window_commit(td->win, EINA_TRUE);
616
617 return ECORE_CALLBACK_PASS_ON;
618}
619
620EFL_START_TEST(wl2_window_commit)
621{
622 Test_Data *td;
623
624 ecore_wl2_init();
625
626 td = calloc(1, sizeof(Test_Data));
627 td->width = WIDTH;
628 td->height = HEIGHT;
629 td->frame_callback_count = 0;
630
631 td->display = _display_connect();
632 ck_assert(td->display != NULL);
633
634 td->win = _window_create(td->display);
635 ck_assert(td->win != NULL);
636
637 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
638
639 td->surface = _surface_get(td->win);
640 ck_assert(td->surface != NULL);
641
642 ecore_wl2_window_show(td->win);
643
644 td->handler =
645 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
646 _test_commit_configure_complete, td);
647
648 ecore_main_loop_begin();
649
650 //Check if the frame callback was called properly by ecore_wl2_window_commit().
651 fail_if(td->frame_callback_count == 0);
652
653 ecore_wl2_shutdown();
654 free(td);
655}
656EFL_END_TEST
657
658static void
659_test_frame_callback_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data)
660{
661 Test_Data *td = data;
662 td->frame_callback_count++;
663 if (td->frame_callback_count == 1)
664 {
665 ecore_wl2_window_frame_callback_del(td->frame_callback_handler);
666 td->frame_callback_handler = NULL;
667 ecore_main_loop_quit();
668 }
669}
670
671static Eina_Bool
672_test_frame_callback_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
673{
674 Test_Data *td = data;
675
676 td->frame_callback_handler =
677 ecore_wl2_window_frame_callback_add(td->win,
678 _test_frame_callback_frame_cb, td);
679 ecore_wl2_window_commit(td->win, EINA_TRUE);
680
681 return ECORE_CALLBACK_PASS_ON;
682}
683
684EFL_START_TEST(wl2_window_frame_callback)
685{
686 Test_Data *td;
687
688 ecore_wl2_init();
689
690 td = calloc(1, sizeof(Test_Data));
691 td->width = WIDTH;
692 td->height = HEIGHT;
693 td->frame_callback_count = 0;
694
695 td->display = _display_connect();
696 ck_assert(td->display != NULL);
697
698 td->win = _window_create(td->display);
699 ck_assert(td->win != NULL);
700
701 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
702
703 td->surface = _surface_get(td->win);
704 ck_assert(td->surface != NULL);
705
706 ecore_wl2_window_show(td->win);
707
708 td->handler =
709 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
710 _test_frame_callback_configure_complete, td);
711
712 ecore_main_loop_begin();
713
714 //Check if the frame callback called after then it sets NULL or not.
715 fail_if(td->frame_callback_count != 1);
716 fail_if(td->frame_callback_handler != NULL);
717
718 ecore_wl2_shutdown();
719 free(td);
720}
721EFL_END_TEST
722
723EFL_START_TEST(wl2_window_free)
724{
725 Ecore_Wl2_Window *t_win;
726 Test_Data *td;
727
728 ecore_wl2_init();
729
730 td = calloc(1, sizeof(Test_Data));
731
732 td->display = _display_connect();
733 ck_assert(td->display != NULL);
734
735 td->win = _window_create(td->display);
736 ck_assert(td->win != NULL);
737
738 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
739
740 td->surface = _surface_get(td->win);
741 ck_assert(td->surface != NULL);
742
743 ecore_wl2_window_show(td->win);
744
745 t_win = ecore_wl2_display_window_find_by_surface(td->display, td->surface);
746
747 fail_if(td->win != t_win);
748
749 ecore_wl2_window_free(td->win);
750 t_win = ecore_wl2_display_window_find_by_surface(td->display, td->surface);
751
752 //Check the returned window with freed window.
753 fail_if(td->win == t_win);
754
755 ecore_wl2_shutdown();
756 free(td);
757}
758EFL_END_TEST
759
760static Eina_Bool
761_test_hide_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
762{
763 //TC pass
764 ecore_main_loop_quit();
765
766 return ECORE_CALLBACK_PASS_ON;
767}
768
769EFL_START_TEST(wl2_window_hide)
770{
771 Test_Data *td;
772
773 ecore_wl2_init();
774
775 td = calloc(1, sizeof(Test_Data));
776 td->width = WIDTH;
777 td->height = HEIGHT;
778 td->frame_callback_count = 0;
779
780 td->display = _display_connect();
781 ck_assert(td->display != NULL);
782
783 td->win = _window_create(td->display);
784 ck_assert(td->win != NULL);
785
786 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
787
788 td->surface = _surface_get(td->win);
789 ck_assert(td->surface != NULL);
790
791 ecore_wl2_window_show(td->win);
792
793 ecore_wl2_window_hide(td->win);
794 td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_HIDE,
795 _test_hide_window_hide, NULL);
796
797 ecore_main_loop_begin();
798
799 ecore_wl2_shutdown();
800 free(td);
801}
802EFL_END_TEST
803
804EFL_START_TEST(wl2_window_shell_surface_exists)
805{
806 Test_Data *td;
807
808 ecore_wl2_init();
809
810 td = calloc(1, sizeof(Test_Data));
811 td->width = WIDTH;
812 td->height = HEIGHT;
813 td->frame_callback_count = 0;
814
815 td->display = _display_connect();
816 ck_assert(td->display != NULL);
817
818 td->win = _window_create(td->display);
819 ck_assert(td->win != NULL);
820
821 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
822
823 td->surface = _surface_get(td->win);
824 ck_assert(td->surface != NULL);
825
826 ecore_wl2_window_show(td->win);
827
828 //window_show function will create shell surface. then checks it.
829 fail_if(ecore_wl2_window_shell_surface_exists(td->win) == EINA_FALSE);
830
831 ecore_wl2_shutdown();
832 free(td);
833}
834EFL_END_TEST
835
836static Eina_Bool
837_test_show_window_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
838{
839 //TC pass
840 ecore_main_loop_quit();
841
842 return ECORE_CALLBACK_PASS_ON;
843}
844
845EFL_START_TEST(wl2_window_show)
846{
847 Test_Data *td;
848
849 ecore_wl2_init();
850
851 td = calloc(1, sizeof(Test_Data));
852 td->width = WIDTH;
853 td->height = HEIGHT;
854 td->frame_callback_count = 0;
855
856 td->display = _display_connect();
857 ck_assert(td->display != NULL);
858
859 td->win = _window_create(td->display);
860 ck_assert(td->win != NULL);
861
862 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
863
864 td->surface = _surface_get(td->win);
865 ck_assert(td->surface != NULL);
866
867 ecore_wl2_window_show(td->win);
868
869 td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_SHOW,
870 _test_show_window_show, NULL);
871
872 ecore_main_loop_begin();
873
874 ecore_wl2_shutdown();
875 free(td);
876}
877EFL_END_TEST
878
879static Eina_Bool _window_configure_event_called = EINA_FALSE;
880
881static Eina_Bool
882_test_update_window_configure(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
883{
884 _window_configure_event_called = EINA_TRUE;
885
886 return ECORE_CALLBACK_PASS_ON;
887}
888
889static Eina_Bool
890_test_update_window_configure_complete(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
891{
892 //Checks if the configure_complete calling before configure calling
893 //when ecore_wl2_window_update_begin() called.
894 fail_if(_window_configure_event_called == EINA_TRUE);
895
896 ecore_main_loop_quit();
897
898 return ECORE_CALLBACK_PASS_ON;
899}
900
901EFL_START_TEST(wl2_window_update_begin)
902{
903 Test_Data *td;
904
905 ecore_wl2_init();
906
907 td = calloc(1, sizeof(Test_Data));
908 td->width = WIDTH;
909 td->height = HEIGHT;
910 td->frame_callback_count = 0;
911
912 td->display = _display_connect();
913 ck_assert(td->display != NULL);
914
915 td->win = _window_create(td->display);
916 ck_assert(td->win != NULL);
917
918 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
919
920 td->surface = _surface_get(td->win);
921 ck_assert(td->surface != NULL);
922
923 ecore_wl2_window_show(td->win);
924
925 ecore_wl2_window_update_begin(td->win);
926 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE,
927 _test_update_window_configure, NULL);
928 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
929 _test_update_window_configure_complete, NULL);
930
931 ecore_main_loop_begin();
932
933 ecore_wl2_shutdown();
934 free(td);
935}
936EFL_END_TEST
937
938void 445void
939ecore_wl2_test_window(TCase *tc) 446ecore_wl2_test_window(TCase *tc)
940{ 447{
@@ -958,18 +465,10 @@ ecore_wl2_test_window(TCase *tc)
958 tcase_add_test(tc, wl2_wm_window_rotation_app); 465 tcase_add_test(tc, wl2_wm_window_rotation_app);
959 tcase_add_test(tc, wl2_window_geometry); 466 tcase_add_test(tc, wl2_window_geometry);
960 tcase_add_test(tc, wl2_window_type); 467 tcase_add_test(tc, wl2_window_type);
961 tcase_add_test(tc, wl2_window_activated);
962 tcase_add_test(tc, wl2_window_available_rotation); 468 tcase_add_test(tc, wl2_window_available_rotation);
963 tcase_add_test(tc, wl2_window_aspect); 469 tcase_add_test(tc, wl2_window_aspect);
964 tcase_add_test(tc, wl2_window_class); 470 tcase_add_test(tc, wl2_window_class);
965 tcase_add_test(tc, wl2_window_title); 471 tcase_add_test(tc, wl2_window_title);
966 tcase_add_test(tc, wl2_window_role); 472 tcase_add_test(tc, wl2_window_role);
967 tcase_add_test(tc, wl2_window_commit);
968 tcase_add_test(tc, wl2_window_frame_callback);
969 tcase_add_test(tc, wl2_window_free);
970 tcase_add_test(tc, wl2_window_hide);
971 tcase_add_test(tc, wl2_window_shell_surface_exists);
972 tcase_add_test(tc, wl2_window_show);
973 tcase_add_test(tc, wl2_window_update_begin);
974 } 473 }
975} 474}
diff --git a/src/tests/ecore_wl2/meson.build b/src/tests/ecore_wl2/meson.build
index 2491b6d631..eb1a13db6a 100644
--- a/src/tests/ecore_wl2/meson.build
+++ b/src/tests/ecore_wl2/meson.build
@@ -8,17 +8,9 @@ ecore_wl2_suite_src = [
8 'ecore_wl2_test_input.c' 8 'ecore_wl2_test_input.c'
9] 9]
10 10
11wl2_test_gl_deps = []
12
13if get_option('opengl') == 'es-egl'
14 wl2_test_gl_deps += dependency('egl')
15 wl2_test_gl_deps += dependency('gl')
16endif
17
18ecore_wl2_suite = executable('ecore_wl2_suite', 11ecore_wl2_suite = executable('ecore_wl2_suite',
19 ecore_wl2_suite_src, 12 ecore_wl2_suite_src,
20 dependencies: [ecore_wl2, ecore, ecore_input, check, wayland_protocol, wayland_client, dependency('wayland-egl'), wl2_test_gl_deps], 13 dependencies: [ecore_wl2, ecore, check, wayland_protocol],
21
22 c_args : [ 14 c_args : [
23 '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"', 15 '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
24 '-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"'] 16 '-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']