Skip to content

Commit

Permalink
Upgrading a bunch of class names to remove LYT (#35)
Browse files Browse the repository at this point in the history
Trying to fix LayoutTestBase module header and pod spec to get it to work
  • Loading branch information
plivesey committed Oct 11, 2016
1 parent 89174c3 commit 3d9efb7
Show file tree
Hide file tree
Showing 28 changed files with 132 additions and 94 deletions.
4 changes: 2 additions & 2 deletions LayoutTest.podspec
@@ -1,14 +1,14 @@
Pod::Spec.new do |spec|
spec.name = 'LayoutTest'
spec.version = '2.0.0'
spec.version = '3.0.0'
spec.license = { :type => 'Apache License, Version 2.0' }
spec.homepage = 'https://linkedin.github.io/LayoutTest-iOS'
spec.authors = 'LinkedIn'
spec.summary = 'LayoutTest enables you to write unit tests which test the layout of a view in multiple configurations.'
spec.source = { :git => 'https://github.com/linkedin/LayoutTest-iOS.git', :tag => spec.version }
spec.platform = :ios, '7.0'
spec.default_subspecs = 'TestCase'
spec.dependency 'LayoutTestBase', '2.0.0'
spec.dependency 'LayoutTestBase', '3.0.0'

spec.subspec 'Swift' do |sp|
sp.dependency 'LayoutTestBase/Core'
Expand Down
2 changes: 1 addition & 1 deletion LayoutTest/LayoutTest.h
Expand Up @@ -8,7 +8,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

/**
This file is included in cocoapods because without it, XCode refuses to build the project. It shouldn't cause any harm.
This file is included in cocoapods because without it, Xcode refuses to build the project. It shouldn't cause any harm.
*/

#import <Foundation/Foundation.h>
Expand Down
4 changes: 2 additions & 2 deletions LayoutTest/Swift/LayoutTestCase.swift
Expand Up @@ -47,7 +47,7 @@ open class LayoutTestCase: LYTLayoutTestCase {
- Parameter validation: (view, data, context) Closure to validate the view given the data. The data here will not contain any LYTDataValues subclasses.
Here you should assert on the properties of the view. If you set a context in your viewForData: method, it will be passed back here.
*/
open func runLayoutTests<TestableView: LYTViewProvider>(limitResults: LYTTesterLimitResults = LYTTesterLimitResults(),
open func runLayoutTests<TestableView: ViewProvider>(limitResults: LYTTesterLimitResults = LYTTesterLimitResults(),
validation: (TestableView, [AnyHashable: Any], Any?) -> Void) where TestableView: UIView {
self.runLayoutTests(withViewProvider: TestableView.self, limitResults: limitResults) { (view, data, context) in
if let view = view as? TestableView {
Expand Down Expand Up @@ -86,7 +86,7 @@ open class LayoutTestCase: LYTLayoutTestCase {
- Parameter validation: (view, data, context) Block to validate the view given the data. The data here will not contain any LYTDataValues subclasses.
Here you should assert on the properties of the view. If you set a context in your viewForData: method, it will be passed back here.
*/
open func runLayoutTests<TestableView: UIView, ViewProvider: LYTViewProvider>(withViewProvider viewProvider: ViewProvider.Type,
open func runLayoutTests<TestableView: UIView, ViewProviderType: ViewProvider>(withViewProvider viewProvider: ViewProviderType.Type,
limitResults: LYTTesterLimitResults = LYTTesterLimitResults(),
validation: (TestableView, [AnyHashable: Any], Any?) -> Void) {
self.runLayoutTests(withViewProvider: viewProvider, limitResults: limitResults) { (view: Any, data, context) in
Expand Down
1 change: 1 addition & 0 deletions LayoutTest/TestCase/LYTLayoutFailingTestSnapshotRecorder.h
Expand Up @@ -11,6 +11,7 @@
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>

NS_SWIFT_NAME(LayoutFailingTestSnapshotRecorder)
@interface LYTLayoutFailingTestSnapshotRecorder : NSObject<XCTestObservation>

/**
Expand Down
12 changes: 4 additions & 8 deletions LayoutTestBase.podspec
@@ -1,28 +1,24 @@
Pod::Spec.new do |spec|
spec.name = 'LayoutTestBase'
spec.version = '2.0.0'
spec.version = '3.0.0'
spec.license = { :type => 'Apache License, Version 2.0' }
spec.homepage = 'https://linkedin.github.io/LayoutTest-iOS'
spec.authors = 'LinkedIn'
spec.summary = 'Base library for LayoutTest without XCTest dependency. LayoutTest enables you to write unit tests which test the layout of views.'
spec.source = { :git => 'https://github.com/linkedin/LayoutTest-iOS.git', :tag => '2.0.0' }
spec.source = { :git => 'https://github.com/linkedin/LayoutTest-iOS.git', :tag => spec.version }
spec.platform = :ios, '7.0'
spec.frameworks = 'Foundation', 'UIKit'
spec.default_subspecs = 'Core', 'Autolayout', 'Catalog', 'Config', 'UIViewHelpers'

spec.subspec 'Swift' do |sp|
sp.source_files = 'LayoutTestBase/Swift/**/*'
sp.dependency 'LayoutTestBase/Core'
sp.dependency 'LayoutTestBase/Autolayout'
sp.dependency 'LayoutTestBase/Catalog'
sp.dependency 'LayoutTestBase/Config'
sp.dependency 'LayoutTestBase/UIViewHelpers'
sp.dependency 'LayoutTestBase/SwiftSubspec'
end

spec.subspec 'SwiftSubspec' do |sp|
sp.source_files = 'LayoutTestBase/Swift/**/*'
sp.dependency 'LayoutTestBase/Core'
sp.dependency 'LayoutTestBase/ModuleHeader'
sp.platform = :ios, '8.0'
end

spec.subspec 'Core' do |sp|
Expand Down
Expand Up @@ -21,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
If Apple updates their implementation, this class will need to be changed.
*/
NS_SWIFT_NAME(AutolayoutFailureIntercepter)
@interface LYTAutolayoutFailureIntercepter : NSObject

/**
Expand Down
Expand Up @@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN

@protocol LYTViewCatalogProvider;

NS_SWIFT_NAME(CatalogCollectionViewController)
@interface LYTCatalogCollectionViewController : UICollectionViewController

@property (nonatomic, nullable) Class <LYTViewCatalogProvider> ViewProviderClass;
Expand Down
1 change: 1 addition & 0 deletions LayoutTestBase/Catalog/LYTCatalogTableViewController.h
Expand Up @@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN

@protocol LYTViewCatalogProvider;

NS_SWIFT_NAME(CatalogTableViewController)
@interface LYTCatalogTableViewController : UITableViewController

@property (nonatomic, nullable) Class <LYTViewCatalogProvider> ViewProviderClass;
Expand Down
1 change: 1 addition & 0 deletions LayoutTestBase/Catalog/LYTViewCatalogProvider.h
Expand Up @@ -13,6 +13,7 @@

NS_ASSUME_NONNULL_BEGIN

NS_SWIFT_NAME(ViewCatalogProvider)
@protocol LYTViewCatalogProvider <LYTViewProvider>

/**
Expand Down
1 change: 1 addition & 0 deletions LayoutTestBase/Config/LYTConfig.h
Expand Up @@ -12,6 +12,7 @@

NS_ASSUME_NONNULL_BEGIN

NS_SWIFT_NAME(Config)
@interface LYTConfig : NSObject

/**
Expand Down
1 change: 1 addition & 0 deletions LayoutTestBase/Core/Generators/LYTBoolValues.h
Expand Up @@ -12,6 +12,7 @@

NS_ASSUME_NONNULL_BEGIN

NS_SWIFT_NAME(BoolValues)
@interface LYTBoolValues : LYTDataValues

@end
Expand Down
1 change: 1 addition & 0 deletions LayoutTestBase/Core/Generators/LYTDataValues.h
Expand Up @@ -28,6 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
If you put NSNull into the values array, it will be converted to nil (as in, remove the key from the final JSON).
*/
NS_SWIFT_NAME(DataValues)
@interface LYTDataValues : NSObject

/**
Expand Down
1 change: 1 addition & 0 deletions LayoutTestBase/Core/Generators/LYTFloatValues.h
Expand Up @@ -12,6 +12,7 @@

NS_ASSUME_NONNULL_BEGIN

NS_SWIFT_NAME(FloatValues)
@interface LYTFloatValues : LYTDataValues

@end
Expand Down
1 change: 1 addition & 0 deletions LayoutTestBase/Core/Generators/LYTIntegerValues.h
Expand Up @@ -12,6 +12,7 @@

NS_ASSUME_NONNULL_BEGIN

NS_SWIFT_NAME(IntegerValues)
@interface LYTIntegerValues : LYTDataValues

@end
Expand Down
1 change: 1 addition & 0 deletions LayoutTestBase/Core/Generators/LYTStringValues.h
Expand Up @@ -12,6 +12,7 @@

NS_ASSUME_NONNULL_BEGIN

NS_SWIFT_NAME(StringValues)
@interface LYTStringValues : LYTDataValues

@end
Expand Down
1 change: 1 addition & 0 deletions LayoutTestBase/Core/Generators/Private/LYTValuesIterator.h
Expand Up @@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN

@class LYTDataValues;

NS_SWIFT_NAME(ValuesIterator)
@interface LYTValuesIterator : NSObject

@property (nonatomic, strong, nullable) LYTDataValues *dataValues;
Expand Down
1 change: 1 addition & 0 deletions LayoutTestBase/Core/LYTViewProvider.h
Expand Up @@ -14,6 +14,7 @@

NS_ASSUME_NONNULL_BEGIN

NS_SWIFT_NAME(ViewProvider)
@protocol LYTViewProvider <NSObject>

#pragma mark - Main Methods
Expand Down
2 changes: 2 additions & 0 deletions LayoutTestBase/Core/Testers/LYTLayoutPropertyTester.h
Expand Up @@ -20,12 +20,14 @@ NS_ASSUME_NONNULL_BEGIN
set of options instead of exponential. Every value in the data set will be run at least once, but not all possible combinations will be run.
LYTTesterLimitResultsNoSizes - This will ignore any view sizes that are set in the LYTViewProvider or the LYTConfig.
*/
NS_SWIFT_NAME(TesterLimitResults)
typedef NS_OPTIONS(NSInteger, LYTTesterLimitResults) {
LYTTesterLimitResultsNone = 0,
LYTTesterLimitResultsLimitDataCombinations = 1 << 0,
LYTTesterLimitResultsNoSizes = 1 << 1
};

NS_SWIFT_NAME(LayoutPropertyTester)
@interface LYTLayoutPropertyTester : NSObject

/**
Expand Down
1 change: 1 addition & 0 deletions LayoutTestBase/Core/ViewSizing/LYTViewSize.h
Expand Up @@ -27,6 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
You can utitilize predefined constants or enter a custom value.
*/
NS_SWIFT_NAME(ViewSize)
@interface LYTViewSize : NSObject

/**
Expand Down
35 changes: 32 additions & 3 deletions LayoutTestBase/LayoutTestBase.h
Expand Up @@ -8,8 +8,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

/**
This file is included in cocoapods because without it, XCode refuses to build the project. It shouldn't cause any harm.
Because of this, it only include thes core classes (otherwise, some subspecs won't build).
This file is included in cocoapods because without it, Xcode refuses to build the project. It shouldn't cause any harm.
*/

#import <Foundation/Foundation.h>
Expand All @@ -21,8 +20,38 @@ FOUNDATION_EXPORT double LayoutTestBaseVersionNumber;
//! Project version string for LayoutTest.
FOUNDATION_EXPORT const unsigned char LayoutTestBaseVersionString[];

#pragma mark - Main Classes
#pragma mark Main Classes

#import "LYTViewProvider.h"
#import "LYTViewCatalogProvider.h"
#import "LYTConfig.h"
#import "LYTLayoutPropertyTester.h"

#pragma mark View Sizing

#import "LYTViewSize.h"
#import "UIView+LYTViewSize.h"
#import "LYTDeviceConstants.h"

#pragma mark Auto Layout

#import "LYTAutolayoutFailureIntercepter.h"

#pragma mark Data Values

#import "LYTDataValues.h"
#import "LYTBoolValues.h"
#import "LYTFloatValues.h"
#import "LYTIntegerValues.h"
#import "LYTStringValues.h"

#pragma mark Test Helpers

#import "UIView+LYTHelpers.h"
#import "UIView+LYTTestHelpers.h"
#import "UIView+LYTFrameComparison.h"

#pragma mark Catalog

#import "LYTCatalogCollectionViewController.h"
#import "LYTCatalogTableViewController.h"
2 changes: 1 addition & 1 deletion LayoutTestBase/Swift/LYTDataValues+Swift.swift
Expand Up @@ -8,7 +8,7 @@

import Foundation

extension LYTDataValues {
extension DataValues {
/**
Returns LYTDataValues with these specific values and overrides any subclass's behavior.
This function converts all nil values to NSNull which is what the library expects.
Expand Down
2 changes: 1 addition & 1 deletion LayoutTestBase/Swift/LYTViewSize+Swift.swift
Expand Up @@ -8,7 +8,7 @@

import Foundation

extension LYTViewSize {
extension ViewSize {

/**
The width for the view. If nil, do not edit the width.
Expand Down
Expand Up @@ -22,7 +22,7 @@ class SwiftLYTLayoutFailingTestSnapshotRecorderTests: XCTestCase {
} catch{}
fileManager.createFile(atPath: testFilePath, contents: nil, attributes: nil)

let recorder = LYTLayoutFailingTestSnapshotRecorder()
let recorder = LayoutFailingTestSnapshotRecorder()
recorder.startNewLog(for: type(of: self))

XCTAssertFalse(fileManager.fileExists(atPath: testFilePath))
Expand Down

0 comments on commit 3d9efb7

Please sign in to comment.