Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quixote assertion API improvements, part 2: Rectangles #58

Open
jamesshore opened this issue Apr 19, 2020 · 0 comments
Open

Quixote assertion API improvements, part 2: Rectangles #58

jamesshore opened this issue Apr 19, 2020 · 0 comments

Comments

@jamesshore
Copy link
Owner

jamesshore commented Apr 19, 2020

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:

  • top, bottom, left, right
  • width, height
  • center, middle

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.

  • should.fill(rectangle)
  • should.fillTopOf(rectangle)
  • should.fillBottomOf(rectangle)
  • should.fillLeftOf(rectangle)
  • should.fillRightOf(rectangle)

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.

  • should.alignVerticallyWith(rectangle)
  • should.alignHorizontallyWith(rectangle)

Others

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

  • should.notOverlap(rectangle)
  • should.overlapTopOf(rectangle, optionalSizeToOverlap) etc.
  • should.abutTopOf(rectangle) etc.
  • should.beAbove(rectangle) etc.

Methods

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

  • rectangle.to(otherRectangle) (need a better name?)
@jamesshore jamesshore changed the title Quixote assertion API improvements, part 2 Quixote assertion API improvements, part 2: Rectangles Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant