mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-03 21:58:59 +00:00
Adds targeted test infrastructure and validation checks to protect table drawing hooks and drop-in framework contracts against unintended modifications. * CPTableViewDrawingTest: Verifies subclass invocation order for drawing steps and ensures application-specified background colors persist across theme-state changes. * DropInCompatibilityTest: Validates default theme names, window control configurations, pop-up button bezel styles, and table class defaults. * DropInSnapshot: Encapsulates theme attribute defaults, public API surface, default view construction, and window controls as structured data. * DropInBaselineGenerator: Provides tooling to capture current framework state as a baseline. * DropInBaselineTest: Compares framework artifacts against the established baseline, permitting additions while reporting modifications and removals. * DropInBaseline.json: Introduces the initial compatibility baseline artifact.
78 lines
2.6 KiB
Plaintext
78 lines
2.6 KiB
Plaintext
/*
|
|
* DropInCompatibilityTest.j
|
|
* AppKit
|
|
*
|
|
* Created by David Richardson on 31/10/2026.
|
|
* Copyright David Richardson 2026.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
@import <AppKit/AppKit.j>
|
|
|
|
/*
|
|
Defaults that existing applications rely on. An application that updates its
|
|
frameworks must keep these without any change of its own.
|
|
*/
|
|
@implementation DropInCompatibilityTest : OJTestCase
|
|
|
|
- (void)setUp
|
|
{
|
|
// This will init the global var CPApp which are used internally in the AppKit
|
|
[[CPApplication alloc] init];
|
|
}
|
|
|
|
- (void)testDefaultThemeNameIsAristo2WithoutInfoPlistKey
|
|
{
|
|
[self assertNull:[[CPBundle mainBundle] objectForInfoDictionaryKey:@"CPDefaultTheme"]];
|
|
[self assert:@"Aristo2" equals:[CPApplication defaultThemeName]];
|
|
}
|
|
|
|
- (void)testResizableWindowHasOnlyACloseButton
|
|
{
|
|
var aWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0.0, 0.0, 400.0, 400.0)
|
|
styleMask:CPClosableWindowMask | CPResizableWindowMask],
|
|
subviews = [[aWindow _windowView] subviews],
|
|
count = [subviews count],
|
|
buttonCount = 0;
|
|
|
|
while (count--)
|
|
if ([subviews[count] isKindOfClass:[CPButton class]])
|
|
buttonCount++;
|
|
|
|
[self assert:1 equals:buttonCount];
|
|
}
|
|
|
|
- (void)testPopUpButtonKeepsTheDefaultButtonBezelStyle
|
|
{
|
|
var frame = CGRectMake(0.0, 0.0, 100.0, 24.0),
|
|
popUpButton = [[CPPopUpButton alloc] initWithFrame:frame pullsDown:NO],
|
|
button = [[CPButton alloc] initWithFrame:frame];
|
|
|
|
[self assert:[button bezelStyle] equals:[popUpButton bezelStyle]];
|
|
}
|
|
|
|
- (void)testTableViewGridColorHasAClassDefault
|
|
{
|
|
[self assertFalse:[[[CPTableView themeAttributes] objectForKey:@"grid-color"] isEqual:[CPNull null]]];
|
|
}
|
|
|
|
- (void)testTableViewAlternatingRowColorsHaveAClassDefault
|
|
{
|
|
[self assertFalse:[[[CPTableView themeAttributes] objectForKey:@"alternating-row-colors"] isEqual:[CPNull null]]];
|
|
}
|
|
|
|
@end
|