This repository has been archived by the owner on Jan 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 1.1-development: Remove Travis build (Swift is not working yet) Update file comments Add Travis build status Update README.md with new title Rename swift-gif to SwiftGif Add .travis.yml Add testAnimatedImageWithSource() Add test.gif, testDelayForImageAtIndex() Fix typo in test functions Add tests for greatest common divisor Remove CoreData stuff from AppDelegate.swift Remove xcdatamodel Add test template Remove TODO comment
- Loading branch information
Showing
22 changed files
with
266 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
language: swift | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# swift-gif | ||
# SwiftGif | ||
|
||
A small `UIImage` extension with gif support. | ||
|
||
|
247 changes: 118 additions & 129 deletions
247
swift-gif.xcodeproj/project.pbxproj → SwiftGif.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ject.xcworkspace/contents.xcworkspacedata → ...ject.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// AppDelegate.swift | ||
// SwiftGif | ||
// | ||
// Created by Arne Bahlo on 10.06.14. | ||
// Copyright (c) 2014 Arne Bahlo. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
@UIApplicationMain | ||
class AppDelegate: UIResponder, UIApplicationDelegate { | ||
|
||
var window: UIWindow? | ||
|
||
|
||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { | ||
self.window = UIWindow(frame: UIScreen.mainScreen().bounds) | ||
|
||
self.window!.rootViewController = RootViewController() | ||
self.window!.backgroundColor = UIColor.whiteColor() | ||
self.window!.makeKeyAndVisible() | ||
return true | ||
} | ||
|
||
func applicationWillResignActive(application: UIApplication) { | ||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | ||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | ||
} | ||
|
||
func applicationDidEnterBackground(application: UIApplication) { | ||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | ||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | ||
} | ||
|
||
func applicationWillEnterForeground(application: UIApplication) { | ||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. | ||
} | ||
|
||
func applicationDidBecomeActive(application: UIApplication) { | ||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | ||
} | ||
|
||
func applicationWillTerminate(application: UIApplication) { | ||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. | ||
} | ||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
swift-gif/RootViewController.swift → SwiftGif/RootViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// | ||
// GifTests.swift | ||
// SwiftGif | ||
// | ||
// Created by Arne Bahlo on 12.06.14. | ||
// Copyright (c) 2014 Arne Bahlo. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
import UIKit | ||
import ImageIO | ||
|
||
class GifTests: XCTestCase { | ||
|
||
var imageData: NSData? | ||
var source: CGImageSourceRef? | ||
|
||
override func setUp() { | ||
super.setUp() | ||
|
||
imageData = NSData(contentsOfURL: NSBundle.mainBundle().URLForResource("test", withExtension: "gif")) | ||
|
||
let cfImageData = imageData! as CFDataRef | ||
source = CGImageSourceCreateWithData(cfImageData, nil).takeRetainedValue() | ||
} | ||
|
||
override func tearDown() { | ||
imageData = nil | ||
|
||
super.tearDown() | ||
} | ||
|
||
func testGCDForPair() { | ||
let values = (9, 4011) | ||
let result = UIImage.gcdForPair(values.0, values.1) | ||
let expected = 3 | ||
|
||
XCTAssert(result == expected, "UIImage.gcdForPair(\(values.0), \(values.1)) = \(result), but should be \(expected)") | ||
} | ||
|
||
func testGCDForArray() { | ||
let values = [13, 17_381, 169] | ||
let result = UIImage.gcdForArray(values) | ||
let expected = 13 | ||
|
||
XCTAssert(result == expected, "UIImage.gcdForArray(\(values)) = \(result), but should be \(expected)") | ||
} | ||
|
||
func testDelayForImageAtIndex() { | ||
let result = UIImage.delayForImageAtIndex(0, source: source!) | ||
let expected = 0.5 | ||
|
||
XCTAssert(result == expected, "UIImage.delayForImageAtIndex(0, source) = \(result), but should be \(expected)") | ||
} | ||
|
||
func testAnimatedImageWithSource() { | ||
let image = UIImage.animatedImageWithSource(source!) | ||
|
||
XCTAssert(image, "UIImage.animatedImageWithSource(source) is nil, but shouldn't") | ||
|
||
// Note: There should be 12, because they delay is the same for all | ||
XCTAssert(image!.images.count == 12, "image.images.count = \(image!.images.count), but should be 12") | ||
|
||
XCTAssert(image!.duration == 6.0, "image.duration = \(image!.duration), but should be 6.0") | ||
} | ||
|
||
} |
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions
5
swift-gif.xcodeproj/xcuserdata/arne.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.