db0 / godot-card-game-framework

A framework which comes with prepared scenes and classes to kickstart your card game, as well as a powerful scripting engine to use to provide full rules enforcement.
http://dbzer0.com/projects/godot-card-game-framework/
GNU Affero General Public License v3.0
892 stars 95 forks source link

Added an offset to the card template to use while dragging cards, this prevents the cursor from warping and fixes #52 #157

Closed stevosaurus closed 2 years ago

db0 commented 2 years ago

Great. Have you run the Integration tests to see if anything broke?

stevosaurus commented 2 years ago

Yes, I ran the unit tests and everything passes currently except the 21 tests that were already failing in main.

Initially it broke some tests, but I did discover an issue (possibly a hidden bug?) where the unit test fake_click method would reposition the fake unit test mouse (via the use_fake_mouse param) after it had been explicitly positioned by the test. I removed the flag as it seemed to be no longer necessary. Also, since the fake click event is being passed to the _on_Card_gui_input method, I believe the position parameter for the event is relative to the card, so I just pass in Vector2(0,0) as the card origin, rather than the global card position.

db0 commented 2 years ago

My fault for letting so many tests break, but the removal of the use_fake_mouse did break one of my tests.

You're right that adding the fake mouse breaks a lot more when using your code, so it's preferable to check how to fix this specific one to work without the fake_mouse.

res://tests/integration/test_scripting_engine_general.gd
- test_basics
    [Pending]:  Empty does not create a ScriptingEngine object
- test_target_script_on_drag_from_hand
    [Failed]:  [8] expected to equal [5]:  Counter reduced since targeting was not a cost
          at line 358

EDIT: Fixed