Lines 55-60
import javax.swing.Icon;
Link Here
|
55 |
import javax.swing.Icon; |
55 |
import javax.swing.Icon; |
56 |
import javax.swing.JButton; |
56 |
import javax.swing.JButton; |
57 |
import javax.swing.JFrame; |
57 |
import javax.swing.JFrame; |
|
|
58 |
import javax.swing.JMenu; |
58 |
import javax.swing.JMenuItem; |
59 |
import javax.swing.JMenuItem; |
59 |
import javax.swing.KeyStroke; |
60 |
import javax.swing.KeyStroke; |
60 |
import javax.swing.text.Keymap; |
61 |
import javax.swing.text.Keymap; |
Lines 372-377
public class ActionsTest extends NbTestC
Link Here
|
372 |
assertEquals(3, tc.getConnectCalled()); |
373 |
assertEquals(3, tc.getConnectCalled()); |
373 |
tc.setActive(false); |
374 |
tc.setActive(false); |
374 |
} |
375 |
} |
|
|
376 |
|
377 |
@SuppressWarnings("deprecation") |
378 |
private static Object peer(Component menu) { |
379 |
return menu.getPeer(); |
380 |
} |
381 |
|
382 |
public void testPopupTextIsTaken() throws Exception { |
383 |
Action action = new ActionsTest.TestAction(); |
384 |
JMenuItem item = new JMenuItem(); |
385 |
JMenu jmenu = new JMenu(); |
386 |
jmenu.addNotify(); |
387 |
assertNotNull("Peer created", peer(jmenu)); |
388 |
jmenu.getPopupMenu().addNotify(); |
389 |
assertNotNull("Peer for popup", peer(jmenu.getPopupMenu())); |
390 |
|
391 |
action.putValue("popupText", "&Ahoj"); |
392 |
action.putValue("menuText", "&Ble"); |
393 |
action.putValue(action.NAME, "&Mle"); |
394 |
|
395 |
Actions.connect(item, action, true); |
396 |
|
397 |
assertEquals('A', item.getMnemonic()); |
398 |
assertEquals("Ahoj", item.getText()); |
399 |
} |
400 |
|
401 |
public void testMenuTextIsTaken() throws Exception { |
402 |
Action action = new ActionsTest.TestAction(); |
403 |
JMenuItem item = new JMenuItem(); |
404 |
JMenu jmenu = new JMenu(); |
405 |
jmenu.addNotify(); |
406 |
assertNotNull("Peer created", peer(jmenu)); |
407 |
jmenu.getPopupMenu().addNotify(); |
408 |
assertNotNull("Peer for popup", peer(jmenu.getPopupMenu())); |
409 |
|
410 |
//action.putValue("popupText", "&Ahoj"); |
411 |
action.putValue("menuText", "&Ble"); |
412 |
action.putValue(action.NAME, "&Mle"); |
413 |
|
414 |
Actions.connect(item, action, true); |
415 |
|
416 |
assertEquals('B', item.getMnemonic()); |
417 |
assertEquals("Ble", item.getText()); |
418 |
} |
419 |
|
420 |
public void testActionNameIsTaken() throws Exception { |
421 |
Action action = new ActionsTest.TestAction(); |
422 |
JMenuItem item = new JMenuItem(); |
423 |
JMenu jmenu = new JMenu(); |
424 |
jmenu.addNotify(); |
425 |
assertNotNull("Peer created", peer(jmenu)); |
426 |
jmenu.getPopupMenu().addNotify(); |
427 |
assertNotNull("Peer for popup", peer(jmenu.getPopupMenu())); |
428 |
|
429 |
//action.putValue("popupText", "&Ahoj"); |
430 |
//action.putValue("menuText", "&Ble"); |
431 |
action.putValue(action.NAME, "&Mle"); |
432 |
|
433 |
Actions.connect(item, action, true); |
434 |
|
435 |
assertEquals('M', item.getMnemonic()); |
436 |
assertEquals("Mle", item.getText()); |
437 |
} |
375 |
|
438 |
|
376 |
|
439 |
|
377 |
protected boolean runInEQ() { |
440 |
protected boolean runInEQ() { |