diff --git a/change/react-native-windows-abe3b81a-02be-4c81-86e1-40bbf5d69332.json b/change/react-native-windows-abe3b81a-02be-4c81-86e1-40bbf5d69332.json new file mode 100644 index 00000000000..277979ef600 --- /dev/null +++ b/change/react-native-windows-abe3b81a-02be-4c81-86e1-40bbf5d69332.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "adding font attributes in test snapshots", + "packageName": "react-native-windows", + "email": "kvineeth@microsoft.com", + "dependentChangeType": "none" +} diff --git a/packages/@react-native-windows/tester/src/js/examples/Text/TextExample.windows.js b/packages/@react-native-windows/tester/src/js/examples/Text/TextExample.windows.js index 06d824f97d1..de4ccf08378 100644 --- a/packages/@react-native-windows/tester/src/js/examples/Text/TextExample.windows.js +++ b/packages/@react-native-windows/tester/src/js/examples/Text/TextExample.windows.js @@ -1933,6 +1933,7 @@ const examples = [ return ( {`Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore Ut enim ad minim veniam.With AdjustFontSize width: 800, height: 100, fontSize: 20`} ( '-')> ^(' - ')^ <('-'<) (>'-')> ^(' - ')^", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, + "TextRangePattern.readOnly": true, "ValuePattern.Value": "Can't touch this! (>'-')> ^(' - ')^ <('-'<) (>'-')> ^(' - ')^", }, "Component Tree": { @@ -1673,6 +1734,10 @@ exports[`TextInput Tests TextInputs can be set to not editable 2 1`] = ` "LocalizedControlType": "edit", "Name": "uneditable text input using editable prop", "TextRangePattern.GetText": "uneditable text input using editable prop", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, + "TextRangePattern.readOnly": true, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -1748,6 +1813,9 @@ exports[`TextInput Tests TextInputs can clear on submit 1`] = ` "ControlType": 50004, "IsKeyboardFocusable": true, "LocalizedControlType": "edit", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -1823,6 +1891,9 @@ exports[`TextInput Tests TextInputs can clear on submit with custom submit key e "ControlType": 50004, "IsKeyboardFocusable": true, "LocalizedControlType": "edit", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -1898,6 +1969,9 @@ exports[`TextInput Tests TextInputs can clear on submit with custom submit key e "ControlType": 50004, "IsKeyboardFocusable": true, "LocalizedControlType": "edit", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -1973,6 +2047,9 @@ exports[`TextInput Tests TextInputs can customize its padding 1`] = ` "ControlType": 50004, "IsKeyboardFocusable": true, "LocalizedControlType": "edit", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -2051,6 +2128,9 @@ exports[`TextInput Tests TextInputs can enable spellcheck 1`] = ` "LocalizedControlType": "edit", "Name": "Type text to test spell check functionality.", "TextRangePattern.GetText": "Type text to test spell check functionality.", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -2127,6 +2207,9 @@ exports[`TextInput Tests TextInputs can have a background color 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "He", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, "ValuePattern.Value": "He", }, "Component Tree": { @@ -2204,6 +2287,9 @@ exports[`TextInput Tests TextInputs can have a color 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "He", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, "ValuePattern.Value": "He", }, "Component Tree": { @@ -2281,6 +2367,9 @@ exports[`TextInput Tests TextInputs can have a font family 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "He", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "sans-serif", + "TextRangePattern.fontSize": 13, "ValuePattern.Value": "He", }, "Component Tree": { @@ -2358,6 +2447,9 @@ exports[`TextInput Tests TextInputs can have a font size 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "He", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 8, "ValuePattern.Value": "He", }, "Component Tree": { @@ -2435,6 +2527,9 @@ exports[`TextInput Tests TextInputs can have a font style 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "He", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, "ValuePattern.Value": "He", }, "Component Tree": { @@ -2512,6 +2607,10 @@ exports[`TextInput Tests TextInputs can have a font weight 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "He", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, + "TextRangePattern.fontWeight": 400, "ValuePattern.Value": "He", }, "Component Tree": { @@ -2589,6 +2688,9 @@ exports[`TextInput Tests TextInputs can have attributed text 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "Hello ", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, "ValuePattern.Value": "Hello ", }, "Component Tree": { @@ -2668,6 +2770,9 @@ exports[`TextInput Tests TextInputs can have caretHidden 1`] = ` "LocalizedControlType": "edit", "Name": "caretHidden={true}", "TextRangePattern.GetText": "Hello World", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, "ValuePattern.Value": "Hello World", }, "Component Tree": { @@ -2747,6 +2852,9 @@ exports[`TextInput Tests TextInputs can have custom return key label, Compile 1` "LocalizedControlType": "edit", "Name": "returnKeyLabel: Compile", "TextRangePattern.GetText": "returnKeyLabel: Compile", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -2825,6 +2933,9 @@ exports[`TextInput Tests TextInputs can have custom return key label, React Nati "LocalizedControlType": "edit", "Name": "returnKeyLabel: React Native", "TextRangePattern.GetText": "returnKeyLabel: React Native", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -2903,6 +3014,9 @@ exports[`TextInput Tests TextInputs can have custom return key type, done 1`] = "LocalizedControlType": "edit", "Name": "returnKeyType: done", "TextRangePattern.GetText": "returnKeyType: done", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -2981,6 +3095,9 @@ exports[`TextInput Tests TextInputs can have custom return key type, go 1`] = ` "LocalizedControlType": "edit", "Name": "returnKeyType: go", "TextRangePattern.GetText": "returnKeyType: go", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -3059,6 +3176,9 @@ exports[`TextInput Tests TextInputs can have custom return key type, next 1`] = "LocalizedControlType": "edit", "Name": "returnKeyType: next", "TextRangePattern.GetText": "returnKeyType: next", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -3137,6 +3257,9 @@ exports[`TextInput Tests TextInputs can have custom return key type, none 1`] = "LocalizedControlType": "edit", "Name": "returnKeyType: none", "TextRangePattern.GetText": "returnKeyType: none", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -3215,6 +3338,9 @@ exports[`TextInput Tests TextInputs can have custom return key type, previous 1` "LocalizedControlType": "edit", "Name": "returnKeyType: previous", "TextRangePattern.GetText": "returnKeyType: previous", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -3293,6 +3419,9 @@ exports[`TextInput Tests TextInputs can have custom return key type, search 1`] "LocalizedControlType": "edit", "Name": "returnKeyType: search", "TextRangePattern.GetText": "returnKeyType: search", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -3371,6 +3500,9 @@ exports[`TextInput Tests TextInputs can have custom return key type, send 1`] = "LocalizedControlType": "edit", "Name": "returnKeyType: send", "TextRangePattern.GetText": "returnKeyType: send", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -3449,6 +3581,9 @@ exports[`TextInput Tests TextInputs can have customer letter spacing, spacing=-1 "LocalizedControlType": "edit", "Name": "letterSpacing = -1", "TextRangePattern.GetText": "letterSpacing = -1", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -3527,6 +3662,9 @@ exports[`TextInput Tests TextInputs can have customer letter spacing, spacing=0 "LocalizedControlType": "edit", "Name": "letterSpacing = 0", "TextRangePattern.GetText": "letterSpacing = 0", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -3605,6 +3743,9 @@ exports[`TextInput Tests TextInputs can have customer letter spacing, spacing=2 "LocalizedControlType": "edit", "Name": "letterSpacing = 2", "TextRangePattern.GetText": "letterSpacing = 2", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -3683,6 +3824,9 @@ exports[`TextInput Tests TextInputs can have customer letter spacing, spacing=9 "LocalizedControlType": "edit", "Name": "letterSpacing = 9", "TextRangePattern.GetText": "letterSpacing = 9", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -3855,6 +3999,9 @@ exports[`TextInput Tests TextInputs can have customized letter spacing 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "He", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, "ValuePattern.Value": "He", }, "Component Tree": { @@ -3932,6 +4079,9 @@ exports[`TextInput Tests TextInputs can have customized line height 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "Hel", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, "ValuePattern.Value": "Hel", }, "Component Tree": { @@ -4011,6 +4161,9 @@ exports[`TextInput Tests TextInputs can have inline images 1`] = ` "LocalizedControlType": "edit", "Name": "This has drawableLeft set", "TextRangePattern.GetText": "This has drawableLeft set", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -4089,6 +4242,9 @@ exports[`TextInput Tests TextInputs can have inline images, drawable props not s "LocalizedControlType": "edit", "Name": "This does not have drawable props set", "TextRangePattern.GetText": "This does not have drawable props set", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -4167,6 +4323,9 @@ exports[`TextInput Tests TextInputs can have inline images, drawableLeft and dra "LocalizedControlType": "edit", "Name": "This has drawableLeft and drawablePadding set", "TextRangePattern.GetText": "This has drawableLeft and drawablePadding set", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -4245,6 +4404,9 @@ exports[`TextInput Tests TextInputs can have shadows 1`] = ` "LocalizedControlType": "edit", "Name": "shadowColor: purple", "TextRangePattern.GetText": "shadowColor: purple", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -4321,6 +4483,9 @@ exports[`TextInput Tests TextInputs can have text decoration lines 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "He", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, "ValuePattern.Value": "He", }, "Component Tree": { @@ -4398,6 +4563,9 @@ exports[`TextInput Tests TextInputs can have text shadows 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "He", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, "ValuePattern.Value": "He", }, "Component Tree": { @@ -4477,6 +4645,9 @@ exports[`TextInput Tests TextInputs can propagate events 1`] = ` "LocalizedControlType": "edit", "Name": "Click inside the box to observe events being fired.", "TextRangePattern.GetText": "Click inside the box to observe events being fired.", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -4555,6 +4726,9 @@ exports[`TextInput Tests TextInputs can register press events 1`] = ` "LocalizedControlType": "edit", "Name": "Click inside the box to observe events being fired.", "TextRangePattern.GetText": "Click inside the box to observe events being fired.", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -4630,6 +4804,9 @@ exports[`TextInput Tests TextInputs can rewrite characters: Replace Space with C "ControlType": 50004, "IsKeyboardFocusable": true, "LocalizedControlType": "edit", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -4705,6 +4882,9 @@ exports[`TextInput Tests TextInputs can rewrite characters: Replace Space with N "ControlType": 50004, "IsKeyboardFocusable": true, "LocalizedControlType": "edit", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -4780,6 +4960,9 @@ exports[`TextInput Tests TextInputs can rewrite characters: Replace Space with U "ControlType": 50004, "IsKeyboardFocusable": true, "LocalizedControlType": "edit", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -4935,6 +5118,9 @@ exports[`TextInput Tests TextInputs can set their readOnly prop to false 1`] = ` "LocalizedControlType": "edit", "Name": "editable text input using readOnly prop", "TextRangePattern.GetText": "editable text input using readOnly prop", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -5013,6 +5199,10 @@ exports[`TextInput Tests TextInputs can set their readOnly prop to true 1`] = ` "LocalizedControlType": "edit", "Name": "uneditable text input using readOnly prop", "TextRangePattern.GetText": "uneditable text input using readOnly prop", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, + "TextRangePattern.readOnly": true, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -5088,6 +5278,9 @@ exports[`TextInput Tests TextInputs can submit with custom key, multilined and s "ControlType": 50004, "IsKeyboardFocusable": true, "LocalizedControlType": "edit", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -5164,6 +5357,9 @@ exports[`TextInput Tests TextInputs have a custom background color 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "Same BackgroundColor as View ", + "TextRangePattern.backgroundColor": 1298424932, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, "ValuePattern.Value": "Same BackgroundColor as View ", }, "Component Tree": { @@ -5241,6 +5437,9 @@ exports[`TextInput Tests TextInputs have a custom highlight color 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "Selection Color is red", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, "ValuePattern.Value": "Selection Color is red", }, "Component Tree": { @@ -5320,6 +5519,9 @@ exports[`TextInput Tests TextInputs have a custom placeholder text color 1`] = ` "LocalizedControlType": "edit", "Name": "Red placeholder text color", "TextRangePattern.GetText": "Red placeholder text color", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -5396,6 +5598,9 @@ exports[`TextInput Tests TextInputs have a custom text color 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "Green Text", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, "ValuePattern.Value": "Green Text", }, "Component Tree": { @@ -5475,6 +5680,9 @@ exports[`TextInput Tests TextInputs have a custom underline color 1`] = ` "LocalizedControlType": "edit", "Name": "Blue underline color", "TextRangePattern.GetText": "Blue underline color", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -5553,6 +5761,9 @@ exports[`TextInput Tests TextInputs have a default placeholder text color 1`] = "LocalizedControlType": "edit", "Name": "Default placeholder text color", "TextRangePattern.GetText": "Default placeholder text color", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -5629,6 +5840,9 @@ exports[`TextInput Tests TextInputs have a default text color 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "Default color text", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, "ValuePattern.Value": "Default color text", }, "Component Tree": { @@ -5708,6 +5922,9 @@ exports[`TextInput Tests TextInputs have a default underline color 1`] = ` "LocalizedControlType": "edit", "Name": "Default underline color", "TextRangePattern.GetText": "Default underline color", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -5784,6 +6001,9 @@ exports[`TextInput Tests TextInputs support secure entry 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "iloveturtles", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, "ValuePattern.Value": "iloveturtles", }, "Component Tree": { @@ -5863,6 +6083,9 @@ exports[`TextInput Tests TextInputs support secure entry, with placeholder text "LocalizedControlType": "edit", "Name": "color is supported too", "TextRangePattern.GetText": "color is supported too", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -5944,6 +6167,9 @@ exports[`TextInput Tests TextInputs which have a searchbox role should also supp "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "Search", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 16, "ValuePattern.Value": "Search", }, ], @@ -6045,6 +6271,9 @@ exports[`TextInput Tests TextInputs with set height and padding from theme 1`] = "LocalizedControlType": "edit", "Name": "If you set height, beware of padding set from themes", "TextRangePattern.GetText": "If you set height, beware of padding set from themes", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, }, "Component Tree": { "Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView", @@ -6121,6 +6350,9 @@ exports[`TextInput Tests Uncontrolled TextInput 1`] = ` "IsKeyboardFocusable": true, "LocalizedControlType": "edit", "TextRangePattern.GetText": "Hello World!", + "TextRangePattern.backgroundColor": -1, + "TextRangePattern.fontName": "Segoe UI", + "TextRangePattern.fontSize": 13, "ValuePattern.Value": "Hello World!", }, "Component Tree": { diff --git a/packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp b/packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp index 08259d0afb9..839ee3d40d7 100644 --- a/packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp +++ b/packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp @@ -230,6 +230,26 @@ void InsertNumberValueIfNotDefault( } } +void InsertNumberValueIfNotDefault( + const winrt::Windows::Data::Json::JsonObject &obj, + winrt::hstring name, + double value, + double defaultValue = 0.0f) { + if (value != defaultValue) { + obj.Insert(name, winrt::Windows::Data::Json::JsonValue::CreateNumberValue(value)); + } +} + +void InsertNumberValueIfNotDefault( + const winrt::Windows::Data::Json::JsonObject &obj, + winrt::hstring name, + long value, + long defaultValue = 0) { + if (value != defaultValue) { + obj.Insert(name, winrt::Windows::Data::Json::JsonValue::CreateNumberValue(value)); + } +} + void InsertIntValueIfNotDefault( const winrt::Windows::Data::Json::JsonObject &obj, winrt::hstring name, @@ -365,6 +385,8 @@ void DumpUIAPatternInfo(IUIAutomationElement *pTarget, const winrt::Windows::Dat BOOL selectionRequired; BSTR text = nullptr; BOOL horizontallyScrollable; + VARIANT varFontAttr; + VariantInit(&varFontAttr); BSTR annotationAuthor = nullptr; BSTR annotationTypeName = nullptr; BSTR annotationDateTime = nullptr; @@ -464,10 +486,34 @@ void DumpUIAPatternInfo(IUIAutomationElement *pTarget, const winrt::Windows::Dat winrt::com_ptr textRangePattern; hr = textPattern->get_DocumentRange(textRangePattern.put()); if (SUCCEEDED(hr) && textRangePattern) { - textRangePattern->GetText(20, &text); + hr = textRangePattern->GetText(20, &text); if (SUCCEEDED(hr)) { InsertStringValueIfNotEmpty(result, L"TextRangePattern.GetText", text); } + hr = textRangePattern->GetAttributeValue(UIA_FontSizeAttributeId, &varFontAttr); + if (SUCCEEDED(hr) && varFontAttr.vt == VARENUM::VT_R8) { + InsertNumberValueIfNotDefault(result, L"TextRangePattern.fontSize", varFontAttr.dblVal); + } + hr = textRangePattern->GetAttributeValue(UIA_FontNameAttributeId, &varFontAttr); + if (SUCCEEDED(hr) && varFontAttr.vt == VARENUM::VT_BSTR) { + InsertStringValueIfNotEmpty(result, L"TextRangePattern.fontName", varFontAttr.bstrVal); + } + hr = textRangePattern->GetAttributeValue(UIA_FontWeightAttributeId, &varFontAttr); + if (SUCCEEDED(hr) && varFontAttr.vt == VARENUM::VT_I4) { + InsertNumberValueIfNotDefault(result, L"TextRangePattern.fontWeight", varFontAttr.lVal); + } + hr = textRangePattern->GetAttributeValue(UIA_IsReadOnlyAttributeId, &varFontAttr); + if (SUCCEEDED(hr) && varFontAttr.vt == VARENUM::VT_BOOL) { + InsertBooleanValueIfNotDefault(result, L"TextRangePattern.readOnly", varFontAttr.boolVal); + } + hr = textRangePattern->GetAttributeValue(UIA_BackgroundColorAttributeId, &varFontAttr); + if (SUCCEEDED(hr) && varFontAttr.vt == VARENUM::VT_I4) { + InsertNumberValueIfNotDefault(result, L"TextRangePattern.backgroundColor", varFontAttr.lVal); + } + hr = textRangePattern->GetAttributeValue(UIA_CapStyleAttributeId, &varFontAttr); + if (SUCCEEDED(hr) && varFontAttr.vt == VARENUM::VT_I4) { + InsertIntValueIfNotDefault(result, L"TextRangePattern.capStyleAttr", varFontAttr.lVal); + } } } @@ -503,6 +549,7 @@ void DumpUIAPatternInfo(IUIAutomationElement *pTarget, const winrt::Windows::Dat } } + VariantClear(&varFontAttr); ::SysFreeString(text); ::SysFreeString(value); } diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp index 1f69c84b3df..c770cb546c7 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp @@ -98,13 +98,13 @@ HRESULT __stdcall CompositionTextRangeProvider::GetAttributeValue(TEXTATTRIBUTEI textTransform = props->textAttributes.textTransform.value(); } if (fontVariant == facebook::react::FontVariant::SmallCaps) { - return CapStyle_SmallCap; + pRetVal->lVal = CapStyle_SmallCap; } else if (textTransform == facebook::react::TextTransform::Capitalize) { - return CapStyle_Titling; + pRetVal->lVal = CapStyle_Titling; } else if (textTransform == facebook::react::TextTransform::Lowercase) { - return CapStyle_None; + pRetVal->lVal = CapStyle_None; } else if (textTransform == facebook::react::TextTransform::Uppercase) { - return CapStyle_AllCap; + pRetVal->lVal = CapStyle_AllCap; } } else if (attributeId == UIA_FontNameAttributeId) { pRetVal->vt = VT_BSTR;