Workplace Widget 5.10.23

This commit is contained in:
chris
2026-11-08 17:45:04 +00:00
parent 180127e2ae
commit 60d35e2326
98 changed files with 4221 additions and 268 deletions

View File

@@ -0,0 +1,84 @@
package com.widgetworkbench.cheerpj;
import com.itac.mes.gui.dialog.MesLoginDialog;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
/**
* Test-only window fixture verifying iTAC class-name detection and owner
* geometry. Requires the unsiged fixture in hmi-scripts/tests/fixtures.
* Do NOT bundle the fixture MesLoginDialog into the production bridge JAR.
*/
public final class WorkplaceLoginHotfixSmoke {
private static final class MyDoggyTestPanel extends JPanel { }
private static void check(boolean ok, String label) {
if (!ok) throw new AssertionError(label);
}
public static void main(String[] args) throws Exception {
if (GraphicsEnvironment.isHeadless()) {
System.out.println("WORKPLACE_LOGIN_HOTFIX_HEADLESS_PASS");
return;
}
JFrame owner = new JFrame();
owner.setSize(520, 420);
owner.setLocation(1900, 1250);
final MesLoginDialog[] holder = new MesLoginDialog[1];
SwingUtilities.invokeAndWait(() -> {
MesLoginDialog login = new MesLoginDialog(owner);
login.setSize(450, 350);
login.setLocation(2400, 1300);
holder[0] = login;
// Do not show modal JDialog via setVisible(true) on the EDT;
// that call enters a nested event loop. make it visible on test
// without ever invoking the proprietary iTAC login method.
login.setModal(false);
login.setVisible(true);
});
try {
String snapshot = WorkplaceResizeBridge.diagnoseWindows(960, 640);
check(snapshot.contains("MES_LOGIN state=VISIBLE_OFFSCREEN observed=1"), "login class detected");
check(snapshot.contains("MES_LOGIN_OWNER class=javax.swing.JFrame"), "owner identified");
check(snapshot.contains("visible=false") && snapshot.contains("offscreen=true"), "invisible/offscreen owner reported");
check(snapshot.contains("COMPONENT_TREE scanned="), "nested inventory available");
String rescue = WorkplaceResizeBridge.rescueOffscreenDialogs(960, 640);
check(rescue.contains("loginMoved=1"), "targeted login rescue");
check(!WorkplaceResizeBridge.isOutside(holder[0].getBounds(),new Rectangle(0, 0, 960, 640)), "login visible after rescue");
check(WorkplaceResizeBridge.rescueOffscreenDialogs(960, 640).contains("loginMoved=0"), "idempotent rescue");
SwingUtilities.invokeAndWait(() -> holder[0].setVisible(false));
check(WorkplaceResizeBridge.diagnoseWindows(960,640).contains("MES_LOGIN state=CREATED_HIDDEN"), "hidden dialog distinguishable");
} finally {
SwingUtilities.invokeAndWait(() -> { holder[0].dispose(); owner.dispose(); });
}
JFrame nested = new JFrame();
SwingUtilities.invokeAndWait(() -> {
JDesktopPane desk = new JDesktopPane();
JInternalFrame child = new JInternalFrame();
child.setBounds(20, 20, 100, 100);
desk.add(child);
nested.add(desk);
nested.add(new JOptionPane(), java.awt.BorderLayout.SOUTH);
nested.add(new MyDoggyTestPanel(), java.awt.BorderLayout.NORTH);
nested.add(new JTextField("DO_NOT_LOG_PASSWORD"), java.awt.BorderLayout.WEST);
nested.setSize(400, 300);
nested.setVisible(true);
});
try {
String snapshot = WorkplaceResizeBridge.diagnoseWindows(960, 640);
check(snapshot.contains("internalFrames=1"), "internal frame inventoried");
check(snapshot.contains("desktops=1"), "desktop inventoried");
check(snapshot.contains("optionPanes=1"), "option pane inventoried");
check(snapshot.contains("myDoggy=1"), "MyDoggy classname diagnostic");
check(!snapshot.contains("DO_NOT_LOG_PASSWORD"), "component text and secrets excluded");
} finally {
SwingUtilities.invokeAndWait(nested::dispose);
}
System.out.println("WORKPLACE_LOGIN_HOTFIX_JAVA11_PASS");
}
}