mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-02 23:26:16 +00:00
new: manual test
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
* CPMenuTest
|
||||
*
|
||||
* Created by Daniel Boehringer 2025 for submenu constraints on the rightmost end of the screen.
|
||||
* Updated for Issue #3149 (Immediate menu updates).
|
||||
*/
|
||||
|
||||
|
||||
@@ -12,6 +13,11 @@
|
||||
{
|
||||
CPWindow theWindow;
|
||||
BOOL _isEnabled;
|
||||
|
||||
// Ivars for Live Update Test
|
||||
CPMenuItem _changeTitleItem;
|
||||
CPMenuItem _changeStateItem;
|
||||
CPMenuItem _changeEnabledItem;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
@@ -57,6 +63,28 @@
|
||||
var dummyMenuItem2 = [mainMenu addItemWithTitle:@"Dummy Menu 2" action:nil keyEquivalent:@""];
|
||||
[mainMenu setSubmenu:dummyMenu2 forItem:dummyMenuItem2];
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// TEST ADDITION FOR ISSUE #3149: Immediate Updates
|
||||
// -------------------------------------------------------------------------
|
||||
var liveUpdateMenu = [[CPMenu alloc] initWithTitle:@"Live Update"],
|
||||
liveUpdateMenuItem = [mainMenu addItemWithTitle:@"Live Update" action:nil keyEquivalent:@""];
|
||||
|
||||
// Disable auto-enable so we can manually test setEnabled: on items without actions
|
||||
[liveUpdateMenu setAutoenablesItems:NO];
|
||||
[mainMenu setSubmenu:liveUpdateMenu forItem:liveUpdateMenuItem];
|
||||
|
||||
[liveUpdateMenu addItemWithTitle:@"1. Click 'Start Timer' below" action:nil keyEquivalent:@""];
|
||||
[liveUpdateMenu addItemWithTitle:@"2. Keep this menu OPEN" action:nil keyEquivalent:@""];
|
||||
[liveUpdateMenu addItem:[CPMenuItem separatorItem]];
|
||||
|
||||
_changeTitleItem = [liveUpdateMenu addItemWithTitle:@"Title will change in 3s" action:nil keyEquivalent:@""];
|
||||
_changeStateItem = [liveUpdateMenu addItemWithTitle:@"State will change in 3s" action:nil keyEquivalent:@""];
|
||||
_changeEnabledItem = [liveUpdateMenu addItemWithTitle:@"Enabled will change in 3s" action:nil keyEquivalent:@""];
|
||||
|
||||
[liveUpdateMenu addItem:[CPMenuItem separatorItem]];
|
||||
[liveUpdateMenu addItemWithTitle:@"Start 3s Timer" action:@selector(startUpdateTimer:) keyEquivalent:@""];
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
// 2. Create the right-most menu with submenus for testing.
|
||||
var rightTestMenu = [[CPMenu alloc] initWithTitle:@"Right-Side Test"],
|
||||
@@ -106,4 +134,32 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Live Update Test Actions
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
- (void)startUpdateTimer:(id)sender
|
||||
{
|
||||
// Reset state
|
||||
[_changeTitleItem setTitle:@"Title will change in 3s"];
|
||||
[_changeStateItem setState:CPOffState];
|
||||
[_changeStateItem setTitle:@"State will change in 3s"];
|
||||
[_changeEnabledItem setEnabled:YES];
|
||||
[_changeEnabledItem setTitle:@"Enabled will change in 3s"];
|
||||
|
||||
// Trigger update
|
||||
[self performSelector:@selector(performLiveUpdate) withObject:nil afterDelay:3.0];
|
||||
}
|
||||
|
||||
- (void)performLiveUpdate
|
||||
{
|
||||
[_changeTitleItem setTitle:@"Title Changed!"];
|
||||
|
||||
[_changeStateItem setState:CPOnState];
|
||||
[_changeStateItem setTitle:@"State Changed! (Checked)"];
|
||||
|
||||
[_changeEnabledItem setEnabled:NO];
|
||||
[_changeEnabledItem setTitle:@"Enabled Changed! (Disabled)"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user