|
1 | 1 | using System;
|
2 | 2 | using System.ComponentModel;
|
| 3 | +using System.Linq; |
3 | 4 | using System.Threading.Tasks;
|
4 | 5 | using System.Windows;
|
5 | 6 | using System.Windows.Controls;
|
@@ -305,5 +306,47 @@ public async Task FloatingOffset_ValuesGetApproprietlyApplied()
|
305 | 306 |
|
306 | 307 | recorder.Success();
|
307 | 308 | }
|
| 309 | + |
| 310 | + [Fact] |
| 311 | + [Description("Issue 2390")] |
| 312 | + public async Task ContextMenu_FollowsTextBoxFontFamily() |
| 313 | + { |
| 314 | + await using var recorder = new TestRecorder(App); |
| 315 | + |
| 316 | + var textBox = await LoadXaml<TextBox>(@"<TextBox FontFamily=""Times New Roman""/>"); |
| 317 | + |
| 318 | + await textBox.RightClick(); |
| 319 | + |
| 320 | + var contextMenu = await textBox.GetElement<ContextMenu>(".ContextMenu"); |
| 321 | + |
| 322 | + var textBoxFont = await textBox.GetFontFamily(); |
| 323 | + Assert.Equal("Times New Roman", textBoxFont?.FamilyNames.Values.First()); |
| 324 | + Assert.Equal(textBoxFont, await contextMenu.GetFontFamily()); |
| 325 | + |
| 326 | + recorder.Success(); |
| 327 | + } |
| 328 | + |
| 329 | + [Fact] |
| 330 | + [Description("Issue 2390")] |
| 331 | + public async Task ContextMenu_UsesInheritedFontFamily() |
| 332 | + { |
| 333 | + await using var recorder = new TestRecorder(App); |
| 334 | + |
| 335 | + var stackPanel = await LoadXaml<StackPanel>(@" |
| 336 | +<StackPanel TextElement.FontFamily=""Times New Roman""> |
| 337 | + <TextBox /> |
| 338 | +</StackPanel> |
| 339 | +"); |
| 340 | + var textBox = await stackPanel.GetElement<TextBox>("/TextBox"); |
| 341 | + await textBox.RightClick(); |
| 342 | + |
| 343 | + var contextMenu = await textBox.GetElement<ContextMenu>(".ContextMenu"); |
| 344 | + |
| 345 | + var textBoxFont = await textBox.GetFontFamily(); |
| 346 | + Assert.Equal("Times New Roman", textBoxFont?.FamilyNames.Values.First()); |
| 347 | + Assert.Equal(textBoxFont, await contextMenu.GetFontFamily()); |
| 348 | + |
| 349 | + recorder.Success(); |
| 350 | + } |
308 | 351 | }
|
309 | 352 | }
|
0 commit comments