Community
Participate
Working Groups
The referenced test is actually symbolic of a general problem in the Junit tests which is that it tests for very platform-specific behavior. It tries to allow for this by relying on platform flags like SwtJunit.isWindows and SwtJunit.isGTK, but that only really works for the known platforms. If I work on an implemention for a new platform, do I need to add a flag to SwtJunit and then fix any and all affected tests thus having to mantain my own copy of the test suite? I understand the dilemma, but as much as possible I think the tests should be written in a platform neutral way if at all possible, and I think this one can be. Since we know the items being put into the list and what's being removed, would it not be better to get the selection index and the entry text and make sure that matches what we knew to be the list of items? And in the case where the selection index is -1 (like happens on WIndows), the check would be that the entry text is blank. So is this a reasonable approach or am I being too wishful in my thinking?
Please submit a patch for any that you find. Sometimes there are good reasons for platform tests but this one looks bogus.
I haven't forgotten about this and do intend to help provide a patch. Just have been busy with other priorities. I do have one question however. In researching this, I was a bit confused by the behavior of Combo on Gtk and I want to understand that before addressing the testcase. It seems SWT does not just do the platform thing. When removing the currently selected item, native Gtk appears to replace the text field contents with an adjacent item (though it's not clear if it issues a selection event in all scenarios). However, SWT overtly clears the field which happens to match the Windows behavior. Subsequently, the testcase expects Windows and Gtk to behave one way and other platforms another way. But maybe this is affected by the way SWT determines the selected index and how Gtk maintains it. So why was SWT on Gtk implemented that way as opposed to sticking with the platform behavior?
This test hasn't been failing for years.