Closes #684. Cleaned up, added attribution and instructions for the CPWebView2 manual test.

This commit is contained in:
Alexander Ljungberg
2011-05-09 01:36:23 -04:00
parent 1392714896
commit d6c7fecf64
+26 -16
View File
@@ -1,10 +1,20 @@
@import <Foundation/CPObject.j>
/*!
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];
}