-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rename LayoutAnchoringTests to UIViewControllerTests * Move code to UIView.AutoresizingMask and test * Prefix NS
- Loading branch information
1 parent
b59a815
commit d69d19f
Showing
7 changed files
with
124 additions
and
111 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
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,34 @@ | ||
// swiftlint:disable:this file_name | ||
// | ||
// All Contributions by Match Group | ||
// | ||
// Copyright © 2023 Tinder (Match Group, LLC) | ||
// | ||
// Licensed under the Match Group Modified 3-Clause BSD License. | ||
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information. | ||
// | ||
|
||
import UIKit | ||
|
||
extension UIView.AutoresizingMask { | ||
|
||
public static var topLeft: Self { | ||
[.flexibleRightMargin, .flexibleBottomMargin] | ||
} | ||
|
||
public static var topRight: Self { | ||
[.flexibleLeftMargin, .flexibleBottomMargin] | ||
} | ||
|
||
public static var bottomLeft: Self { | ||
[.flexibleTopMargin, .flexibleRightMargin] | ||
} | ||
|
||
public static var bottomRight: Self { | ||
[.flexibleTopMargin, .flexibleLeftMargin] | ||
} | ||
|
||
public static var scaleWithSuperview: Self { | ||
[.flexibleWidth, .flexibleHeight] | ||
} | ||
} |
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,73 @@ | ||
// swiftlint:disable:this file_name | ||
// | ||
// All Contributions by Match Group | ||
// | ||
// Copyright © 2023 Tinder (Match Group, LLC) | ||
// | ||
// Licensed under the Match Group Modified 3-Clause BSD License. | ||
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information. | ||
// | ||
|
||
import Foundation | ||
|
||
@testable import Layout | ||
import Nimble | ||
import XCTest | ||
|
||
final class UIViewAutoresizingTests: XCTestCase { | ||
|
||
func testTopLeftResizingMask() { | ||
|
||
// GIVEN | ||
|
||
let topLeftResizingMask: UIView.AutoresizingMask = .topLeft | ||
|
||
// THEN | ||
|
||
expect(topLeftResizingMask) == [.flexibleRightMargin, .flexibleBottomMargin] | ||
} | ||
|
||
func testTopRightResizingMask() { | ||
|
||
// GIVEN | ||
|
||
let topRightResizingMask: UIView.AutoresizingMask = .topRight | ||
|
||
// THEN | ||
|
||
expect(topRightResizingMask) == [.flexibleLeftMargin, .flexibleBottomMargin] | ||
} | ||
|
||
func testBottomLeftResizingMask() { | ||
|
||
// GIVEN | ||
|
||
let bottomLeftResizingMask: UIView.AutoresizingMask = .bottomLeft | ||
|
||
// THEN | ||
|
||
expect(bottomLeftResizingMask) == [.flexibleTopMargin, .flexibleRightMargin] | ||
} | ||
|
||
func testBottomRightResizingMask() { | ||
|
||
// GIVEN | ||
|
||
let bottomRightResizingMask: UIView.AutoresizingMask = .bottomRight | ||
|
||
// THEN | ||
|
||
expect(bottomRightResizingMask) == [.flexibleTopMargin, .flexibleLeftMargin] | ||
} | ||
|
||
func testScaleWithSuperviewResizingMask() { | ||
|
||
// GIVEN | ||
|
||
let scaleWithSuperviewResizingMask: UIView.AutoresizingMask = .scaleWithSuperview | ||
|
||
// THEN | ||
|
||
expect(scaleWithSuperviewResizingMask) == [.flexibleWidth, .flexibleHeight] | ||
} | ||
} |
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