Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
Add basic test for excessive padding on resized bitmap data
Browse files Browse the repository at this point in the history
  • Loading branch information
plumbojumbo committed Dec 3, 2016
1 parent c9d823b commit 487b4a0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions CocoaImageHashingTests/OSFastGraphicsTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,22 @@ - (void)testFastDCTMultithreadedPerformance
NSLog(@"DCT processing %@ MB/s", @(MBs / executionTime));
}

- (void)testResizedRGBABitmapDataScanline
{
NSData *imageData = [self loadImageAsData:@"misc/latrobe.bmp"];
for (NSUInteger dim = 8; dim <= 9; dim++) {
NSData *pixels = [imageData RGBABitmapDataForResizedImageWithWidth:dim
andHeight:dim];
uint64_t *lines = (uint64_t *)[pixels bytes];
NSUInteger length = [pixels length] / sizeof(lines);
for (NSUInteger i = 0; i < length; i += 8) {
XCTAssertNotEqual(lines[i], (uint64_t)0);
XCTAssertNotEqual(lines[i + 1], (uint64_t)0);
XCTAssertNotEqual(lines[i + 2], (uint64_t)0);
XCTAssertNotEqual(lines[i + 3], (uint64_t)0);
XCTAssertNotEqual(lines[i + 4], (uint64_t)0);
}
}
}

@end

0 comments on commit 487b4a0

Please sign in to comment.