jamesshore / quixote

CSS unit and integration testing
Other
848 stars 45 forks source link

Quixote assertion API improvements, part 2: Rectangles #58

Open jamesshore opened 4 years ago

jamesshore commented 4 years ago

Quixote's new assertion API was described in issue #47. Some of the assertions were released in v1.0. This issue describes the next batch of improvements.

Rectangles

Introduce a new type of descriptor, tentatively called Rectangle or perhaps RectangleDescriptor. QElement, QPage, QViewport, and ElementRendered will be retrofitted to extend this descriptor.

Properties

Rectangles have these properties, same as now:

Assertions

We'll add these assertions.

Fill

Determine if one rectangle is inside another. "Fill" means all four edges match the expectation. "FillTopOf" means all edges except the bottom match the expectation. And so forth.

Alignment

Determine if one rectangle is aligned with another. "Vertically aligned" means the left and right edges are the same.

Single-variable alignment (center, left, etc.) could be added, but we'll wait to see how the first batch of assertions works out.

Others

Additional assertions are possible, but we'll wait and see how this batch works out first.

Methods

Only one method, for now. It creates a new rectangle, similar to PositionDescriptor.to(). There may be a better way to do this.