Setting value of checkbox editor in wizard table doesn't work [message #1777430] |
Wed, 29 November 2017 11:01 |
|
I have a simple wizard page with the following table:
tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION);
tableViewerColumn.setEditingSupport(new EditingSupport(tableViewer) {
TextCellEditor textCellEditor = null;
CheckboxCellEditor boolCellEditor = null;
@Override
protected boolean canEdit(Object element) {
return true;
}
@Override
protected CellEditor getCellEditor(Object element) {
Object value = getValue(element);
if (value instanceof String) {
if (textCellEditor == null) {
textCellEditor = new TextCellEditor((Composite) tableViewer.getControl());
}
return textCellEditor;
}
else if (value instanceof Boolean) {
if (boolCellEditor == null) {
boolCellEditor = new CheckboxCellEditor((Composite) tableViewer.getControl(),
SWT.CHECK | SWT.READ_ONLY);
}
return boolCellEditor;
}
else {
if (textCellEditor == null) {
textCellEditor = new TextCellEditor((Composite) tableViewer.getControl());
}
return textCellEditor;
}
}
@SuppressWarnings("unchecked")
@Override
protected void setValue(Object element, Object value) {
if (value instanceof String) {
((MyProperty<?>) element).setValueString(value != null ? value.toString() : null);
}
else if (value instanceof Boolean) {
((MyProperty<Boolean>) element).setValue(value != null ? (Boolean) value : null);
}
tableViewer.refresh(element, true);
}
@Override
protected Object getValue(Object element) {
return ((MyProperty<?>) element).getValue();
}
});
One of the table items has a boolean value which is set to false per default.
I'm recording the test, and during the recording click the table cell once to set the value to true. This works fine during the test recording! The logic triggered by the true setting is triggered.
However, when I replay the test, the respective logic is not triggered.
I have tried to insert an assertion, but am unsure which value I need to test for. I have tried the following, which will always let the test fail, although the setting during the recording was true!
get-view Navigation | get-tree | get-menu -path "Import..." | click
with [get-window Import] {
get-tree | select "My Import"
get-button "Next >" | click
}
get-window "My Import" | get-table | select "do.something" | double-click
with [get-window "My Import" | get-table] {
select "do.something"
get-cell 5 1 | check
}
get-window "My Import" | get-table | get-item -path "do.something" | get-property "columns[1]"
| equals true | verify-true
with [get-window "My Import"] {
get-button "Next >" | click
get-editbox -after [get-label "Project name; must be unique"] | set-text "simple-project"
get-button Finish | click
}
If anyone knows how to reliably set the value of the table item in a CheckboxCellEditor to true during an RCPTT test, I'd be very thankful!
|
|
|
|
Powered by
FUDForum. Page generated in 0.03675 seconds