Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial InputEvent set of unit tests #68677

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

IanGaither
Copy link
Contributor

Covers all branches of non-virtual functions for all derivatives of the InputEvent class.

I'm not sure how to add the discussion label, but I was hoping to get some feedback on how to approach the rest of the class. Currently I've covered all the non-virtual functions (since it's abstract that required testing all the child classes). I think the rest of the functionality should be covered in tests that target each child directly, but I'm not sure as I've haven't worked with unit tests a ton and especially haven't worked with them in C++ before.

Any feedback would be appreciated!

Tests for class based on suggestions from: #43440 (comment)

Covers all branches of non-virtual functions for all derivatives of the InputEvent class.
@IanGaither IanGaither requested a review from a team as a code owner November 15, 2022 05:55
…al function calls

Cleaned up formatting issues and added class specifiers to hopefully resolve the macOS build issues.
@akien-mga
Copy link
Member

Seems to crash:

./tests/core/input/test_input_event.h:110:
TEST CASE:  [InputEvent] actions<InputEventWithModifiers>
  Action is present

./tests/core/input/test_input_event.h:110: FATAL ERROR: test case CRASHED: SIGABRT - Abort (abnormal termination) signal

/Users/runner/work/_temp/3aea7a72-8c05-4ea6-8c7f-a4eef80703f6.sh: line 3:  7549 Abort trap: 6           ./bin/godot.macos.editor.x86_64 --test

There are also style issues to fix, see the diff (wrong filename in header, and wrong indentation style): https://github.com/godotengine/godot/actions/runs/3467850975/jobs/5793096042

@IanGaither IanGaither force-pushed the input-event-unit-tests branch 3 times, most recently from d5049cc to 3957af5 Compare December 1, 2022 07:11
Removed extra space

fixed spacing on multiline macro

removed tabs from spacing on multiline macro

Update test_input_event.h
@IanGaither IanGaither force-pushed the input-event-unit-tests branch from 3957af5 to 18aef3a Compare December 1, 2022 07:25
@Maran23
Copy link
Contributor

Maran23 commented Dec 16, 2022

You could also add tests for action_add_event to add inputs to the action.

@YuriSizov YuriSizov modified the milestones: 4.0, 4.1 Feb 10, 2023
@YuriSizov YuriSizov modified the milestones: 4.1, 4.x Jun 14, 2023
@Calinou
Copy link
Member

Calinou commented Apr 10, 2024

Note that #79444 (which was opened after this PR) has already added tests for InputEvent with a different, incompatible code structure.

It's still possible to add more unit tests to the now-existing file, but you'll need to refactor the code added by your pull request to do so. Feel free to look into doing this if you have time – if you don't, let us know and we can mark this PR as salvageable 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants