Commit Graph

483 Commits

Author SHA1 Message Date
DreamPiggy 150affd201 Add new SDCategoriesTests for any other WebCache category tests 2018-02-19 20:38:55 +08:00
DreamPiggy 1f27d3c15f Rename SDCategoriesTests to SDWebCacheCategoriesTests to make it focus on view category, import KVOController instead of build-in KVO for test 2018-02-19 20:19:14 +08:00
DreamPiggy f115830f97 Fix test again about typo 2018-02-13 21:54:21 +08:00
DreamPiggy d6a3e2c1ae Change the context arg to init method because it should be readonly after created 2018-02-07 19:59:00 +08:00
DreamPiggy 5000e8095b Fix the test for CustomDownloaderOperation 2018-01-26 00:02:01 +08:00
DreamPiggy edd26fc1e6 Merge branch 'master' of https://github.com/rs/SDWebImage into 5.x
* 'master' of https://github.com/rs/SDWebImage:
  Add protect to some Core Graphics methods
  Change all UIImage init method to alloc instead of autorelease to immediately release it after usage
  Add a option SDWebImageFromCacheOnly to load the image from cache only and prevent network
  Update the test for custom operation interface
  Use synchronized instead of semaphore in SDWebImageDownloader to make it more easy to understand :)
  Use a lock instead of barrier queue to avoid dispatch_sync blocking the main queue on race condition
2018-01-23 11:51:49 +08:00
DreamPiggy 82c44e275a Update the test 2018-01-22 21:54:12 +08:00
DreamPiggy aac654b069 Update the test for custom operation interface 2018-01-21 11:11:46 +08:00
DreamPiggy 46a55ba6c7 Merge branch 'master' of https://github.com/rs/SDWebImage into 5.x
* 'master' of https://github.com/rs/SDWebImage:
  Update the test and description to make it more clear
  Fix the issue that `setAnimationImagesWithURLs` weak reference may dealloc before the animated images was set
  Fix the strange file permissions issue
  Add the SDImageCacheQueryMemoryOnly to specify query memory only
  Update the cache options name to make it more clear
  Added missing param in storeImage examples
  Add a NSProgress property represent the image loading progress, this allow user add KVO on it for complicated logic
2018-01-17 19:22:54 +08:00
DreamPiggy 3f3a309fb4 Update the test and description to make it more clear 2018-01-16 11:34:56 +08:00
DreamPiggy 1ef45bace1 Add a NSProgress property represent the image loading progress, this allow user add KVO on it for complicated logic 2018-01-13 22:34:58 +08:00
DreamPiggy db5307eb94 Change our imageCache `storeImageDataToDisk` to internal use IO-queue. And also change error from POSIX errno to Cocoa file error 2018-01-03 15:21:02 +08:00
DreamPiggy caafe27937 Upgrade target deployment version to iOS 8.0 / macOS 10.10 2018-01-01 13:15:51 +08:00
DreamPiggy 8a8d661ea7 Merge branch 'master' of https://github.com/rs/SDWebImage into 5.x
* 'master' of https://github.com/rs/SDWebImage:
  Adopt the current requirement, change ImageIO coder's canDeocdeFromHEIC to actual implementation
  Fix Clang Static Analyzer warning for number nil check from Xcode 9.2
2017-12-29 22:57:32 +08:00
DreamPiggy 8b3c4c2cde Fix Clang Static Analyzer warning for number nil check from Xcode 9.2 2017-12-29 12:52:29 +08:00
DreamPiggy f2888f799c Merge branch 'master' of https://github.com/rs/SDWebImage into 5.x
* 'master' of https://github.com/rs/SDWebImage: (25 commits)
  When store image with no data for SDImageCache, check whether it contains alpha to use PNG or JPEG format
  Fix the way remove all elements from pointer array
  Remove some unused code, fix typo, update the comments
  Use a weak pointerArray to store the operations for sd_setAnimationImagesWithURLs, avoid extra retain of operation instance
  Use a copy-weak maptable for operations stored in UIView(WebCacheOperation) category to avoid retain of operation, and also use lock to keep thread-safe
  Fix progressive WebP decoding by creating data provider with actual data size
  Add a SDWebImageExternalCustomManagerKey context arguments to allow user to custom image manager for UIView category to avoid build from scratch
  Check the group instance before calling group leave
  Remove the out-dated compatible code for non-ARC
  Update the comments
  Allow custom SDWebImageDownloaderOperation to handle HTTP redirect
  Update the comments for that SDWebImageInternalSetImageGroupKey key
  Fix potential thread-safe problem in SDWebImagePrefetcher by keeping all access through prefetcher queue and retain the local URLs firstly
  Update the comments and remove the unnecessary main queue check
  Follow Apple doc and remove that manual calculation of byte alignment to make it more universal for different architecture device
  Change prefetchURLs from nonatomic to atomic to avoid multi-thread access crash
  capture currentURL instead of using index to access to avoid race condition
  Grab the poster image instead of image itself to avoid an UIAnimatedImage been set
  Update the documents
  Update tests to invalidate session after usage
  ...
2017-12-22 21:06:48 +08:00
DreamPiggy a7c8ce5864 Update tests to invalidate session after usage 2017-11-27 00:37:20 +08:00
Bogdan Poplauschi ab06d2370b Merge branch 'master' into 5.x 2017-10-27 10:17:44 +03:00
Bogdan Poplauschi 04855c945e Merge pull request #2061 from dvkch/master
Cached image filename are sometimes generated with invalid path extensions
2017-10-21 17:15:11 +03:00
Bogdan Poplauschi 4e8d450c69 Merge branch 'master' into 5.x
# Conflicts:
#	Tests/Tests/SDImageCacheTests.m
2017-10-21 16:50:19 +03:00
Bogdan Poplauschi ed411dcba9 Finally fixed the tests from `SDImageCacheTests` so we can re-enable `test40InsertionOfImageData`
- the problems: some tests were just poorly written, using async calls but not properly setting async expectations. Those were generating undefined behaviour (not clear if/when those callbacks would be executed).
- also, we wanted to call `clearAllCaches` before every test, but since some methods there are async, this doesn't work with the way `setUp` was designed. So basically sometimes before a test we could clear the cache but sometimes not, or even the clear could come while running the test which was worst
- decided to fix this by making sure after every test that we manually clear what we have added.
2017-10-20 21:14:25 +03:00
Bogdan Poplauschi 86151183f6 Switched all the tests from using https://s3.amazonaws.com/fast-image-cache/demo-images/* images which are big and sometimes fail to arrive in 5 seconds (before the test can timeout) to smaller images, basically using http://via.placeholder.com/ like http://via.placeholder.com/50x50.jpg or http://via.placeholder.com/200x200.png
This should speed up the tests a bit and also avoid some of the random failures due to timeout
2017-10-20 20:29:18 +03:00
Bogdan Poplauschi 90c90a06bc Refactored the `SDWebImageDecoderTests` a bit. Per DRY, created `verifyCoder:withLocalImageURL:isAnimatedImage:` method that will take a imageURL and a coder and will check decoding and encoding back and forth, sizes and so. Reusing this method for the static WebP image, for the animated WebP image and for the GIF. 2017-10-20 18:40:09 +03:00
Bogdan Poplauschi f57c21d52a Improved the code coverage of our unit tests (given that we disabled test40InsertionOfImageData).
Also updated the Tests Podfile so we don't get a warning (xcodeproj was renamed to project)
2017-10-20 16:15:38 +03:00
Bogdan Poplauschi 9d80374064 Merge branch 'master' into 5.x 2017-10-19 20:52:36 +03:00
Bogdan Poplauschi 05828742e8 Just disabled this test test40InsertionOfImageData - keeps failing for unknown reasons (strangely sometimes the data doesn't get written to disk) 2017-10-19 19:15:21 +03:00
Bogdan Poplauschi 324563c7d2 Merge pull request #1898 from walkline/master into 5.x
Handle storeImageDataToDisk error.
2017-10-18 13:04:07 +03:00
DreamPiggy a0879fc049 Feature: refactor decoding code and provide decoding plugin
- open the decoding/encoding procedures to the users
- switch from hardcoded decoding/encoding to pluginable decoders/encoders (builtin + user created)
- `SDWebImageCodersManager` is a singleton holding an array of `SDImageCoder` (protocol). Even though a singleton is not necesarily a good pattern, in this case it eliminates dealing with passing this array around
- uses a priority queue behind scenes, which means the latest added coders have priority.
- the priority is crucial when encoding/decoding something, we go through the list and ask each coder if they can handle the current data (see `canDecodeFromData:`, `canEncodeToFormat:`, `canIncrementallyDecodeFromData:`)
- each coder must conform to this protocol `SDImageCoder` describing all the required behavior for a coder
- we provide 3 built-in coders: `SDWebImageImageIOCoder` (for JPEG, PNG, TIFF), `SDWebImageGIFCoder` (for GIF), `SDWebImageWebPCoder` (for WebP and animated WebP)
- the user of SDWebImage can create custom coders by conforming to `SDImageCoder` and adding the coders to `SDWebImageCodersManager`. See `addCoder:` or `removeCoder:` or `coders` getter to get the array
- in order to preserve backwards compatibility, the UIImage categories were preserved, calling the new coders APIs described above
2017-10-16 19:52:18 +03:00
walkline b51e0ca689 Removing not needed functions in SDImageCache. Using DI with initializer. 2017-10-11 21:11:36 +03:00
walkline 5fbbf73986 Merge branch 'master' of github.com:rs/SDWebImage 2017-10-11 20:16:06 +03:00
Bogdan Poplauschi ff0690547d Xcode 9 recommended settings applied 2017-10-06 20:58:44 +03:00
DreamPiggy 74566aeb98 Add a test for SDWebImageRefreshCached 2017-09-23 20:34:08 +08:00
DreamPiggy 05dfa6c588 Fix clang strict prototype warning in test 2017-09-21 10:15:30 +08:00
walkline b9c17dcdd0 Merge branch 'master' of github.com:rs/SDWebImage
# Conflicts:
#	Tests/SDWebImage Tests.xcodeproj/project.pbxproj
2017-09-09 14:57:58 +03:00
skyline75489 d11597a796 Move common test logic to SDTestCase 2017-08-03 07:50:51 +08:00
Bogdan Poplauschi f6cca301d5 Merge pull request #1952 from dreampiggy/master
#1951: Fix animated WebP decoding issue, including canvas size, the support for dispose method and the duration per frame
2017-07-31 15:26:06 +03:00
Bogdan Poplauschi 637c418139 Removed unreliable check from Downloader tests - sometimes there is more than 1 download in the queue which makes the tests fail 2017-07-31 13:02:26 +03:00
DreamPiggy f3cffd0aca Add test for animated WebP image array
The image array used for +[UIImage animatedImageWithImages:] should share the same size.
2017-07-03 02:46:42 +08:00
walkline a581ab1991 Handle storeImageDataToDisk error. 2017-05-11 15:31:51 +03:00
Bogdan Poplauschi 8d1a0ae091 Added tests for the scale down decoding + test image and updated a bit the other decoder tests 2016-10-06 16:00:43 +03:00
Bogdan Poplauschi 9879ddf0dc Test xcodeproj updated to Xcode 8 2016-10-06 16:00:02 +03:00
Bogdan Poplauschi 9c0c31f524 Updated the test for FLAnimatedImage 2016-10-04 16:48:12 +03:00
Bogdan Poplauschi ed5f018c2b Fixed the tests - were failing because of the #984 changes 2016-10-01 12:40:50 +03:00
Bogdan Poplauschi 13ffb2327c Stopped the simulators from being too verbose 2016-09-30 21:07:44 +03:00
Bogdan Poplauschi 67e0719755 Update according to Xcode 8 recommended settings. Set the deployment target to iOS 8.0. No code signing. Enabled some warnings 2016-09-30 21:06:05 +03:00
Bogdan Poplauschi 1cbe54d600 Tests for the WebCache categories 2016-09-25 19:53:53 +03:00
Bogdan Poplauschi 460c2e01a1 Tests project: CocoaPods 1.1.0, dynamic frameworks, include all the code from SDWebImage (MapKit and GIF), updated imports so they work fine 2016-09-25 19:46:46 +03:00
Bogdan Poplauschi f48a133f1b Prefetcher tests 2016-09-25 15:49:33 +03:00
Bogdan Poplauschi ea0bd97d10 Tests for SDWebImageManager 2016-09-25 15:17:21 +03:00
Bogdan Poplauschi fbca6a6dc3 Removed unneded code 2016-09-25 14:57:51 +03:00
Bogdan Poplauschi cfc182f2e5 Added SDImageCacheConfig to all targets, test images, code coverage setting, tests for SDImageCache, SDWebImageDownloader, SDWebImageDownloaderOperation, SDWebImageDecoder 2016-09-24 00:14:13 +03:00
Bogdan Poplauschi fbb310b494 Expecta can use the latest version, using the WebP subspec in the Tests Podfile so we can get all the files 2016-09-23 20:37:17 +03:00
Bogdan Poplauschi 179362f55d Attempt to fix the tests as they were 2 tests trying to get the same image 2016-06-13 09:49:10 +03:00
Bogdan Poplauschi 7684fbd9a7 Merge branch '4.x' into gif
# Conflicts:
#	SDWebImage.xcodeproj/project.pbxproj
2016-06-07 08:39:17 +03:00
Bogdan Poplauschi 3364a981d5 Merge branch 'master' into 4.x
+ SDWebImageDownloader downloadImageWithURL:... properly use the weakself-strongself pattern

# Conflicts:
#	.travis.yml
#	Examples/SDWebImage Demo.xcodeproj/project.pbxproj
#	README.md
#	SDWebImage.xcodeproj/project.pbxproj
#	SDWebImage/SDWebImageDownloader.m
#	SDWebImage/SDWebImageDownloaderOperation.h
#	SDWebImage/SDWebImageDownloaderOperation.m
#	SDWebImage/SDWebImageManager.m
#	Tests/Podfile
#	Tests/SDWebImage Tests.xcodeproj/project.pbxproj
2016-06-07 08:36:45 +03:00
Bogdan Poplauschi 6545a3aba1 Bumped the deployment target to iOS 7 (due to NSURLSession) and also incremented the library version to 3.8.0 2016-06-02 19:10:31 +03:00
Bogdan Poplauschi 94c1ec3ed0 Revisited all copyright comments and decided for just one format 2016-06-01 15:53:08 +03:00
Bogdan Poplauschi 7761afca92 Trying to fix the random build failures (probably timeout due to this image url) 2016-06-01 11:58:39 +03:00
Bogdan Poplauschi b059b04fd2 Updated the tests 2016-06-01 10:32:40 +03:00
Bogdan Poplauschi b5a504f326 Trying to get around this last build error "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “www.google.gr” which could put your confidential information at risk." by using a different image 2016-05-29 13:08:29 +03:00
Bogdan Poplauschi 0dc2c41112 Trying to get around this last build error "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “www.google.gr” which could put your confidential information at risk." by using a different image 2016-05-29 12:49:06 +03:00
Bogdan Poplauschi afaf306222 This should fix the build (the tests project) 2016-05-29 00:00:33 +03:00
Bogdan Poplauschi 5ac4e308c7 Fixed the Tests/Podfile, the Target ios was not to be found, so took advantage of this change to simplify it 2016-05-28 23:00:16 +03:00
Bogdan Poplauschi 11840d1313 Attempt to fix the latest build (failed because of Invalid `Podfile` file: [!] The specification of `link_with` in the Podfile is now unsupported, please use target blocks instead.) 2016-05-28 22:07:18 +03:00
Bogdan Poplauschi 13cfc5b89a Merge pull request #883 from mattjgalloway/fix_multiple_downloads
Fix multiple requests for same image and then canceling one
2016-05-23 07:13:01 +03:00
Bogdan Poplauschi 7913b45fae Added the missing Tests scheme 2016-05-08 23:14:48 +03:00
Bogdan Poplauschi e3ba4110a9 Renamed the schemes for consistency, dynamic frameworks are named SDWebImage instead of WebImage. Updated the Tests Podfile + project. Renamed the WebImage.h to SDWebImage.h to match the framework naming 2016-05-08 22:59:32 +03:00
Bogdan Poplauschi a32a1775c2 Renamed SDWebImageManager `downloadImageWithURL:options:progress:completed:` to `loadImageWithURL:options:progress:completed:` as it makes more sense, since we check the cache first and download only if needed
Conflicts:
	SDWebImage/UIImageView+WebCache.m
2016-05-08 21:16:23 +03:00
Martin Oppetit 68ae502797 Adhering to coding style
- also added new line at the end of SDImageCacheTests.m file
2016-02-04 10:14:53 +00:00
Martin Oppetit 9c4fcfa844 Added API to save image NSData to disk cache
- exposing new `- (void)storeImageDataToDisk:(NSData *)imageData
forKey:(NSString *)key` function on SDImageCache
- added unit tests for this new API
- added file extension to kImageTestKey to ensure cache path is valid
for creating NSData
2016-02-01 15:19:59 +00:00
Matt Galloway a02aa42256 Switch to Xcode 6 async tests 2016-01-12 21:04:41 +00:00
Matt Galloway b00b09e706 Move progress / completion handler logic to the operation 2016-01-12 21:04:38 +00:00
Matt Galloway 917c3d479d Fix multiple requests for same image and then canceling one 2016-01-12 21:02:15 +00:00
Bogdan Poplauschi 0373b97f71 Merge pull request #1125 from pauruiz/CacheTests
Cache tests
2015-07-14 16:39:47 +03:00
Konstantinos K. 0e761f4aa7 404 image url was causing the test to fail 2015-06-24 10:37:31 +03:00
Pau Ruiz 79eb6e77c5 Added all methods of the cache module, almost all directly and some of them indirectly used
Unable to test sync call to diskImageExistsWithKey, hoped due to problems with the file manager and the test bundle being different from the main bundle
2015-04-19 10:01:35 +01:00
Pau Ruiz 66ddb23593 Added image for testing cache 2015-04-19 09:24:34 +01:00
Takeru Chuganji f8c7b9014c Specify Expecta Version 2015-02-25 10:50:08 +09:00
Bogdan Poplauschi d9d9ceedf4 Updated the Tests project after updating to CocoaPods 0.34.4 2014-11-02 22:53:32 +02:00
Matt Galloway 66a6873b2c Switch to built in XCTest async 2014-09-15 12:06:11 +01:00
Bogdan Poplauschi c8df858f75 Added test for the UIImage+MultiFormat crash 2014-07-18 16:56:32 +03:00
Bogdan Poplauschi e0b3de4357 Added error test 2014-06-20 17:51:40 +03:00
Bogdan Poplauschi c1fae30d63 Added SDWebImage Tests project. It uses CocoaPods (Expecta + XCTestAsync). Added some demo tests 2014-06-20 17:21:01 +03:00