From d6c7fecf64f8c3d2a1b249ef528cd153805587de Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Mon, 9 May 2011 01:33:03 -0400 Subject: [PATCH] Closes #684. Cleaned up, added attribution and instructions for the CPWebView2 manual test. --- Tests/Manual/CPWebViewTest2/AppController.j | 42 +++++++++++++-------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/Tests/Manual/CPWebViewTest2/AppController.j b/Tests/Manual/CPWebViewTest2/AppController.j index 414a502c3..5b56b9d2f 100644 --- a/Tests/Manual/CPWebViewTest2/AppController.j +++ b/Tests/Manual/CPWebViewTest2/AppController.j @@ -1,10 +1,20 @@ @import +/*! + This test is based on the code by `tiredashell` for issue #684 and can be used to verify that when a CPWebView is hidden at an initial small size and then later unhidden at a larger, the content reflows properly. + When you click "Unhide (loadHTMLString)" you should see: + + WITHOUT the fix: the Lorem ipsum text is constrained to a too narrow width and does not reflow. + WITH fix c42295f0c7b6ed0a12a8ed472991a3e3ebcc2ecb: the Lorem ipsum text reflows but the scrollbars may not reflect the new content size. + WITH fix c42295f0c7b6ed0a12a8ed472991a3e3ebcc2ecb and 2563cb5dc13778074f5b20b8989b1f5ac1e4af2b: the Lorem ipsum text reflows to the available width and the scrollbars update. + + The web view on the right "Unhide (URL)" should work with and without the fixes. +*/ @implementation AppController : CPObject { - CPButton button; - CPButton button2; + CPButton unhideHtmlButton; + CPButton unhideUrlButton; CPWebView webview; CPWebView webview2; } @@ -14,19 +24,19 @@ var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], contentView = [theWindow contentView]; - button = [[CPButton alloc] initWithFrame:CGRectMakeZero()]; - [button setTitle:"Unhide (loadHTMLString)"]; - [button sizeToFit]; - [button setTarget:self]; - [button setAction:@selector(buttonClicked:)]; - [contentView addSubview:button]; + unhideHtmlButton = [[CPButton alloc] initWithFrame:CGRectMakeZero()]; + [unhideHtmlButton setTitle:"Unhide (loadHTMLString)"]; + [unhideHtmlButton sizeToFit]; + [unhideHtmlButton setTarget:self]; + [unhideHtmlButton setAction:@selector(unhideHtmlButtonClicked:)]; + [contentView addSubview:unhideHtmlButton]; - button2 = [[CPButton alloc] initWithFrame:CGRectMake([contentView frameSize].width / 2 + 10, 0, 0, 0)]; - [button2 setTitle:"Unhide (URL)"]; - [button2 sizeToFit]; - [button2 setTarget:self]; - [button2 setAction:@selector(button2Clicked:)]; - [contentView addSubview:button2]; + unhideUrlButton = [[CPButton alloc] initWithFrame:CGRectMake([contentView frameSize].width / 2 + 10, 0, 0, 0)]; + [unhideUrlButton setTitle:"Unhide (URL)"]; + [unhideUrlButton sizeToFit]; + [unhideUrlButton setTarget:self]; + [unhideUrlButton setAction:@selector(unhideUrlButtonClicked:)]; + [contentView addSubview:unhideUrlButton]; webview = [[CPWebView alloc] initWithFrame:CGRectMake(0, 40, [contentView frameSize].width / 2 - 10, [contentView frameSize].height - 40)]; [webview setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable]; @@ -46,12 +56,12 @@ //[CPMenu setMenuBarVisible:YES]; } -- (void)buttonClicked:(id)sender +- (void)unhideHtmlButtonClicked:(id)sender { [webview setHidden:NO]; } -- (void)button2Clicked:(id)sender +- (void)unhideUrlButtonClicked:(id)sender { [webview2 setHidden:NO]; }