Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Improved test coverage for bitmap#4224

Merged
ahojnnes merged 1 commit into
maincolmap/colmap:mainfrom
user/jsch/bitmap-test-covcolmap/colmap:user/jsch/bitmap-test-covCopy head branch name to clipboard
Mar 11, 2026
Merged

Improved test coverage for bitmap#4224
ahojnnes merged 1 commit into
maincolmap/colmap:mainfrom
user/jsch/bitmap-test-covcolmap/colmap:user/jsch/bitmap-test-covCopy head branch name to clipboard

Conversation

@ahojnnes

Copy link
Copy Markdown
Contributor

No description provided.

@ahojnnes
ahojnnes enabled auto-merge (squash) March 11, 2026 10:50
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the test coverage for the Bitmap class, ensuring greater robustness and correctness across various image manipulation operations. New tests validate grayscale image handling, boundary conditions for interpolation, comprehensive rotation scenarios, and proper cloning behavior. Additionally, error handling for file I/O and metadata extraction has been thoroughly tested, contributing to a more reliable image processing utility.

Highlights

  • Expanded Grayscale Testing: New test cases were added for Bitmap::Fill and Bitmap::InterpolateBilinear to ensure correct functionality with grayscale images.
  • Enhanced Rotation Robustness: The Bitmap::Rot90 method received additional tests covering edge cases such as empty bitmaps, negative rotation counts, and no-operation rotations (0 or 4 rotations).
  • Improved Cloning Verification: Tests were introduced for Bitmap::CloneAsRGB and Bitmap::CloneAsGrey to confirm proper behavior when cloning a bitmap to its existing color space.
  • Comprehensive EXIF Metadata Handling: New tests for Bitmap::ExifCameraModel were added to verify behavior when essential metadata like camera model or focal length is missing.
  • Advanced File I/O Testing: New test cases cover reading and writing images with linear colorspace, handling invalid file formats during writing, and gracefully failing when reading non-existent files or images with unsupported channel counts.
  • Code Refactoring in Tests: Test setup code was streamlined by directly constructing file paths with CreateTestDir() and updating several test cases to use constexpr for width and height variables.
Changelog
  • src/colmap/sensor/bitmap_test.cc
    • Added TEST(Bitmap, FillGrey) to verify grayscale fill operations.
    • Added TEST(Bitmap, InterpolateBilinearGrey) for bilinear interpolation on grayscale images.
    • Added TEST(Bitmap, InterpolateBilinearOutOfBounds) to check interpolation behavior at image boundaries.
    • Added TEST(Bitmap, Rot90Empty) for rotating empty bitmaps.
    • Added TEST(Bitmap, Rot90NegativeK) for handling negative rotation counts.
    • Added TEST(Bitmap, Rot90NoOp) for 0 or 4 rotations, which should result in no change.
    • Added TEST(Bitmap, CloneAsRGBFromRGB) for cloning an RGB bitmap to RGB.
    • Added TEST(Bitmap, CloneAsGreyFromGrey) for cloning a grayscale bitmap to grayscale.
    • Added TEST(Bitmap, ExifCameraModelNoModel) for scenarios where camera model EXIF data is absent.
    • Added TEST(Bitmap, ExifCameraModelNoFocalLength) for scenarios where focal length EXIF data is absent.
    • Added TEST(Bitmap, ReadWriteLinearColorspace) for testing image I/O with linear colorspace.
    • Added TEST(Bitmap, WriteInvalidFormat) to test writing to unsupported file formats.
    • Added TEST(Bitmap, ReadUnsupportedChannels) for reading images with an unsupported number of channels.
    • Refactored file path creation by directly using CreateTestDir() output.
    • Replaced int variables for width and height with constexpr int in several parameterized tests.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request significantly improves the test coverage for the Bitmap class by adding a variety of new test cases. The new tests cover edge cases for functions like Fill, InterpolateBilinear, and Rot90, as well as different code paths for CloneAsRGB, CloneAsGrey, ExifCameraModel, Read, and Write. The changes also include some nice refactorings in the test suite, such as using constexpr for constants and simplifying file path creation. The new tests are well-written and the changes are solid.

@ahojnnes
ahojnnes merged commit a45b988 into main Mar 11, 2026
14 checks passed
@ahojnnes
ahojnnes deleted the user/jsch/bitmap-test-cov branch March 11, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.