adventuregamestudio / ags-test-games

Games for automatic tests
MIT License
1 stars 3 forks source link

Update the DrawingSurface tests for new 32-bit colors in ags4 #12

Closed ericoporto closed 2 months ago

ericoporto commented 2 months ago

The problem is that the DrawRectangle, DrawTriangle, DrawCircle and DrawLine tests use a stored sprite to be able to match with the draw commands but the drawing uses colors that are still in the old "16-bit/ags3" color format so the actually drawn colors are different from what they used to be when the sprites were created.

The colors in the script should be updated to match the sprite colors.

Note: this looks like something that could be a real issue to upgrade some old ags3 project to ags4, some color conversion function in script could maybe help?

https://github.com/adventuregamestudio/ags-test-games/blob/main/ags4/auto-test/test-drawingsurface.asc

See also

ivan-mogilko commented 2 months ago

BTW, maybe Game.GetColorFromRGB should have its own test too, ensuring that it returns a proper encoded R8G8B8 in ags4 and R5G6B5 in ags3 branch.

(Unless there's one that i've missed?)

Note: this looks like something that could be a real issue to upgrade some old ags3 project to ags4, some color conversion function in script could maybe help?

We discussed this in 32-bit color PR, but there's no way to fix scripts automatically, so a user will have to adjust the script anyway. In a common cases using Game.GetColorFromRGB instead should be a proper thing (e.g. see https://github.com/dkrey/ags_tumbleweed/issues/30). If there has to be a color number in script, they would need to be replaced, by hand or else...

But given the nature of this value, i'm not yet convinced that this will be a good addition to the script API.

ivan-mogilko commented 2 months ago

Oh right, so I fixed this, see ac6f81d9ca6bdb5dd6aa09114f2aa02ddd0cd00f and also updated ags3 game to use constants instead of numbers in script: 3082a44439263c080c39e9f8c4171a9e84932b32