GP-0 Corrected test failures

This commit is contained in:
ghidra1 2024-11-20 21:19:57 -05:00
parent f6dfa0964a
commit 1dad9f85c0
2 changed files with 21 additions and 12 deletions

View File

@ -186,13 +186,14 @@ public class StructureEditorLockedCellEditTest extends AbstractStructureEditorTe
typeInCellEditor("Ab\bm");
// Bad value prevents action performed.
triggerActionKey(getTable(), 0, KeyEvent.VK_ENTER);
enter();
assertIsEditingField(2, model.getDataTypeColumn());
// Bad value allows escape.
triggerActionKey(getTable(), 0, KeyEvent.VK_ESCAPE);
triggerActionKey(getTable(), 0, KeyEvent.VK_ESCAPE);
assertTrue(model.getStatus().startsWith("Unrecognized data type"));
escape();
assertNotEditingField();
assertEquals(1, model.getNumSelectedRows());
assertEquals(2, model.getMinIndexSelected());
assertEquals(getDataType(2), dt);
@ -214,18 +215,18 @@ public class StructureEditorLockedCellEditTest extends AbstractStructureEditorTe
enter();
assertIsEditingField(2, column);
assertTrue(model.getStatus().startsWith("Unrecognized data type"));
escape();
assertNotEditingField();
assertEquals(1, model.getNumSelectedRows());
assertEquals(2, model.getMinIndexSelected());
assertCellString("word", 2, column);
assertEquals(29, model.getLength());
assertEquals(dt, getDataType(2));
escape();
assertNotEditingField();
assertEquals(dt, getDataType(2));
}
@Test
@ -237,6 +238,7 @@ public class StructureEditorLockedCellEditTest extends AbstractStructureEditorTe
assertEquals(29, model.getLength());
assertEquals(2, dt.getLength());
clickTableCell(getTable(), 2, column, 2);
assertIsEditingField(2, column);
@ -244,9 +246,12 @@ public class StructureEditorLockedCellEditTest extends AbstractStructureEditorTe
enter();
assertIsEditingField(2, column);
escape();
assertTrue(model.getStatus().startsWith(str + " doesn't fit"));
escape();
assertNotEditingField();
assertEquals(1, model.getNumSelectedRows());
assertEquals(2, model.getMinIndexSelected());
assertCellString(dt.getDisplayName(), 2, column);
@ -386,8 +391,8 @@ public class StructureEditorLockedCellEditTest extends AbstractStructureEditorTe
init(simpleStructure, pgmBbCat);
startTransaction("addExternal");
ExternalLocation extLoc = program.getExternalManager().addExtFunction(Library.UNKNOWN,
"extLabel", null, SourceType.USER_DEFINED);
ExternalLocation extLoc = program.getExternalManager()
.addExtFunction(Library.UNKNOWN, "extLabel", null, SourceType.USER_DEFINED);
Function function = extLoc.createFunction();
endTransaction(true);

View File

@ -21,6 +21,7 @@ import java.awt.Window;
import org.junit.*;
import docking.DialogComponentProvider;
import ghidra.program.model.data.*;
import ghidra.util.Swing;
import ghidra.util.exception.DuplicateNameException;
@ -91,6 +92,9 @@ public class StructureEditorNotifiedTest extends AbstractStructureEditorTest {
programDTM.getCategory(pgmRootCat.getCategoryPath())
.removeCategory("Temp", TaskMonitor.DUMMY);
DialogComponentProvider dlg = waitForDialogComponent("Close Structure Editor?");
pressButton(dlg.getComponent(), "No");
waitForSwing();
// complexStructure* gets removed and becomes 4 undefined bytes in this editor.