Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
Update carthage dependency, update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dreampiggy committed Sep 2, 2018
1 parent 213c86e commit 2613921
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "rs/SDWebImage" "5.x"
github "rs/SDWebImage" >= 5.0
github "Flipboard/FLAnimatedImage" >= 1.0.11
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "Flipboard/FLAnimatedImage" "1.0.14"
github "rs/SDWebImage" "2bb336bc12a5690dd11988c0bc8bef2c7318508d"
github "rs/SDWebImage" "5.0.0-beta3"
4 changes: 4 additions & 0 deletions Example/SDWebImageFLPlugin.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
325E27CE213BE44A00044370 /* SDFLAnimatedImageTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 325E27CC213BE44600044370 /* SDFLAnimatedImageTests.m */; };
3268B08D21394656007B9EA8 /* TestImage.gif in Resources */ = {isa = PBXBuildFile; fileRef = 3268B08C21394656007B9EA8 /* TestImage.gif */; };
327086A021355619004E2A5A /* SDTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 3270869E21355618004E2A5A /* SDTestCase.m */; };
6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
Expand Down Expand Up @@ -44,6 +45,7 @@
1E432E088FA07DCA744C9DEC /* Pods-SDWebImageFLPlugin_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SDWebImageFLPlugin_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SDWebImageFLPlugin_Tests/Pods-SDWebImageFLPlugin_Tests.release.xcconfig"; sourceTree = "<group>"; };
2B3606C01CAAC9EC78DABB43 /* Pods-SDWebImageFLPlugin_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SDWebImageFLPlugin_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SDWebImageFLPlugin_Tests/Pods-SDWebImageFLPlugin_Tests.debug.xcconfig"; sourceTree = "<group>"; };
3161D0000296D73AB1C062A6 /* Pods-SDWebImageFLPlugin_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SDWebImageFLPlugin_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SDWebImageFLPlugin_Example/Pods-SDWebImageFLPlugin_Example.debug.xcconfig"; sourceTree = "<group>"; };
325E27CC213BE44600044370 /* SDFLAnimatedImageTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SDFLAnimatedImageTests.m; path = Tests/SDFLAnimatedImageTests.m; sourceTree = SOURCE_ROOT; };
3268B08C21394656007B9EA8 /* TestImage.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = TestImage.gif; sourceTree = "<group>"; };
3270869E21355618004E2A5A /* SDTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDTestCase.m; sourceTree = "<group>"; };
3270869F21355618004E2A5A /* SDTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDTestCase.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -176,6 +178,7 @@
3270869F21355618004E2A5A /* SDTestCase.h */,
3270869E21355618004E2A5A /* SDTestCase.m */,
6003F5BB195388D20070C39A /* SDWebCacheCategoriesTests.m */,
325E27CC213BE44600044370 /* SDFLAnimatedImageTests.m */,
6003F5B6195388D20070C39A /* Supporting Files */,
);
path = Tests;
Expand Down Expand Up @@ -405,6 +408,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
325E27CE213BE44A00044370 /* SDFLAnimatedImageTests.m in Sources */,
327086A021355619004E2A5A /* SDTestCase.m in Sources */,
6003F5BC195388D20070C39A /* SDWebCacheCategoriesTests.m in Sources */,
);
Expand Down
55 changes: 55 additions & 0 deletions Example/Tests/SDFLAnimatedImageTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <[email protected]>
* (c) Matt Galloway
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

#import "SDTestCase.h"

@interface SDFLAnimatedImageTests : SDTestCase

@end

@implementation SDFLAnimatedImageTests

- (void)testSDFLAnimatedImageInitWithCoder {
SDFLAnimatedImage *image1 = [SDFLAnimatedImage imageWithContentsOfFile:[self testGIFPath]];
expect(image1).notTo.beNil();
NSData *encodedData = [NSKeyedArchiver archivedDataWithRootObject:image1];
expect(encodedData).notTo.beNil();
SDFLAnimatedImage *image2 = [NSKeyedUnarchiver unarchiveObjectWithData:encodedData];
expect(image2).notTo.beNil();

// Check each property
expect(image1.scale).equal(image2.scale);
expect(image1.size).equal(image2.size);
expect(image1.animatedImageData).equal(image2.animatedImageData);
expect(image1.animatedImageLoopCount).equal(image2.animatedImageLoopCount);
expect(image1.animatedImageFrameCount).equal(image2.animatedImageFrameCount);
}

// Since `SDFLAnimatedImage` confroms to `SDAnimatedImage` protocol, it should be compatible for `SDAnimatedImageView` rendering. Maybe this may be changed in the future but currently add this test as well.
- (void)testSDFLAnimatedImageWorksForSDAnimatedImageView {
SDAnimatedImageView *imageView = [SDAnimatedImageView new];
SDFLAnimatedImage *image = [SDFLAnimatedImage imageWithData:[self testGIFData]];
imageView.image = image;
expect(imageView.image).notTo.beNil();
expect(imageView.currentFrame).notTo.beNil(); // current frame
}

#pragma mark - Util

- (NSString *)testGIFPath {
NSBundle *testBundle = [NSBundle bundleForClass:[self class]];
return [testBundle pathForResource:@"TestImage" ofType:@"gif"];
}

- (NSData *)testGIFData {
NSData *testData = [NSData dataWithContentsOfFile:[self testGIFPath]];
return testData;
}

@end
9 changes: 0 additions & 9 deletions Example/Tests/SDWebCacheCategoriesTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ - (void)testFLAnimatedImageViewSetImageWithGIFPlaceholder {
[self waitForExpectationsWithCommonTimeout];
}

// Since `SDFLAnimatedImage` confroms to `SDAnimatedImage` protocol, it should be compatible for `SDAnimatedImageView` rendering. Maybe this may be changed in the future but currently add this test as well.
- (void)testSDFLAnimatedImageWorksForSDAnimatedImageView {
SDAnimatedImageView *imageView = [SDAnimatedImageView new];
SDFLAnimatedImage *image = [SDFLAnimatedImage imageWithData:[self testGIFData]];
imageView.image = image;
expect(imageView.image).notTo.beNil();
expect(imageView.currentFrame).notTo.beNil(); // current frame
}

#pragma mark - Util

- (NSString *)testGIFPath {
Expand Down
40 changes: 20 additions & 20 deletions SDWebImageFLPlugin/Module/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

0 comments on commit 2613921

Please sign in to comment.