|
10 | 10 | #import "PBFileChangesTableView.h" |
11 | 11 | #import "PBNativeContentView.h" |
12 | 12 | #import "PBTask.h" |
| 13 | +#import "PBWebController.h" |
13 | 14 | #import "NSAppearance+PBDarkMode.h" |
14 | 15 |
|
15 | 16 | @interface PBFileChangesActionTarget : NSObject <NSTableViewDataSource, NSTableViewDelegate, PBFileChangesTableViewStagingDelegate> |
@@ -263,6 +264,24 @@ - (void)testNativeDiffCombinesSyntaxAndDiffHighlighting |
263 | 264 | XCTAssertNotNil([storage attribute:NSBackgroundColorAttributeName atIndex:textLine.location + 1 effectiveRange:nil]); |
264 | 265 | } |
265 | 266 |
|
| 267 | +- (void)testNativeHistoryContentTracksHostBoundsWhileResizing |
| 268 | +{ |
| 269 | + NSView *host = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 700, 420)]; |
| 270 | + PBWebController *controller = [[PBWebController alloc] init]; |
| 271 | + controller.view = host; |
| 272 | + [controller awakeFromNib]; |
| 273 | + [controller.nativeView showMessage:@"Resize-safe history content"]; |
| 274 | + |
| 275 | + for (NSValue *sizeValue in @[ [NSValue valueWithSize:NSMakeSize(360, 240)], [NSValue valueWithSize:NSMakeSize(980, 640)], [NSValue valueWithSize:NSMakeSize(520, 300)] ]) { |
| 276 | + host.frameSize = sizeValue.sizeValue; |
| 277 | + [host layoutSubtreeIfNeeded]; |
| 278 | + XCTAssertTrue(NSEqualRects(controller.nativeView.frame, host.bounds)); |
| 279 | + XCTAssertTrue([controller.nativeView.textView.string containsString:@"Resize-safe history content"]); |
| 280 | + } |
| 281 | + |
| 282 | + [controller closeView]; |
| 283 | +} |
| 284 | + |
266 | 285 | - (void)testNativeDiffAlwaysRendersLargePatches |
267 | 286 | { |
268 | 287 | PBNativeContentView *view = [[PBNativeContentView alloc] initWithFrame:NSMakeRect(0, 0, 500, 300)]; |
|
0 commit comments