Title: [248186] trunk/Tools
- Revision
- 248186
- Author
- [email protected]
- Date
- 2019-08-02 15:57:58 -0700 (Fri, 02 Aug 2019)
Log Message
TextAutosizingBoost.ChangeAutosizingBoostAtRuntime fails on iPad Simulator
https://bugs.webkit.org/show_bug.cgi?id=200402
<rdar://problem/53823368>
Reviewed by Tim Horton.
Make it possible to run this test using the iPad simulator.
* TestWebKitAPI/Tests/ios/TextAutosizingBoost.mm:
Two adjustments: (1) override the screen size to be 320 by 568 (so that the legacy text autosizing heuristic
doesn't avoid boosting this text), and (2) force text autosizing on, but disable idempotent text autosizing,
since this would result in differently sized text.
(mainScreenReferenceBoundsOverride):
* TestWebKitAPI/ios/UIKitSPI.h:
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (248185 => 248186)
--- trunk/Tools/ChangeLog 2019-08-02 22:20:54 UTC (rev 248185)
+++ trunk/Tools/ChangeLog 2019-08-02 22:57:58 UTC (rev 248186)
@@ -1,3 +1,22 @@
+2019-08-02 Wenson Hsieh <[email protected]>
+
+ TextAutosizingBoost.ChangeAutosizingBoostAtRuntime fails on iPad Simulator
+ https://bugs.webkit.org/show_bug.cgi?id=200402
+ <rdar://problem/53823368>
+
+ Reviewed by Tim Horton.
+
+ Make it possible to run this test using the iPad simulator.
+
+ * TestWebKitAPI/Tests/ios/TextAutosizingBoost.mm:
+
+ Two adjustments: (1) override the screen size to be 320 by 568 (so that the legacy text autosizing heuristic
+ doesn't avoid boosting this text), and (2) force text autosizing on, but disable idempotent text autosizing,
+ since this would result in differently sized text.
+
+ (mainScreenReferenceBoundsOverride):
+ * TestWebKitAPI/ios/UIKitSPI.h:
+
2019-08-02 Sihui Liu <[email protected]>
API tests using permanent credentials should clear credentials left by previous tests
Modified: trunk/Tools/TestWebKitAPI/Tests/ios/TextAutosizingBoost.mm (248185 => 248186)
--- trunk/Tools/TestWebKitAPI/Tests/ios/TextAutosizingBoost.mm 2019-08-02 22:20:54 UTC (rev 248185)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/TextAutosizingBoost.mm 2019-08-02 22:57:58 UTC (rev 248186)
@@ -25,16 +25,28 @@
#include "config.h"
+#import "InstanceMethodSwizzler.h"
#import "TestWKWebView.h"
+#import "UIKitSPI.h"
#import <WebKit/WKPreferencesPrivate.h>
+#import <WebKit/WKPreferencesRef.h>
#if PLATFORM(IOS_FAMILY)
+static CGRect mainScreenReferenceBoundsOverride(id, SEL)
+{
+ return CGRectMake(0, 0, 320, 568);
+}
+
TEST(TextAutosizingBoost, ChangeAutosizingBoostAtRuntime)
{
static NSString *testMarkup = @"<meta name='viewport' content='width=device-width'><body style='margin: 0'><span id='top'>Hello world</span><br><span id='bottom'>Goodbye world</span></body>";
+ InstanceMethodSwizzler screenSizeSwizzler(UIScreen.class, @selector(_referenceBounds), reinterpret_cast<IMP>(mainScreenReferenceBoundsOverride));
+
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 960, 360)]);
+ WKPreferencesSetTextAutosizingEnabled((__bridge WKPreferencesRef)[webView configuration].preferences, true);
+ WKPreferencesSetTextAutosizingUsesIdempotentMode((__bridge WKPreferencesRef)[webView configuration].preferences, false);
[webView synchronouslyLoadHTMLString:testMarkup];
CGSize regularSize {
roundf([[webView objectByEvaluatingJavaScript:@"document.getElementById('top').getBoundingClientRect().width"] floatValue]),
Modified: trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h (248185 => 248186)
--- trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h 2019-08-02 22:20:54 UTC (rev 248185)
+++ trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h 2019-08-02 22:57:58 UTC (rev 248186)
@@ -35,6 +35,7 @@
#import <UIKit/UIKeyboardImpl.h>
#import <UIKit/UIKeyboard_Private.h>
#import <UIKit/UIResponder_Private.h>
+#import <UIKit/UIScreen_Private.h>
#import <UIKit/UITextInputMultiDocument.h>
#import <UIKit/UITextInputTraits_Private.h>
#import <UIKit/UITextInput_Private.h>
@@ -175,6 +176,10 @@
IGNORE_WARNINGS_END
+@interface UIScreen ()
+@property (nonatomic, readonly) CGRect _referenceBounds;
+@end
+
#endif
#if __has_include(<UIKit/UITextAutofillSuggestion.h>)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes