|
Lines 122-127
TEST(FontManagerTests, ToggleBoldAndItalicWithMenuItems)
a/Tools/TestWebKitAPI/Tests/mac/FontManagerTests.mm_sec1
|
| 122 |
auto webView = webViewForFontManagerTesting(fontManager); |
122 |
auto webView = webViewForFontManagerTesting(fontManager); |
| 123 |
|
123 |
|
| 124 |
[webView selectWord:nil]; |
124 |
[webView selectWord:nil]; |
|
|
125 |
[webView waitForNextPresentationUpdate]; |
| 125 |
[fontManager addFontTrait:menuItemCellForFontAction(NSBoldFontMask).autorelease()]; |
126 |
[fontManager addFontTrait:menuItemCellForFontAction(NSBoldFontMask).autorelease()]; |
| 126 |
EXPECT_WK_STREQ("bold", [webView stylePropertyAtSelectionStart:@"font-weight"]); |
127 |
EXPECT_WK_STREQ("bold", [webView stylePropertyAtSelectionStart:@"font-weight"]); |
| 127 |
EXPECT_WK_STREQ("bold", [webView stylePropertyAtSelectionEnd:@"font-weight"]); |
128 |
EXPECT_WK_STREQ("bold", [webView stylePropertyAtSelectionEnd:@"font-weight"]); |
|
Lines 153-164
TEST(FontManagerTests, ChangeFontSizeWithMenuItems)
a/Tools/TestWebKitAPI/Tests/mac/FontManagerTests.mm_sec2
|
| 153 |
|
154 |
|
| 154 |
// Select "foo" and increase font size. |
155 |
// Select "foo" and increase font size. |
| 155 |
[webView selectWord:nil]; |
156 |
[webView selectWord:nil]; |
|
|
157 |
[webView waitForNextPresentationUpdate]; |
| 156 |
[fontManager modifyFont:sizeIncreaseMenuItemCell.get()]; |
158 |
[fontManager modifyFont:sizeIncreaseMenuItemCell.get()]; |
| 157 |
[fontManager modifyFont:sizeIncreaseMenuItemCell.get()]; |
159 |
[fontManager modifyFont:sizeIncreaseMenuItemCell.get()]; |
| 158 |
|
160 |
|
| 159 |
// Now select "baz" and decrease font size. |
161 |
// Now select "baz" and decrease font size. |
| 160 |
[webView moveToEndOfParagraph:nil]; |
162 |
[webView moveToEndOfParagraph:nil]; |
| 161 |
[webView selectWord:nil]; |
163 |
[webView selectWord:nil]; |
|
|
164 |
[webView waitForNextPresentationUpdate]; |
| 162 |
[fontManager modifyFont:sizeDecreaseMenuItemCell.get()]; |
165 |
[fontManager modifyFont:sizeDecreaseMenuItemCell.get()]; |
| 163 |
[fontManager modifyFont:sizeDecreaseMenuItemCell.get()]; |
166 |
[fontManager modifyFont:sizeDecreaseMenuItemCell.get()]; |
| 164 |
|
167 |
|
|
Lines 168-173
TEST(FontManagerTests, ChangeFontSizeWithMenuItems)
a/Tools/TestWebKitAPI/Tests/mac/FontManagerTests.mm_sec3
|
| 168 |
|
171 |
|
| 169 |
[webView moveToBeginningOfParagraph:nil]; |
172 |
[webView moveToBeginningOfParagraph:nil]; |
| 170 |
[webView selectWord:nil]; |
173 |
[webView selectWord:nil]; |
|
|
174 |
[webView waitForNextPresentationUpdate]; |
| 171 |
EXPECT_WK_STREQ(@"foo", [webView selectedText]); |
175 |
EXPECT_WK_STREQ(@"foo", [webView selectedText]); |
| 172 |
EXPECT_WK_STREQ(@"18px", [webView stylePropertyAtSelectionStart:@"font-size"]); |
176 |
EXPECT_WK_STREQ(@"18px", [webView stylePropertyAtSelectionStart:@"font-size"]); |
| 173 |
EXPECT_WK_STREQ(@"18px", [webView stylePropertyAtSelectionEnd:@"font-size"]); |
177 |
EXPECT_WK_STREQ(@"18px", [webView stylePropertyAtSelectionEnd:@"font-size"]); |
|
Lines 190-195
TEST(FontManagerTests, ChangeFontWithPanel)
a/Tools/TestWebKitAPI/Tests/mac/FontManagerTests.mm_sec4
|
| 190 |
|
194 |
|
| 191 |
NSFontPanel *fontPanel = [fontManager fontPanel:YES]; |
195 |
NSFontPanel *fontPanel = [fontManager fontPanel:YES]; |
| 192 |
[fontPanel setIsVisible:YES]; |
196 |
[fontPanel setIsVisible:YES]; |
|
|
197 |
[webView waitForNextPresentationUpdate]; |
| 193 |
|
198 |
|
| 194 |
NSFont *largeHelveticaFont = [NSFont fontWithName:@"Helvetica" size:20]; |
199 |
NSFont *largeHelveticaFont = [NSFont fontWithName:@"Helvetica" size:20]; |
| 195 |
[fontPanel setPanelFont:largeHelveticaFont isMultiple:NO]; |
200 |
[fontPanel setPanelFont:largeHelveticaFont isMultiple:NO]; |
|
Lines 239-244
TEST(FontManagerTests, ChangeAttributesWithFontEffectsBox)
a/Tools/TestWebKitAPI/Tests/mac/FontManagerTests.mm_sec5
|
| 239 |
|
244 |
|
| 240 |
NSFontPanel *fontPanel = [fontManager fontPanel:YES]; |
245 |
NSFontPanel *fontPanel = [fontManager fontPanel:YES]; |
| 241 |
[fontPanel setIsVisible:YES]; |
246 |
[fontPanel setIsVisible:YES]; |
|
|
247 |
[webView waitForNextPresentationUpdate]; |
| 242 |
|
248 |
|
| 243 |
auto textDecorationsAroundSelection = [webView] { |
249 |
auto textDecorationsAroundSelection = [webView] { |
| 244 |
NSString *decorationsAtStart = [webView stylePropertyAtSelectionStart:@"-webkit-text-decorations-in-effect"]; |
250 |
NSString *decorationsAtStart = [webView stylePropertyAtSelectionStart:@"-webkit-text-decorations-in-effect"]; |
|
Lines 339-344
TEST(FontManagerTests, ChangeFontColorWithColorPanel)
a/Tools/TestWebKitAPI/Tests/mac/FontManagerTests.mm_sec6
|
| 339 |
// 1. Select "foo" and turn it red; verify that the font element is used for fully opaque colors. |
345 |
// 1. Select "foo" and turn it red; verify that the font element is used for fully opaque colors. |
| 340 |
colorPanel.color = [NSColor colorWithRed:1 green:0 blue:0 alpha:1]; |
346 |
colorPanel.color = [NSColor colorWithRed:1 green:0 blue:0 alpha:1]; |
| 341 |
[webView selectWord:nil]; |
347 |
[webView selectWord:nil]; |
|
|
348 |
[webView waitForNextPresentationUpdate]; |
| 342 |
[webView changeColor:colorPanel]; |
349 |
[webView changeColor:colorPanel]; |
| 343 |
checkFontColorAtStartAndEndWithInputEvents("rgb(255, 0, 0)"); |
350 |
checkFontColorAtStartAndEndWithInputEvents("rgb(255, 0, 0)"); |
| 344 |
EXPECT_TRUE([[webView objectByEvaluatingJavaScript:@"!!foo.querySelector('font')"] boolValue]); |
351 |
EXPECT_TRUE([[webView objectByEvaluatingJavaScript:@"!!foo.querySelector('font')"] boolValue]); |
|
Lines 346-351
TEST(FontManagerTests, ChangeFontColorWithColorPanel)
a/Tools/TestWebKitAPI/Tests/mac/FontManagerTests.mm_sec7
|
| 346 |
// 2. Now select "bar" and try a few different colors, starting with a color with alpha. |
353 |
// 2. Now select "bar" and try a few different colors, starting with a color with alpha. |
| 347 |
colorPanel.color = [NSColor colorWithWhite:1 alpha:0.2]; |
354 |
colorPanel.color = [NSColor colorWithWhite:1 alpha:0.2]; |
| 348 |
[webView selectNextWord]; |
355 |
[webView selectNextWord]; |
|
|
356 |
[webView waitForNextPresentationUpdate]; |
| 349 |
[webView changeColor:colorPanel]; |
357 |
[webView changeColor:colorPanel]; |
| 350 |
checkFontColorAtStartAndEndWithInputEvents("rgba(255, 255, 255, 0.2)"); |
358 |
checkFontColorAtStartAndEndWithInputEvents("rgba(255, 255, 255, 0.2)"); |
| 351 |
EXPECT_FALSE([[webView objectByEvaluatingJavaScript:@"!!bar.querySelector('font')"] boolValue]); |
359 |
EXPECT_FALSE([[webView objectByEvaluatingJavaScript:@"!!bar.querySelector('font')"] boolValue]); |
|
Lines 460-465
TEST(FontManagerTests, AddFontShadowUsingFontOptions)
a/Tools/TestWebKitAPI/Tests/mac/FontManagerTests.mm_sec8
|
| 460 |
auto webView = webViewForFontManagerTesting(NSFontManager.sharedFontManager); |
468 |
auto webView = webViewForFontManagerTesting(NSFontManager.sharedFontManager); |
| 461 |
|
469 |
|
| 462 |
[webView selectWord:nil]; |
470 |
[webView selectWord:nil]; |
|
|
471 |
[webView waitForNextPresentationUpdate]; |
| 463 |
options.shadowWidth = 3; |
472 |
options.shadowWidth = 3; |
| 464 |
options.shadowHeight = -3; |
473 |
options.shadowHeight = -3; |
| 465 |
options.hasShadow = YES; |
474 |
options.hasShadow = YES; |
|
Lines 476-481
TEST(FontManagerTests, AddAndRemoveColorsUsingFontOptions)
a/Tools/TestWebKitAPI/Tests/mac/FontManagerTests.mm_sec9
|
| 476 |
TestFontOptions *options = TestFontOptions.sharedInstance; |
485 |
TestFontOptions *options = TestFontOptions.sharedInstance; |
| 477 |
auto webView = webViewForFontManagerTesting(NSFontManager.sharedFontManager, @"<body contenteditable>hello</body>"); |
486 |
auto webView = webViewForFontManagerTesting(NSFontManager.sharedFontManager, @"<body contenteditable>hello</body>"); |
| 478 |
[webView selectWord:nil]; |
487 |
[webView selectWord:nil]; |
|
|
488 |
[webView waitForNextPresentationUpdate]; |
| 479 |
|
489 |
|
| 480 |
options.backgroundColor = [NSColor colorWithRed:1 green:0 blue:0 alpha:0.2]; |
490 |
options.backgroundColor = [NSColor colorWithRed:1 green:0 blue:0 alpha:0.2]; |
| 481 |
options.foregroundColor = [NSColor colorWithRed:0 green:0 blue:1 alpha:1]; |
491 |
options.foregroundColor = [NSColor colorWithRed:0 green:0 blue:1 alpha:1]; |