Replies: 4 comments 1 reply
-
Sounds great, it will be much easier to read what is happening too. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I love it! One caveat is to have a nice to way to do some sort of "contains actions" if you don't wanna check the whole sequence of actions on some tests. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Sounds very good! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Do you want to take on this task @st-pasha? :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently
MockCanvas
serializes all method calls into strings and stores them all in an internal list. That list is later tested to see if it contains "correct" strings. Something like this:This has several disadvantages, the chief among which is numeric instability. For example, the string
"0.0"
is different from"-0.0"
, though both represent exactly the same numeric quantity. In general, the only way to write a more-or-less reliable test then is to make sure to always use very round numbers (like in the example above), and even that does not always work perfectly.Suggestion
I suggest then changing the internal structure of
MockCanvas
so that instead of storing strings it would store individual drawing commands, and provide the==
operator which would compare canvases up to certain numeric precision. So, the usage code could become something like this:Beta Was this translation helpful? Give feedback.
All reactions