Skip to content

Implement Compose unit/geometry resolvers (Dp, Sp, Offset, Size, Rect, IntOffset, IntSize) #82

Description

@MessiasLima

Description

Add resolvers for Compose unit and geometry types: Dp, Sp, Offset, Size, Rect, IntOffset, and IntSize. Each lives in dev.appoutlet.some.android.resolver.compose. These are Compose inline/value classes and are handled directly rather than relying on ValueClassResolver.

  • Scope and constraints

    • DpResolverDp(value) with random float in 0..1000 range. Constructor receives random: Random only.
    • SpResolverSp(value) with random float in 0..100 range. Constructor receives random: Random only.
    • OffsetResolverOffset(x, y) with random float coordinates. Constructor receives random: Random only.
    • SizeResolverSize(width, height) with random positive float dimensions. Constructor receives random: Random only.
    • RectResolverRect(left, top, right, bottom) with randomized bounds ensuring left < right and top < bottom. Constructor receives random: Random only.
    • IntOffsetResolverIntOffset(x, y) with random integer coordinates. Constructor receives random: Random only.
    • IntSizeResolverIntSize(width, height) with random positive integer dimensions. Constructor receives random: Random only.
    • Each canResolve() uses exact type matching via typeOf<T>().
    • Each resolver has its own JVM unit test class verifying type output, canResolve behavior, and dimensional constraints where applicable.
    • Depends on androidx.compose.ui:ui (transitively provides ui-unit and ui-geometry).
  • References

Scope

In scope: 7 resolver classes + 7 test classes.
Out of scope: registering resolvers in AndroidTypeResolverProvider (ticket #14).

Acceptance criteria

  • DpResolver generates Dp values in a sensible range (0..1000)
  • SpResolver generates Sp values in a sensible range (0..100)
  • OffsetResolver generates Offsets with float coordinates
  • SizeResolver generates sizes with positive float dimensions
  • RectResolver generates rects where left < right and top < bottom
  • IntOffsetResolver generates IntOffsets with integer coordinates
  • IntSizeResolver generates IntSizes with positive integer dimensions
  • Each resolver's canResolve returns true for its own type and false for others
  • Tests compile against android.jar with androidx.compose.ui:ui on classpath and run as JVM unit tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions