Skip to content

Commit

Permalink
Add watchOS and tvOS platforms support (#15)
Browse files Browse the repository at this point in the history
* added support for watchOS and tvOS platforms

* added compile directive to snapshot tests due to SnapshotTesting lib limitations

* lint
  • Loading branch information
KazaiMazai authored Jun 16, 2024
1 parent 23bcb2d commit 2eba818
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ let package = Package(
name: "SegmentedPicker",
platforms: [
.iOS(.v13),
.macOS(.v10_15)
.macOS(.v10_15),
.watchOS(.v6),
.tvOS(.v13)
],
products: [
.library(
Expand Down
3 changes: 3 additions & 0 deletions Tests/SegmentedPickerTests/CapsuleSelectionViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import XCTest
import SnapshotTesting
@testable import SegmentedPicker

#if os(iOS) || os(tvOS)
final class CapsuleSelectionViewTests: XCTestCase {

func test_WhenSelectionIsNotProvided_SelectionIsNotVisible_Snapshot() {
let view = CapsuleSelectionView(titles: ["One", "Two", "Three"])
assertSnapshots(of: view, as: [.image(layout: .device(config: .iPhone13))])
Expand All @@ -22,3 +24,4 @@ final class CapsuleSelectionViewTests: XCTestCase {
assertSnapshots(of: view, as: [.image(layout: .device(config: .iPhone13))])
}
}
#endif
8 changes: 7 additions & 1 deletion Tests/SegmentedPickerTests/UnderlineSelectionViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
//
// Created by Sergey Kazakov on 15/06/2024.
//

import SwiftUI
import UIKit
import XCTest
import SnapshotTesting
@testable import SegmentedPicker

extension CGSize {
static let testView: CGSize = CGSize(width: 390, height: 844)
}

#if os(iOS) || os(tvOS)
final class UnderlineSelectionViewTest: XCTestCase {

func test_WhenSelectionIsNotProvided_SelectionIsNotVisible_Snapshot() {
let view = UnderlineSelectionView(titles: ["One", "Two", "Three"])
assertSnapshots(of: view, as: [.image(layout: .device(config: .iPhone13))])
Expand All @@ -22,3 +27,4 @@ final class UnderlineSelectionViewTest: XCTestCase {
assertSnapshots(of: view, as: [.image(layout: .device(config: .iPhone13))])
}
}
#endif

0 comments on commit 2eba818

Please sign in to comment.