Skip to content

Add test comparing WebP and JPEG sub-size dimensions - #2696

Closed
sonali195 wants to merge 4 commits into
WordPress:trunkfrom
sonali195:fix/issue-1234-short-description
Closed

sonali195 wants to merge 4 commits into
WordPress:trunkfrom
sonali195:fix/issue-1234-short-description

Conversation

@sonali195

@sonali195 sonali195 commented Oct 6, 2026 •

Copy link
Copy Markdown

Summary

Adds a PHPUnit test checking that each WebP sub-size has the same width and height as the matching JPEG sub-size in the attachment metadata, using an image large enough to be scaled.

This adds regression test coverage to ensure dimension consistency between WebP and JPEG sub-sizes.

How to test

  1. Run npm run wp-env-test start.
  2. Run npm run test-php -- --filter test_it_should_create_webp_subsizes_with_the_same_dimensions.

Use of AI tools

I used Claude to help draft the test. I reviewed the code, formatted it to WordPress standards, and ran the test suite myself.

Hi! I'd like to work on this. I'm going to start by adding a PHPUnit test that
compares the WebP sub-size dimensions with the JPEG sub-sizes in the metadata,
to reproduce the problem. Is this still available?
@github-actions github-actions Bot added the [Plugin] Modern Image Formats Formerly WebP Uploads [slug: webp-uploads] label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sonali195 <sonaliprajapati@git.wordpress.org>
Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Comment thread plugins/webp-uploads/tests/test-load.php
Fix test formatting for coding standards
@mukeshpanchal27 mukeshpanchal27 added [Type] Enhancement A suggestion for improvement of an existing feature no milestone PRs that do not have a defined milestone for release labels Oct 6, 2026
@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.50%. Comparing base (a25f804) to head (abb6ba0).
⚠️ Report is 2 commits behind head on trunk.

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk    #2696   +/-   ##
=======================================
  Coverage   70.50%   70.50%           
=======================================
  Files          91       91           
  Lines        7869     7869           
=======================================
  Hits         5548     5548           
  Misses       2321     2321           
Flag Coverage Δ
multisite 70.50% <ø> (ø)
single 35.34% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonali195

Copy link
Copy Markdown
Author

Hi @mukeshpanchal27, apologies for the initial confusion! In my first commit (1e8daa6), the existing test was accidentally replaced while adding the new test.

I restored the original test in commit ebcc3db. As shown in the current "Files changed" tab, no existing tests or core code are removed—only the new test method test_it_should_create_webp_subsizes_with_the_same_dimensions_as_the_jpeg_subsizes() is added. All 19 CI tests are passing green.

@sonali195 sonali195 closed this Oct 9, 2026
@sonali195
sonali195 deleted the fix/issue-1234-short-description branch October 9, 2026 07:19
@sonali195
sonali195 restored the fix/issue-1234-short-description branch October 9, 2026 07:20
@sonali195

Copy link
Copy Markdown
Author

Closing in favor of #2704

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no milestone PRs that do not have a defined milestone for release [Plugin] Modern Image Formats Formerly WebP Uploads [slug: webp-uploads] [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants