Commit Graph
494 Commits
Author SHA1 Message Date
David Richardson 66ea130c8d AppKit: Disable Undo and Redo when a text view does not allow undo
A text view handled undo: and redo: and registered its changes even when allowsUndo was NO, so Edit > Undo stayed enabled and did nothing.

Behaviour now follows canonical Cocoa: a text view that does not allow undo registers nothing and passes undo: and redo: on to the window, and Undo and Redo are enabled only when there is a change to undo or redo.

* CPTextView/CPTextView.j: Register changes only when undo is allowed, stop responding to undo: and redo: when it is not, and validate the Undo and Redo items against the undo manager.

* CPWindow/CPWindow.j: Validate the Undo and Redo items against the window's undo manager.

* Tests/AppKit/CPTextViewTest.j: Add tests for responding to undo:, registering changes and validating the Undo item.

* Tests/Manual/TextEditor/DocumentWindowController.j: Add toggleAllowsUndo: and validateMenuItem:, so that undo can be turned on and off for the active document.

* Tests/Manual/TextEditor/Resources/MainMenu.xib, Resources/MainMenu.cib: Add Edit > Allow Undo.

* Tests/Manual/TextEditor/WORKLIST.md: Remove the entry for this gap, record Allow Undo as tested, and add the key equivalent behaviour of disabled menu items for discussion.
2026-10-23 17:20:27 -06:00
David Richardson 055ae6d04e AppKit: List the application's windows in the Windows menu
The Window menu never listed the application's windows, because AppKit had none of Cocoa's Windows menu support.

* CPApplication.j: Add windowsMenu, setWindowsMenu:, addWindowsItem:title:filename:, changeWindowsItem:title:filename:, removeWindowsItem:, updateWindowsItem: and arrangeInFront:; find the menu named _CPWindowsMenu in the main menu, and list the visible windows when the main menu is set.

* CPWindow/CPWindow.j: Add isExcludedFromWindowsMenu and setExcludedFromWindowsMenu:, and keep the window's item current when the window is ordered in or out, retitled, made main or no longer main, miniaturized, deminiaturized or closed.

* Tests/AppKit/CPApplicationWindowsMenuTest.j: Add tests for listing, retitling, exclusion, the main window check mark, separator handling, file name titles and moving items to another Windows menu.

* Tests/Manual/TextEditor/WORKLIST.md: Remove the entry for this gap, and record the Window menu as tested.
2026-10-23 16:29:46 -06:00
David Richardson be8d536565 Merge branch 'main' into refactor-remove-nativehost-target 2026-10-22 12:44:13 -06:00
David Richardson 203bf38b21 AppKit: Size vertical scrollers by scroller style in CPScrollView
CPScrollView's frame and content size calculations sized the vertical scroller with scrollerWidthForControlSize:, passing a scroller style, so it always took the legacy width.

* CPScrollView: Use scrollerWidthInStyle: for the vertical scroller in +contentSizeForFrameSize:… and +frameSizeForContentSize:….
* CPScrollViewTest: Add tests for both methods with a scroller whose widths differ by style.
2026-10-22 12:36:32 -06:00
David Richardson f1a8b154fc AppKit: Fix CPDOMAvailable read before assignment
CPDOMAvailable was read during load before it was assigned.

* CPCompatibility: Move the CPDOMAvailable assignment ahead of the engine detection, whose AppleWebKit case calls +[CPPlatform isBrowser], which reads it.
* CPCompatibilityTest: Add a test that re-executes CPCompatibility.j with an AppleWebKit user agent and CPDOMAvailable unset, failing on any exception.
2026-10-15 09:26:12 -06:00
David Richardson 7f38fbe7c7 Tests: promote CPDOMDisplayServer.h to a real source file
- the 11 display-server primitives become plain functions in
  Platform/DOM/CPDOMDisplayServer.j; bodies verbatim from the macro
  definitions; the header was force-included into every AppKit
  compilation by the legacy build and invisible to capp-build
- CPView.j, CPImageView.j, _CPDisplayServer.j import the new file;
  this was the last header in either framework
- CPDOMDisplayServerTest: the raw #include replaced by the
  framework-qualified import
2026-10-06 18:50:09 -06:00
David Richardson 7f89b13387 Tests: convert CPLevelIndicatorTest helper macro to direct messages
- the six GET_LEVEL_INDICATOR_SEGMENT call sites become direct
  layoutEphemeralSubviewNamed: messages; the macro was fully
  parameterized with no ambient state
- the segment index is the literal 0 at every site, so the
  concatenation folds to a constant string
- the warning comment about direct ephemeral-subview access is
  retained
2026-10-06 18:33:52 -06:00
David Richardson 2167c1d3b8 AppKit: delete IE-era VML rendering backend
- CoreGraphics/CGContextVML.j removed; it implemented the CGContext
  function family against Internet Explorer's VML, irrelevant in the
  supported browser landscape for over a decade
- its self-replacing CGBitmapGraphicsContextCreate wrapper called
  document.namespaces.add, an IE-only API — a latent crash on modern
  browsers had the branch ever been selected
- CGContext.j: the CPVMLFeature branch of the load-time backend
  selection removed; CPCompatibility.j: the CPVMLFeature constant and
  its feature-table entry removed
- Tests/AppKit/CGContextTest.j: the vacuous VML-incompatibility
  assertion removed
- the canvas backend and the no-canvas stubs are unchanged
2026-10-06 18:08:43 -06:00
David Richardson bdc2b7cd67 test: disable unasserted performance benchmarks in CPArray suites
Prefix unasserted performance tests with 'disabled_' in CPArrayControllerTest
and CPArrayPerformanceTest to eliminate wall-clock timing noise from standard
CI runs.

Add a dummy assertion to CPArrayPerformanceTest to maintain runner
compatibility without executing obsolete micro-benchmarks.
2026-08-31 09:49:44 -06:00
David Richardson 3a140b07fe Fix child-node index arithmetic and expand CPTreeNode test coverage
CPTreeNode.j:
* Correct index calculations in insertObject:inChildNodesAtIndex: and replaceObjectInChildNodesAtIndex:withObject:. Nodes no longer misplace during same-parent or cross-parent moves.
 * Update _removeChildNode: to call removeObjectFromChildNodesAtIndex:. This ensures detaches notify childNodes observers on the original parent.

CPTreeNodeTest.j:
* Add test coverage for same-parent replacement, cycle rejection on replace-path, KVO during cross-parent moves, mutableChildNodes proxy operations, insertion bounds, non-recursive sorting, isLeaf, and descendantNodeAtIndexPath: edge cases.
* Disable same-parent childNodes KVO test. CPKeyValueObserving.j coalesces nested change notifications on the same key, which drops the inner removal event.
* Disable parentNode KVO test. No setParentNode: method exists to instrument.
* Add inline comments to both disabled tests explaining these mechanisms.
2026-08-28 13:35:27 -06:00
David Richardson ee0c6fdf2d CPTreeNodeTest: fix child-move index arithmetic; correct a flawed test expectation
CPTreeNode: same-parent child moves no longer misplace the moved node — this corrects a defect in the class itself, properly exposed by the test.

Separately, the unit test's expectation for a root node's index path was itself wrong.
Corrected to match the class's existing, contract-correct behavior.

Test unit now runs cleanly.
2026-08-27 16:54:31 -06:00
David Richardson 54b7d24081 Merge branch 'main' into CPTreeNode-improve-tests 2026-08-27 16:02:08 -06:00
daboe01 acf410776d Merge pull request #3279 from daboe01/whitespace-cleanup
fixed: usage of tab character instead of 4 spaces
2026-08-26 20:46:52 +02:00
daboe01 6ef3cf776f new: selection tests 2026-08-25 20:39:34 +02:00
David Richardson fad987641b Improve and extend CPTreeNode tests 2026-08-19 11:41:39 -06:00
daboe01 567ec55875 fixed: usage of tab character instead of 4 spaces 2026-08-18 19:46:22 +02:00
David Richardson 1a9a42ff54 Replace #pragma mark with // MARK:
Replace objc directive with native Javascript version // MARK: to facilitate elimination of preproccsing pass.
2026-07-21 15:15:53 -06:00
daboe01 9ecc739e8d Merge pull request #3186 from daboe01/colorpanel-fixes
Fix CPColorWell drag-and-drop and responder chain integration
2026-03-25 19:33:27 +01:00
daboe01 031e5e7ca3 fixed: selection issues 2026-03-08 19:52:58 +01:00
daboe01 b1f2fb44a8 new: CPOutlineView bindings support 2026-03-07 21:43:41 +01:00
daboe01 cd4c3cffe0 fixed: test cases 2026-03-07 20:05:50 +01:00
daboe01 98c01b88e2 fixed various binding issues 2026-03-07 20:00:09 +01:00
daboe01 12960f8160 new: testcase 2026-03-07 19:27:01 +01:00
daboe01 1bbf87e2cb fixed: testcases 2026-02-28 18:26:47 +01:00
daboe01 8db24fcaf6 new: testcases from enquora 2026-02-28 16:46:34 +01:00
daboe01 e198fbdc40 Merge pull request #3122 from daboe01/fixed-keycode-management-in-cptextview
fixed: Keyboard-event handling is based on the deprecated charCode
2026-01-28 20:57:07 +01:00
daboe01 dc23fe49af new: unit tests 2025-09-04 11:54:06 +03:00
daboe01 c2d07b7b06 Merge pull request #3120 from daboe01/nil-in-cpviewcontroller-fix
fixed: subview's window setting did not happen BEFORE _setSuperview
2025-07-17 19:27:36 +02:00
daboe01 e9022d045c Merge pull request #3123 from daboe01/new-viewcontroller-responder-chain-issue
fixed: CPViewController doesn't participate fully in responder chain
2025-07-05 16:41:23 +02:00
daboe01 c70ea739ec fixed: unittest was overambitious 2025-07-05 16:39:10 +02:00
daboe01 85da0164ba fixed: designated initialiser was not used 2025-07-05 16:32:22 +02:00
daboe01 2add37983d new: unittest for responderchain 2025-07-05 15:56:44 +02:00
daboe01 27280f6da1 Update CPMenuTest.j 2025-07-05 12:35:43 +02:00
daboe01 ce7fec170a Update CPEventTest.j 2025-07-05 12:33:21 +02:00
daboe01 98ef6fd902 Update CPEventTest.j 2025-07-05 12:30:58 +02:00
daboe01 1c4d9b1d8f Update CPButtonTest.j 2025-07-05 12:29:11 +02:00
daboe01 b8b988c10b Update CPResponderTest.j 2025-07-05 09:04:26 +02:00
daboe01 d12770c65d fixed: testcase for keyevent 2025-07-05 08:57:29 +02:00
daboe01 bae78b5055 formatting 2025-06-22 21:52:57 +02:00
daboe01 c0705448cd new: testcase 2025-06-22 21:47:26 +02:00
daboe01 3a9db70426 fixed: CPObjectController returns 'null marker' instead of nil 2025-06-22 11:04:46 +02:00
daboe01 2f563fb870 New: give nil values the chance to be transformed to true via CPNegateBoolean (#3103) 2025-04-28 15:40:57 +02:00
Martin Carlberg d9e27e549f Fixed: Removed compiler warnings in test case 2021-09-21 11:11:57 +02:00
Martin Carlberg 9f14dac5d2 Fixed: Cleanup of the output from our test cases 2021-09-21 11:11:25 +02:00
Martin Carlberg 6b1cdbd19c Fixed: Removed compiler warnings from test cases 2021-09-21 10:58:03 +02:00
Martin Carlberg 89757e35e6 Fixed: Class Swapper should convert NSView -> CPView.
This is needed when a plain NSView is use without a Custom class name as it will otherwise try to create a NSView.
Also the Class Swapper is only used when the 'Instantiation' is check for 'Prefer code' under
the 'Runtime Behavior' header in the Document tab in Xcode. If this is not checked the '_CPCibCustomView'
is used instead of the Class Swapper.
2021-09-21 10:46:18 +02:00
Martin Carlberg 511e18b44f Fixed: Wait for the bundle load to finish with the new async bundle load function 2021-09-17 21:55:48 +02:00
Martin Carlberg ab4c87e69f Fixed: Removed warnings and cleanup for test cases when converting to Node 2021-09-15 17:31:20 +02:00
Martin Carlberg a893f3f5c1 Fixed: The tool ojtest now works with the new Node version. 2021-09-03 14:31:11 +02:00
daboe01 677076b89d fixed: some cib files have been outdated 2021-04-01 18:04:06 +02:00