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

[Snapshots] Fix device specs #285

Merged
merged 10 commits into from
Oct 23, 2024
Merged

[Snapshots] Fix device specs #285

merged 10 commits into from
Oct 23, 2024

Conversation

rbro112
Copy link
Contributor

@rbro112 rbro112 commented Oct 22, 2024

Fixes device specs to be true-to-size to reference devices. Also adjusts to properly scale custom specs. Added a repro case of a troublesome client snapshot that wasn't rendering in landscaped.

Verified with a sxs run against Google's compose preview snapshotting library, Emerge matches 1:1 on all device specs now. Android Studio images (copied directly from the previews) appear smaller, and dimensions do not match the reference device specs, so I believe matching the expected device dimensions like we do now is preferred over 1:1 matching of AS.

Also checked all reference devices against the outputted dimensions from Emerge snapshots after this change and all match 1:1.

Screenshot 2024-10-22 at 9 15 45 AM

Copy link
Contributor Author

rbro112 commented Oct 22, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @rbro112 and the rest of your teammates on Graphite Graphite

@rbro112 rbro112 changed the title Fix device specs [WIP] Fix device specs Oct 22, 2024
Copy link

emerge-tools bot commented Oct 22, 2024

📸 Snapshot Test

73 modified, 3 added, 51 unchanged

Name Version Added Removed Modified Unchanged Errored Approval
Emerge snapshots sample
com.emergetools.snapshots.sample.debug
1.0 (1) 3 0 73 51 1 ✅ Approved

🛸 Powered by Emerge Tools

@rbro112 rbro112 changed the title [WIP] Fix device specs [Snapshots] Fix device specs Oct 22, 2024
}

private fun dpToPx(dp: Int, scalingFactor: Float): Int {
return (dp * scalingFactor).toInt()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this just needs to be explicitly rounded down.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated to use toInt() in the pixel conversion later. Ended up with the proper dimensions going with that approach

@rbro112 rbro112 force-pushed the ryan/fix_device_specs branch from 853f85a to dfaaaf4 Compare October 22, 2024 23:51
@rbro112 rbro112 merged commit cc54780 into main Oct 23, 2024
6 checks passed
@rbro112 rbro112 deleted the ryan/fix_device_specs branch October 23, 2024 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants