Commit graph

13 commits

Author SHA1 Message Date
hujianwei
d894bcd0a0 Add new single-pixel buffer tests
* tests/Imakefile (OBJS14, SRCS14): Add
single_pixel_buffer_test.c/.o.
(single_pixel_buffer_test): New test.
* tests/run_tests.sh (standard_tests): New test.
* tests/svnignore.txt: Add single_pixel_buffer_test.
2022-11-17 11:12:05 +00:00
hujianwei
2979979633 Implement xdg-activation-v1
* 12to11-test.xml (test_surface): <activated>: New event.
* 12to11.c (XLMain): Initialize XDG activation.
* Imakefile (SRCS, OBJS): Add xdg_activation.c and
xdg_activation.o.
(xdg-activation-v1): New scanner target.
* atoms.c (names, XLInitAtoms): New atom `_NET_ACTIVE_WINDOW'.
Adjust accordingly.
* compositor.h (struct _RoleFuncs): New function `activate'.
(struct _XdgRoleImplementationFuncs): Likewise.
* seat.c (XLSeatCheckActivationSerial): New function.
* test.c (Activate): New function.
(GetTestSurface): Attach new hook.
* tests/Imakefile (OBJS13, SRCS13): Add xdg_activation_test.c/o.
(xdg-activation-v1): New scanner target.
(PROGRAMS): Add xdg_activation_test.
(xdg_activation_test): New program target.
* tests/run_tests.sh (standard_tests): Add xdg_activation_test.
* tests/svnignore.txt: Add xdg_activation_test.
* xdg_surface.c (Activate): New function.
(XLGetXdgSurface): Attach hook.
* xdg_toplevel.c (Activate): New function.
(XLGetXdgToplevel): Attach hook.
2022-11-14 06:05:23 +00:00
hujianwei
b022f0dbd9 Fix handling of MULTIPLE selections and add test
* select.c (SignalConversionPerformed): Improve diagnostic
messages.
(ConvertSelectionMultiple): Use correct atoms.
(HandleSelectionRequest): Allow selection requests with target
MULTIPLE.

* tests/Imakefile (SRCS12, OBJS12): Add select_helper_multiple.c
and .o.
(PROGRAMS): Add select_helper_multiple.
(select_helper_multiple): New program.
* tests/select_helper.c (main): Fix typo.

* tests/select_test.c (verify_sample_text_multiple): New function.
(test_single_step): Call it.
* tests/svnignore.txt: Add select_helper_multiple.
2022-11-12 08:07:43 +00:00
hujianwei
0bdc502068 Fix text input bugs with grabbed popups and bugs found by new tests
* 12to11-test.xml (test_manager) <error>: Add
invalid_user_time.
<get_serial, serial> New request and event.
(test_seat_controller) <set_last_user_time>: New request.

* compositor.h (struct _TextInputFuncs): Make `filter_input'
return keycode.
* data_device.c (DestroyReference): Check if reference device is
detached before unlinking reference.
* seat.c (LookupKeysym): Delete function.
(DispatchKey): Use keycodes instead.
(XLSeatExplicitlyGrabSurface): Avoid using owner-events keyboard
grab.

* select.c (struct _SelectionOwnerInfo, HandleSelectionRequest):
Allow CurrentTime in selection requests.  Compensate for
wraparound as well.
(OwnSelection, DisownSelection): Use Timestamp instead of Time.
* test.c (GetSerial): New function.
(test_manager_impl): Add new function.
* test_seat.c (SetLastUserTime): New function.
(seat_controller_impl): Add new function.
* tests/Imakefile (LOCAL_LIBRARIES): Remove GBM and DRM.
(SRCS10, OBJS10, SRCS11, OBJS11): New variables.
(dmabuf_test): Only link this program with GBM and DRM.
(PROGRAMS): Add select_test, select_helper.
(select_test, select_helper): New programs.

* tests/README: Document that select_test needs to be run under
vfb.
* tests/run_tests.sh: Add TODO note.
* tests/svnignore.txt: Add select_test and select_helper.
* tests/test_harness.c (handle_test_manager_serial): New
function.
(test_manager_listener): Add new function.
(open_test_display): Clear display->seat.
(test_get_serial): New function.

* tests/test_harness.h (struct test_display): New function
`serial'.

* text_input.c (CreateIC): Improve debugging code.
(CalculateKeycodeForEvent): Move earlier.
(FilterInputCallback): Handle keycodes here as well.
(XLTextInputDispatchCoreEvent): Add more debugging code.

* xdata.c (SelectSelectionInput): Obtain server time here.
(XLOwnDragSelection, NoteLocalSelectionFooter): Convert times to
Timestamp.
2022-11-12 03:51:21 +00:00
hujianwei
a8297024f1 Add dma-buf tests
* tests/Imakefile (LOCAL_LIBRARIES): Require libgbm and libdrm.
(OBJS9, SRCS9): Add dmabuf_test.c/.o.
(PROGRAMS): Add dmabuf_test.
(dmabuf_test): New program.
* tests/run_tests.sh: Add dmabuf_test.
* tests/seat_test.c (handle_pointer_enter, handle_pointer_leave)
(handle_pointer_motion): Pacify some GCC warnings.
* tests/svnignore.txt: Add dmabuf_test.
* tests/test_harness.h: Include sys/types.h.
2022-11-08 11:53:25 +00:00
hujianwei
686f71c3b4 Add seat testing mechanism and tests for seats
* 12to11-test.xml (test_manager): <error>: Add `invalid_button',
`value_exists', `bad_seat_version' and `invalid_valuator'.
(test_manager): <get_test_seat>: New request.
(test_XIButtonState, test_XIModifierState, test_XIValuatorState)
(test_seat_controller): New interfaces.
* Imakefile: (seat.o): Depend on test_seat.c.
* compositor.h: Update prototypes.
* run.c (XLRunCompositor): Get rid of stdbool constant.
* seat.c (HandleBind1): Move binding logic to this new function.
(HandleBind): Call HandleBind1.
(InitSeatCommon): Add list initialization to this function.
(MakeSeatForDevicePair): Call InitSeatCommon instead.
(HandleRawKey, UpdateModifiersForSeats, DispatchFocusIn)
(DispatchMotion, DispatchBarrierHit, DispatchGesturePinch)
(DispatchGestureSwipe): Do not update user time from send_event
events.  Include test_seat.c.
* test.c (GetTestSeat): New function.
(test_manager_impl): Add new proc function.
(XLLookUpTestSurface): New function.
* tests/Imakefile (OBJS8, SRCS8): New program.
(PROGRAMS): Add seat_test.
(seat_test): New function.
* tests/run_tests.sh (standard_tests): Add seat_test.
* tests/svnignore.txt: Add seat_test.
* tests/test_harness.c (report_test_internal_error,
test_init_seat): New functions.
* tests/test_harness.h (struct test_seat): New struct.
(struct test_display): New field `seat'.
2022-11-07 06:21:07 +00:00
hujianwei
736aef224c Fix problems with test Imakefile
* tests/Imakefile (GENFILES): New variable.
(ScannerTarget): Append to GENFILES.
(depend): Only depend on COMMONSRCS.
(clean): Clean generated files.
2022-11-05 12:13:10 +00:00
hujianwei
21aa7494cd Add new buffer scale tests
* 12to11-test.xml (test_manager): <error>: New errors
`scale_lock_exists' and `invalid_scale'.
(test_manager): <get_test_surface>: Reword documentation.
(test_manager): <get_scale_lock>: New request.
(test_scale_lock): New interface.

* compositor.h: Update prototypes.
* output.c (HandleScaleSettingChange): New function.  Ignore
scale changes while scale is locked.
(XLInitRROutputs): Initialize real output scale.
* test.c (DestroyScaleLock, SetScale, GetScaleLock): New
functions.
(test_manager_impl): Add new implementation.
* tests/Imakefile (SYSTEM_LIBRARIES): Add MathLibrary.
(SRCS7, OBJS7): Add scale_test.c/.o.
(PROGRAMS): Add scale_test.
(scale_test): New program target.
* tests/run_tests.sh (standard_tests): Add scale_test.
* tests/svnignore.txt: Add scale_test.
* tests/test_harness.c (exit_with_code): New function.
(open_test_display): Initialize scale.
(report_test_failure): Call it instead of just exit.
(test_set_scale): New function.
(test_complete): Call exit_with_code.
* tests/test_harness.h (struct test_display): New field
`scale_lock'.
2022-11-05 08:18:18 +00:00
hujianwei
47a650cfd6 Add tests for subsurfaces and fix bug found by them
* subcompositor.c (ViewInsert, ViewInsertAfter)
(ViewInsertBefore): Update bounds for child, not parent view.
* tests/Imakefile (SRCS1, OBJS1): Build imgview first.
(SRCS6, OBJS6): Add subcompositor tests.
(PROGRAMS): Add subsurface_test.
(subsurface_test): New program target.
* tests/run_tests.sh (standard_tests): Add subsurface_test.
* tests/svnignore.txt: Add subsurface_test.
* tests/test_harness.c (swizzle_png_row_premultiply): New
function.
(load_png_image): Premultiply images w/ alpha channel.
* tests/test_harness.h: Include more headers.
2022-11-05 03:44:48 +00:00
hujianwei
1879608d1a Check in new viewporter test files
* tests/imgview.c:
* tests/viewport_dest_200_150_1.dump:
* tests/viewport_dest_200_150_2.dump:
* tests/viewport_src_50_50_200_200_1.dump:
* tests/viewport_src_50_50_200_200_2.dump:
* tests/viewport_src_50_50_200_200_dest_500_500_1.dump:
* tests/viewport_src_50_50_200_200_dest_500_500_2.dump:
* tests/viewporter_test.c:
* tests/viewporter_test.png:
* tests/viewporter_test_1.png: New files.
2022-11-04 12:21:39 +00:00
hujianwei
6a0506a169 Add test for buffer transforms
* tests/Imakefile (OBJS3, SRCS3): New program.
(PROGRAMS): Add transform_test.
* tests/README: Document what these tests are.
* tests/damage_test.c (test_names): Fix coding style.
* tests/run_tests.sh (standard_tests): Add `standard_tests'.
* tests/svnignore.txt: Add transform_test.
* tests/test_harness.c (load_image_data): Fix stride validation
when height > width.
* tests/test_harness.h (FALLTHROUGH): New macro.
2022-11-04 07:22:57 +00:00
hujianwei
5d033bc93f Add new damage test and unify buffer release code in xdg_surface
* 12to11-test.xml (test_surface): <description>: Document when
frame callbacks are run.
* 12to11.c (HandleCmdline): Accept new arg `printsocket'.
(XLMain): Pass socket to HandleCmdline.
* 12to11.man: Document new `printsocket' option.
* mime0.awk:
* mime1.awk:
* mime2.awk:
* mime3.awk:
* mime4.awk: Fix typos in copyright blurb.
* test.c (NoteBounds): Sync with X server after XResizeWindow.
(Commit): Run frame callbacks after unmap as well.
(GetTestSurface): Make windows override redirect.

* tests/Imakefile (SRCS2, OBJS2): New program.
(PROGRAMS): Add damage_test.
(damage_test): New program.  Depend on SRCS2.
* tests/README: Improve documentation on how to run tests.
* tests/simple_test.c (test_names): New list.
(LAST_TEST): New define.
(verify_single_step): Complete test upon last test being run.
(test_single_step): Submit correct surface damage.
(test_next_step): New function.  Does nothing here.
(handle_wl_callback_done): Run the next test.
(submit_surface_damage): New function.
* tests/svnignore.txt: Add damage_test and Makefile.bak.
* tests/test_harness.c (test_complete): New function.
* tests/test_harness.h: New prototypes.
* xdg_surface.c (struct _XdgRole): Use a buffer release helper.
(struct _ReleaseLaterRecord, DeleteRecord, FreeRecords)
(AddRecordAfter): Delete unused structs and functions.
(RunFrameCallbacksConditionally, BufferIdleCallback)
(ReleaseBacking, ReleaseBuffer, XLGetXdgSurface): Use and free
buffer release helper; run frame callbacks from its callback.
2022-11-04 05:36:10 +00:00
hujianwei
83a2d26df3 Check in tests
* tests/Imakefile:
* tests/README
* tests/basic_test_card.png:
* tests/blue.png:
* tests/simple_test.c:
* tests/simple_test.dump:
* tests/svnignore.txt:
* tests/test_harness.c:
* tests/test_harness.h: New files.
2022-11-04 02:41:19 +00:00