Question / Bug(?) in test case SegmentDisplay #170
Unanswered
worldpeace-germany
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I would like to understand something about this test https://github.com/missionpinball/mpf/blob/dev/mpf/tests/test_SegmentDisplay.py#L1310
At the moment I am only seeking for confirmation on my understanding, not where the bug lies in the code (if my understanding is correct). Once we agree on an understanding I will investigate the code itself further.
TEST 1:
Add entry with priority 0 and key “None” (since no key is given), color of the text is white.
TEST 2:
Add text with key “2nd” and priority 10
TEST 3:
Add text with key “3rd” and priority 5
TEST 4:
Remove entry from TEST 2 (key= "2nd")
TEST 5:
Update text from TEST 3
TEST 6:
Updating the text from TEST 1 (due to lower priority it is not shown on display, which is correct)
TEST 7:
Updating again the text from TEST 1 and TEST 6, plus the priority, key is “None” which is the indicator that it is the same entry we touched in TEST 1 and 6. Part of the update is to change the color to blue (previously white from TEST 1)
TEST 8:
Now we remove the entry with key “None”, which is the entry from TEST 1,6,7.
Let me summarize what has happened so far. We have worked with entries having the keys None, 2nd and 3rd . Sorted by these keys:
None:
TEST 1 --> added, color white
TEST 6 --> text changed, no color change
TEST 7 --> text changed, color changed to blue
TEST 8 --> removed that entry
2nd:
TEST 2 --> created, color red
TEST 4 --> removed that entry
3rd:
TEST 3 --> created color yellow
TEST 5 --> updated text, no color change
Which means on the stack is only the entry left with key “3rd" and this one should be shown. If you look at the asserts in test 8
self.assertEqual(" 3rd", display1.text)
--> Yes fully agree, correct
self.assertEqual([RGBColor("blue")] * 10, display1.colors)
--> No I don’t agree, why blue shouldn’t it be yellow?
Can either someone confirm my point of view or explain to me why the color should be blue?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions