Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-0 Corrected test failures

ghidra11dad9f85c022
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorLockedCellEditTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorLockedCellEditTest.java
index 35b3c0f5ca..6570c122a2 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorLockedCellEditTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorLockedCellEditTest.java
@@ -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);
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorNotifiedTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorNotifiedTest.java
index 7484ad7d9d..295fb63766 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorNotifiedTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorNotifiedTest.java
@@ -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.