Skip to content

[Feature]: Expose TextPattern formatting through ui get-property #822

Description

Is your feature request related to a problem? Please describe.

Parent: #798

winapp ui get-property <element> --property FontWeight --json currently returns null even when a WinUI text element exposes its rendered font weight through TextPattern. This prevents tests from verifying visual states such as an unread mail subject being bold.

Text attributes also have important non-value states. A range may contain mixed formatting, the provider may not support one attribute, or the element may not support TextPattern. Collapsing those cases to null can produce false passes or false failures.

Describe the solution you'd like

Extend ui get-property to read these TextPattern attributes from the whole document range:

  • FontWeight
  • FontName
  • FontSize
  • ForegroundColor
  • IsItalic
  • StrikethroughStyle

Keep the published string-valued properties JSON contract:

{"properties":{"FontWeight":"600"}}
{"properties":{"FontWeight":"Mixed"}}
{"properties":{"FontWeight":"NotSupported"}}
{"properties":{"FontWeight":"Unavailable"}}
  • A uniform attribute returns its invariant string value.
  • UIA's mixed sentinel returns Mixed.
  • UIA's reserved-not-supported sentinel returns NotSupported.
  • An element without TextPattern returns Unavailable.
  • Requesting an unknown property name is an invalid_arguments error rather than another null result.
  • Omitting --property includes the six text attributes in the full property result.

Selection, caret, and arbitrary text-range APIs are outside this initial scope.

Additional context

A live mixed-format RichTextBox probe confirmed that the whole document returns UIA's mixed sentinel, a selected bold range returns a numeric weight, and a Button has no TextPattern. Implementation coverage should validate all four public result states through this repository's COM projection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions