kopie van
https://github.com/vaadin/framework.git
synced 2024-07-28 08:18:00 +02:00
Sort collections in valueChangeListener to get consistent test results
svn changeset:16596/svn branch:6.5
This commit is contained in:
bovenliggende
285233671d
commit
9bbcf97ca5
@ -1,6 +1,8 @@
|
||||
package com.vaadin.tests.components.abstractfield;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
@ -136,8 +138,22 @@ public abstract class AbstractFieldTest<T extends AbstractField> extends
|
||||
}
|
||||
};
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
|
||||
Object o = event.getProperty().getValue();
|
||||
if (o instanceof Collection) {
|
||||
// Sort collections to avoid problems with values printed in
|
||||
// different order
|
||||
try {
|
||||
ArrayList<Comparable> c = new ArrayList<Comparable>(
|
||||
(Collection) o);
|
||||
Collections.sort(c);
|
||||
o = c;
|
||||
} catch (Exception e) {
|
||||
// continue with unsorted if sorting fails for some reason
|
||||
log("Exception while sorting value: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Distinguish between null and 'null'
|
||||
String value = "null";
|
||||
|
@ -94,7 +94,7 @@
|
||||
<tr>
|
||||
<td>assertText</td>
|
||||
<td>vaadin=runcomvaadintestscomponentstableTables::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td>
|
||||
<td>1. ValueChangeEvent, new value: '[Item 3, Item 4, Item 9, Item 5, Item 6, Item 7, Item 8]'</td>
|
||||
<td>1. ValueChangeEvent, new value: '[Item 3, Item 4, Item 5, Item 6, Item 7, Item 8, Item 9]'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>screenCapture</td>
|
||||
@ -144,7 +144,7 @@
|
||||
<tr>
|
||||
<td>assertText</td>
|
||||
<td>vaadin=runcomvaadintestscomponentstableTables::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td>
|
||||
<td>5. ValueChangeEvent, new value: '[Item 9, Item 5, Item 6, Item 10, Item 7, Item 8]'</td>
|
||||
<td>5. ValueChangeEvent, new value: '[Item 10, Item 5, Item 6, Item 7, Item 8, Item 9]'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>screenCapture</td>
|
||||
@ -189,7 +189,7 @@
|
||||
<tr>
|
||||
<td>assertText</td>
|
||||
<td>vaadin=runcomvaadintestscomponentstableTables::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td>
|
||||
<td>9. ValueChangeEvent, new value: '[Item 4, Item 9, Item 5, Item 6, Item 10, Item 7, Item 8]'</td>
|
||||
<td>9. ValueChangeEvent, new value: '[Item 10, Item 4, Item 5, Item 6, Item 7, Item 8, Item 9]'</td>
|
||||
</tr>
|
||||
<!--The same thing with nullselectallowed == false-->
|
||||
<tr>
|
||||
@ -259,7 +259,7 @@
|
||||
<tr>
|
||||
<td>assertText</td>
|
||||
<td>vaadin=runcomvaadintestscomponentstableTables::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td>
|
||||
<td>1. ValueChangeEvent, new value: '[Item 3, Item 4, Item 9, Item 5, Item 6, Item 7, Item 8]'</td>
|
||||
<td>1. ValueChangeEvent, new value: '[Item 3, Item 4, Item 5, Item 6, Item 7, Item 8, Item 9]'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>screenCapture</td>
|
||||
@ -309,7 +309,7 @@
|
||||
<tr>
|
||||
<td>assertText</td>
|
||||
<td>vaadin=runcomvaadintestscomponentstableTables::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td>
|
||||
<td>5. ValueChangeEvent, new value: '[Item 9, Item 5, Item 6, Item 10, Item 7, Item 8]'</td>
|
||||
<td>5. ValueChangeEvent, new value: '[Item 10, Item 5, Item 6, Item 7, Item 8, Item 9]'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>screenCapture</td>
|
||||
@ -354,7 +354,7 @@
|
||||
<tr>
|
||||
<td>assertText</td>
|
||||
<td>vaadin=runcomvaadintestscomponentstableTables::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td>
|
||||
<td>9. ValueChangeEvent, new value: '[Item 4, Item 9, Item 5, Item 6, Item 10, Item 7, Item 8]'</td>
|
||||
<td>9. ValueChangeEvent, new value: '[Item 10, Item 4, Item 5, Item 6, Item 7, Item 8, Item 9]'</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
</body>
|
||||
|
Laden…
Verwijs in nieuw issue
Block a user