Merge remote-tracking branch 'origin/GP-0-dragonmacher-test-fixes-5-19-26'

This commit is contained in:
Ryan Kurtz
2026-05-19 14:28:27 -04:00
9 changed files with 30 additions and 106 deletions
@@ -87,8 +87,6 @@ public class DataTypeSelectionDialogTest extends AbstractGhidraHeadedIntegration
setErrorGUIEnabled(false);
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
env = new TestEnv();
tool = env.getTool();
@@ -1148,13 +1146,6 @@ public class DataTypeSelectionDialogTest extends AbstractGhidraHeadedIntegration
public static void main(String[] args) throws Exception {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception e) {
e.printStackTrace();
}
JFrame frame = new JFrame(DropDownSelectionTextField.class.getName());
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
@@ -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.
@@ -21,7 +21,6 @@ import java.util.*;
import org.junit.*;
import generic.test.TestUtils;
import ghidra.app.cmd.disassemble.DisassembleCommand;
import ghidra.app.cmd.function.CreateFunctionCmd;
import ghidra.program.database.ProgramBuilder;
@@ -404,7 +403,8 @@ public class SymbolManagerTest extends AbstractGhidraHeadedIntegrationTest {
Symbol[] symbols = symbolTable.getSymbols(address);
assertEquals("DAT_0481_00b6", symbols[0].getName());
TestUtils.invokeInstanceMethod("refresh", symbols[0]);
SymbolDB symbolDb = (SymbolDB) symbols[0];
symbolDb.refresh(null);
assertEquals("DAT_0481_00b6", symbols[0].getName());
}
finally {
@@ -1613,7 +1613,7 @@ public class SymbolManagerTest extends AbstractGhidraHeadedIntegrationTest {
AddressSet set1 = new AddressSet();
set1.addRange(addr(100), addr(150));
Function f1 = listing.createFunction("aaaa", addr(100), set1, SourceType.USER_DEFINED);
listing.createFunction("aaaa", addr(100), set1, SourceType.USER_DEFINED);
AddressSet set2 = new AddressSet();
set2.addRange(addr(200), addr(250));
@@ -2220,7 +2220,7 @@ public class SymbolManagerTest extends AbstractGhidraHeadedIntegrationTest {
AddressSet set1 = new AddressSet();
set1.addRange(addr(100), addr(150));
Function f1 = listing.createFunction("fredFunc", addr(100), set1, SourceType.USER_DEFINED);
listing.createFunction("fredFunc", addr(100), set1, SourceType.USER_DEFINED);
AddressSet set2 = new AddressSet();
set2.addRange(addr(200), addr(250));
@@ -2419,7 +2419,8 @@ public class SymbolManagerTest extends AbstractGhidraHeadedIntegrationTest {
createLabel(addr(offset), "offset" + offset);
}
int total = 0;
for (Symbol s : symbolTable.getAllSymbols(true)) {
SymbolIterator it = symbolTable.getAllSymbols(true);
for (; it.hasNext(); it.next()) {
total += 1;
}
assertEquals(offset, total);
@@ -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.
@@ -15,7 +15,8 @@
*/
package docking.widgets.list;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.*;
import javax.swing.*;
@@ -292,43 +293,4 @@ public class ListPanel<T> extends JPanel {
public void ensureIndexIsVisible(int index) {
list.ensureIndexIsVisible(index);
}
/**
* Simple test for ListPanel class.
* @param args test args not used
*/
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception exc) {
System.out.println("Error loading L&F: " + exc);
}
final JFrame frame = new JFrame("ListPanel");
frame.getContentPane().setLayout(new GridLayout(1, 1));
final ListPanel<String> lbp = new ListPanel<>();
final DefaultListModel<String> listModel = new DefaultListModel<>();
frame.getContentPane().add(lbp);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
listModel.addElement("Ellen");
listModel.addElement("Bill");
listModel.addElement("Mike");
listModel.addElement("Dennis");
lbp.setListModel(listModel);
lbp.setListTitle("Developers");
frame.pack();
frame.setVisible(true);
}
}
@@ -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.
@@ -39,11 +39,7 @@ public class NewTestApp extends JPanel {
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception e1) {
}
System.setProperty(SystemUtilities.HEADLESS_PROPERTY, Boolean.FALSE.toString());
JFrame frame = new JFrame("Test App");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@@ -230,9 +226,8 @@ class DragNDropHandler implements GTreeDragNDropHandler {
Msg.info(this, "Dropped the following Files onto " + destUserData);
try {
List<?> list = (List<?>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
Iterator<?> it = list.iterator();
while (it.hasNext()) {
Msg.info(this, "\t" + it.next());
for (Object element : list) {
Msg.info(this, "\t" + element);
}
}
catch (UnsupportedFlavorException e) {
@@ -263,9 +258,8 @@ class DragNDropHandler implements GTreeDragNDropHandler {
}
else if (flavor.equals(DataFlavor.stringFlavor)) {
StringBuffer buf = new StringBuffer();
Iterator<?> it = dragUserData.iterator();
while (it.hasNext()) {
buf.append(it.next().toString());
for (GTreeNode element : dragUserData) {
buf.append(element.toString());
buf.append("\n");
}
return buf.toString();
@@ -18,7 +18,8 @@ package docking.widgets.textfield;
import java.math.BigInteger;
import java.util.concurrent.atomic.AtomicIntegerArray;
import javax.swing.*;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -37,7 +38,6 @@ public abstract class AbstractIntegerTextFieldTest<T extends AbstractIntegerText
@Before
public void setUp() throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
field = createField();
field.setShowNumberMode(true);
textField = (JTextField) field.getComponent();
@@ -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.
@@ -18,7 +18,6 @@ package docking.widgets.textfield;
import static org.junit.Assert.*;
import javax.swing.JFrame;
import javax.swing.UIManager;
import org.junit.*;
@@ -31,7 +30,6 @@ public class FloatingPointTextFieldTest extends AbstractDockingTest {
@Before
public void setUp() throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
field = new FloatingPointTextField(10);
frame = new JFrame("Test");
frame.getContentPane().add(field);
@@ -29,7 +29,6 @@ import org.apache.commons.lang3.StringUtils;
import docking.framework.DockingApplicationConfiguration;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults.Colors.Messages;
import generic.theme.Gui;
import ghidra.GhidraApplicationLayout;
import ghidra.GhidraLaunchable;
import ghidra.framework.Application;
@@ -777,8 +776,6 @@ public class DataTypeArchiveTransformer implements GhidraLaunchable {
// changed name. This is needed to map a data type's old path name to the new one.
performClassSearching(appConfig.getTaskMonitor());
fixupGUI();
UniversalIdGenerator.initialize();
final JFrame frame = new JFrame("Transform Data Type Archive");
frame.setLayout(new GridBagLayout());
@@ -900,23 +897,4 @@ public class DataTypeArchiveTransformer implements GhidraLaunchable {
Msg.debug(this, "Class searching unexpectedly cancelled.");
}
}
public static void fixupGUI() {
// Make the test look & feel as it would normally.
SystemUtilities.runSwingNow(() -> {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception e1) {
Msg.debug(DataTypeArchiveTransformer.class,
"Unable to install the system Look and Feel");
}
});
// Fix up the default fonts that Java 1.5.0 changed to Courier, which looked terrible.
Font f = Gui.getFont("font.monospaced");
UIManager.put("PasswordField.font", f);
UIManager.put("TextArea.font", f);
}
}
@@ -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.
@@ -22,7 +22,8 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.swing.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import org.junit.*;
@@ -50,7 +51,6 @@ public class PathManagerTest extends AbstractDockingTest {
@Before
public void setUp() throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
List<Path> paths = new ArrayList<>();
paths.add(new Path(new File("c:\\path_one")));
paths.add(new Path(new File("c:\\path_two")));
@@ -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.
@@ -57,7 +57,7 @@ public class PathnameTablePanelTest extends AbstractDockingTest {
@Before
public void setUp() throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// enable edits, add to bottom, ordered
panel = new PathnameTablePanel(tablePaths, () -> reset(), true, false, true, false);
table = panel.getTable();