94 + function test_mouseEvent() { 95 + indicatorMenuWindow.shown=true 96 + tryCompare(indicatorMenuWindow, "opacity", 1.0) 97 + 98 + clickedSpy.clear() 99 + mouseClick(indicatorMenuWindow, indicatorMenuWindow.width / 2, 100 + indicatorMenuWindow.height / 2) 101 + compare(clickedSpy.count, 0, 102 + "Mouse event should be eaten by indicatorMenuWindow") 103 + 104 + indicatorMenuWindow.shown=false 105 + tryCompare(indicatorMenuWindow, "opacity", 0.0) 106 + 107 + clickedSpy.clear() 108 + mouseClick(indicatorMenuWindow, indicatorMenuWindow.width / 2, 109 + indicatorMenuWindow.height / 2) 110 + compare(clickedSpy.count, 1, 111 + "Mouse event should not be eaten by indicatorMenuWindow") 112 + }
I think this would be a perfect candidate for using the _data() mechanism.
Example:
function test_mouseEvent_data() { return [ {tag: "invisible", shown: true, opacity: 1.0, mouseClicks: 0}, {tag: "visible", shown: false, opacity: 0.0, mouseClicks: 1}, ] }
function test_mouseEvent(data) { indicatorMenuWindow.shown = data.shown tryCompare(indicatorMenuWindow, "opacity", data.opacity)
clickedSpy.clear() mouseClick(indicatorMenuWindow, indicatorMenuWindow.width / 2, indicatorMenuWindow.height / 2) compare(clickedSpy.count, data.mouseClicks, "Check for Mouse event eating by indicatorMenuWindow failed") }
This way you don't have to copy/paste the test code and the debug output gives better feedback when a test fails.
« Back to merge proposal
94 + function test_mouseEvent() { ndow.shown= true indicatorMenuWi ndow, "opacity", 1.0) indicatorMenuWi ndow, indicatorMenuWi ndow.width / 2, ndow.height / 2) clickedSpy. count, 0, ndow") ndow.shown= false indicatorMenuWi ndow, "opacity", 0.0) indicatorMenuWi ndow, indicatorMenuWi ndow.width / 2, ndow.height / 2) clickedSpy. count, 1, ndow")
95 + indicatorMenuWi
96 + tryCompare(
97 +
98 + clickedSpy.clear()
99 + mouseClick(
100 + indicatorMenuWi
101 + compare(
102 + "Mouse event should be eaten by indicatorMenuWi
103 +
104 + indicatorMenuWi
105 + tryCompare(
106 +
107 + clickedSpy.clear()
108 + mouseClick(
109 + indicatorMenuWi
110 + compare(
111 + "Mouse event should not be eaten by indicatorMenuWi
112 + }
I think this would be a perfect candidate for using the _data() mechanism.
Example:
function test_mouseEvent _data() {
{tag: "invisible", shown: true, opacity: 1.0, mouseClicks: 0},
{tag: "visible", shown: false, opacity: 0.0, mouseClicks: 1},
return [
]
}
function test_mouseEvent (data) {
indicatorM enuWindow. shown = data.shown
tryCompare (indicatorMenuW indow, "opacity", data.opacity)
}
This way you don't have to copy/paste the test code and the debug output gives better feedback when a test fails.