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

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -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.