Skip to content

Commit

Permalink
Disable animations in test cases that weren’t previously disabling an…
Browse files Browse the repository at this point in the history
…imations
  • Loading branch information
Clstroud committed May 7, 2024
1 parent 74b2a30 commit 40c30f6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Vocable/Common/CarouselGridCollectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ class CarouselGridCollectionView: UICollectionView {
if let offset = layout.scrollOffsetForPageWithOffsetFromCurrentPage(offset: 1) {
let shouldAnimate = UIView.areAnimationsEnabled
scrollRectToVisible(CGRect(origin: offset, size: bounds.size), animated: shouldAnimate)
if (!shouldAnimate) {
layout.updatePagingProgress()
}
}
}

Expand All @@ -122,6 +125,9 @@ class CarouselGridCollectionView: UICollectionView {
if let offset = layout.scrollOffsetForPageWithOffsetFromCurrentPage(offset: -1) {
let shouldAnimate = UIView.areAnimationsEnabled
scrollRectToVisible(CGRect(origin: offset, size: bounds.size), animated: shouldAnimate)
if (!shouldAnimate) {
layout.updatePagingProgress()
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Vocable/Common/CarouselGridLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ final class CarouselGridLayout: UICollectionViewLayout {
return targetScrollOffsetForItem(at: indexPath)
}

private func updatePagingProgress() {
func updatePagingProgress() {
guard pagesPerSection > 0 else {
progress = .zero
return
Expand Down
2 changes: 1 addition & 1 deletion VocableUITests/Tests/PaginationBaseTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PaginationBaseTest: XCTestCase {
override func setUp() {
let app = XCUIApplication()
app.configure {
Arguments(.resetAppDataOnLaunch, .enableListeningMode)
Arguments(.resetAppDataOnLaunch, .enableListeningMode, .disableAnimations)
Environment(.overridePresets) {
Presets {
eightPhrasesCategory
Expand Down
2 changes: 1 addition & 1 deletion VocableUITests/Tests/PresetsOverrideTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PresetsOverrideTestCase: XCTestCase {

let app = XCUIApplication()
app.configure {
Arguments(.resetAppDataOnLaunch, .enableListeningMode)
Arguments(.resetAppDataOnLaunch, .enableListeningMode, .disableAnimations)
Environment(.overridePresets) {
Presets {
Category("Custom Basic Needs") {
Expand Down

0 comments on commit 40c30f6

Please sign in to comment.