Skip to content

Commit 6c6d848

Browse files
committed
Added 2 tests for SDWebImage#2516 Fix extention long length of file name
1 parent 8d788ab commit 6c6d848

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: Tests/Tests/SDImageCacheTests.m

+14
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,20 @@ - (void)test35CachePathForKeyWithDotButNoExtension {
227227
expect([cachePath pathExtension]).to.equal(@"");
228228
}
229229

230+
- (void)test36CachePathForKeyWithURLQueryParams {
231+
NSString *urlString = @"https://imggen.alicdn.com/3b11cea896a9438329d85abfb07b30a8.jpg?aid=tanx&tid=1166&m=%7B%22img_url%22%3A%22https%3A%2F%2Fgma.alicdn.com%2Fbao%2Fuploaded%2Fi4%2F1695306010722305097%2FTB2S2KjkHtlpuFjSspoXXbcDpXa_%21%210-saturn_solar.jpg_sum.jpg%22%2C%22title%22%3A%22%E6%A4%8D%E7%89%A9%E8%94%B7%E8%96%87%E7%8E%AB%E7%91%B0%E8%8A%B1%22%2C%22promot_name%22%3A%22%22%2C%22itemid%22%3A%22546038044448%22%7D&e=cb88dab197bfaa19804f6ec796ca906dab536b88fe6d4475795c7ee661a7ede1&size=640x246";
232+
NSString *cachePath = [[SDImageCache sharedImageCache] cachePathForKey:urlString inPath:@""];
233+
expect(cachePath).toNot.beNil();
234+
expect([cachePath pathExtension]).to.equal(@"jpg");
235+
}
236+
237+
- (void)test37CachePathForKeyWithTooLongExtension {
238+
NSString *urlString = @"https://imggen.alicdn.com/3b11cea896a9438329d85abfb07b30a8.jpgasaaaaaaaaaaaaaaaaaaaajjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjaaaaaaaaaaaaaaaaajjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj";
239+
NSString *cachePath = [[SDImageCache sharedImageCache] cachePathForKey:urlString inPath:@""];
240+
expect(cachePath).toNot.beNil();
241+
expect([cachePath pathExtension]).to.equal(@"");
242+
}
243+
230244
- (void)test40InsertionOfImageData {
231245
XCTestExpectation *expectation = [self expectationWithDescription:@"Insertion of image data works"];
232246

0 commit comments

Comments
 (0)