-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add Small image ui style tests #310
Add Small image ui style tests #310
Conversation
- also update tests based on these changes
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feature/content-cards #310 +/- ##
============================================================
- Coverage 76.57% 30.80% -45.78%
+ Complexity 769 252 -517
============================================================
Files 78 78
Lines 3688 3688
Branches 568 568
============================================================
- Hits 2824 1136 -1688
- Misses 717 2346 +1629
- Partials 147 206 +59
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
// verify image style parameters | ||
assertEquals(imageStyle.alpha, style.imageStyle.alpha) | ||
assertEquals(imageStyle.colorFilter, style.imageStyle.colorFilter) | ||
assertEquals(imageStyle.contentDescription, style.imageStyle.contentDescription) | ||
assertEquals(imageStyle.alignment, style.imageStyle.alignment) | ||
assertEquals(imageStyle.contentScale, style.imageStyle.contentScale) | ||
assertEquals(imageStyle.modifier, style.imageStyle.modifier) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add helper methods for comparing style totally similar elements. That will allow you to re-use them for other templates and make these tests less verbose (thought partial style overrides will still need to compared individually)
} | ||
|
||
@Test | ||
fun `create SmallImageUIStyle with some custom builder styles used`() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be willing to split & expand this into specific tests that override individual style elements (image style, title text style etc). This will allow us to ensure that any new logic introduced later (perhaps to influence one element style due to another) breaks the tests and enforce writing new tests to accommodate changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, i'll get these split up per style type
AepStyleValidator will be used when comparing two styles that should be identical
…all-image-style-tests
assertEquals(overridingStyle.textStyle?.textStyle, result.textStyle?.textStyle) | ||
assertEquals(overridingStyle.textStyle?.overflow, result.textStyle?.overflow) | ||
assertEquals(overridingStyle.textStyle?.softWrap, result.textStyle?.softWrap) | ||
assertEquals(overridingStyle.textStyle?.maxLines, result.textStyle?.maxLines) | ||
assertEquals(overridingStyle.textStyle?.minLines, result.textStyle?.minLines) | ||
assertEquals(overridingStyle.textStyle?.modifier, result.textStyle?.modifier) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can we use the new utility validateTextStyle
here?
import org.mockito.Mockito.mock | ||
|
||
class SmallImageUIStyleTests { | ||
val defaultSmallImageUIStyle = SmallImageUIStyle.Builder().build() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can we also add a test for create SmallImageUIStyle no builder styles used
and verify that the default style is used to all elements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, some minor nits
Description
These tests should be merged after #308
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: