Tests - fixed test timing issues

This commit is contained in:
dragonmacher 2020-02-06 18:08:21 -05:00
parent e16bd30366
commit cc6020736c
3 changed files with 85 additions and 24 deletions

View file

@ -190,10 +190,23 @@ public abstract class AbstractSortedTableModel<T> extends AbstractGTableModel<T>
return pendingSortState;
}
/**
* Returns true if there is a pending change to the current sort state
* (this includes a sort state that signals no sort will be applied)
*
* @return true if there is a pending change to the current sort state
*/
public boolean isSortPending() {
return isSortPending;
}
/**
* Returns true if this model has been sorted and does not have a new pending sort that will
* be applied
*
* @return true if sorted
* @see #isSortPending()
*/
public boolean isSorted() {
return !isSortPending && !sortState.isUnsorted();
}

View file

@ -1747,8 +1747,15 @@ public class GhidraFileChooserTest extends AbstractDockingTest {
public void testHistoryRestoresSelectedFiles() throws Exception {
File startDir = createTempDir();
setDir(startDir);
createFileSubFile(startDir, 3);
File subDir = createFileSubFile(startDir, 3);
setDir(subDir);
// // debug
// DirectoryList list = getListView();
// ListSelectionModel sm = list.getSelectionModel();
// sm.addListSelectionListener(e -> {
// Msg.debug(this, "selection changed: " + e);
// });
pressUp();
selectFile(getListView(), 1);
@ -1930,6 +1937,11 @@ public class GhidraFileChooserTest extends AbstractDockingTest {
}
private File selectFile(DirectoryList list, int index) {
// TODO debug - remove when all tests passing on server
int size = list.getModel().getSize();
Msg.debug(this, "selectFile() - new index: " + index + "; list size: " + size);
runSwing(() -> list.setSelectedIndex(index));
return runSwing(() -> list.getSelectedFile());
}