Skip to content

Conversation

dijidiji
Copy link

@dijidiji dijidiji commented Sep 11, 2025

Description

Adapts Andrew Cain's resource bundle tests from sktest for skunit_tests. They were a good candidate for unit tests since it's simple to confirm the loading and unloading of resources.

Also fixes an issue discovered when porting these tests over:
When loading, the IMAGE_RESOURCE case had the following check:
if ( ! has_resource_bundle(line_name) ) return;
This would always return (because it was checking resource bundles
rather than bitmaps), bitmaps to be loaded but never be added to
the list of bundled resources.
This in turn resulted in free_resource_bundle never freeing that resource.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Testing Checklist

Ran both test executables to ensure the tests functioned the same way and made sure the output was as expected after the bug fix (bitmaps successfully unloaded).

  • Tested with sktest
  • Tested with skunit_tests

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have requested a review via the Planner board

Adapted from Andrew Cain's test_bundles.cpp
When loading, the IMAGE_RESOURCE case had the following check:
if ( ! has_resource_bundle(line_name) ) return;
This would always return (because it was checking resource bundles
rather than bitmaps), bitmaps to be loaded but never be added to
the list of bundled resources.
This in turn resulted in free_resource_bundle never freeing that resource.
@dijidiji dijidiji changed the title Add resource bundle tests Add resource bundle tests and fix bug in free_resource_bundle Sep 11, 2025
@dijidiji dijidiji marked this pull request as ready for review September 11, 2025 11:49
@dijidiji dijidiji changed the title Add resource bundle tests and fix bug in free_resource_bundle Add resource bundle unit tests and fix bug in free_resource_bundle Sep 11, 2025
Copy link

@JPF2209 JPF2209 left a comment

Choose a reason for hiding this comment

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

Summary

  • this code is good enough to approve for the 2nd peer review

Type of Change

  • This piece of code correctly identifies the changes made being adding additional tests

Code Readability

  • The code is very understandable and clear in what it needs to be comparing it to the other code.

Maintainability

  • As this is in the same style as the other code, it's quite maintainable being simple while doing the job.

Code Simplicity

  • This code is simple in it's execution following established design patterns and best practices

Edge Cases

  • The code deals with edge cases simply by having code that doesn't seem to need to deal with edge case

Test Thoroughness

  • For all the key tests in this type of scenario, this covers it all and the code has been tested in multiple environments and it works.

Backward Compatibility

  • The code doesn't break existing functionality in the way it works.

Performance Considerations

  • Performance works well but it isn't usually a consideration for this type of change

Security Concerns

  • This code has no impact negatively or positively for security.

Dependencies

  • There are no new added dependencies.

Documentation

  • The documentation provided is through and simple to follow at the same time

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