Phongsakon/feature/ci align#7
Merged
Merged
Conversation
The six AlignAction subclasses each repeated the same loop over the selected figures and only differed in how they computed the translation. Extracted the varying geometry into an Alignment enum and pulled the shared loop up into the base class as a template method. Subclasses now just carry their Alignment value. Behaviour is unchanged, existing callers in ButtonFactory and AlignToolBar still compile.
Second half of the change request. Distribute spreads the selected figures so the gaps between them are equal, horizontally or vertically. Follows the same shape as AlignAction, a thin action delegating the geometry to a Distribution enum, so it reuses the template method the refactoring put in place. Wired the buttons into ButtonFactory and added the labels next to the alignment ones.
Added JUnit 4 next to the existing TestNG so the lab's framework is in place without disturbing the current tests. The tests cover the pure geometry the refactoring exposed: 9 cases for Alignment, one per direction plus the already-aligned and oversized-figure boundaries, and 6 for Distribution, the equal-gap best case plus the two and one figure boundaries where it must do nothing. All 15 green.
Mapped the user story to Given-When-Then scenarios with JGiven and AssertJ. One stage holds the steps, and the three scenarios cover the story's promises: aligning north lines up the top edges, distributing makes the gaps equal, and distributing two figures changes nothing.
GitHub Actions pipeline that builds all modules and runs the tests on JDK 11 for every pull request. Named ci-align.yml so it does not clash with the ci.yml a teammate added on another branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.