From 40c30f67b2ecd242107214a598343145b40c8f9d Mon Sep 17 00:00:00 2001 From: Chris Stroud Date: Tue, 7 May 2024 14:19:46 -0400 Subject: [PATCH] =?UTF-8?q?Disable=20animations=20in=20test=20cases=20that?= =?UTF-8?q?=20weren=E2=80=99t=20previously=20disabling=20animations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Vocable/Common/CarouselGridCollectionViewController.swift | 6 ++++++ Vocable/Common/CarouselGridLayout.swift | 2 +- VocableUITests/Tests/PaginationBaseTest.swift | 2 +- VocableUITests/Tests/PresetsOverrideTestCase.swift | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Vocable/Common/CarouselGridCollectionViewController.swift b/Vocable/Common/CarouselGridCollectionViewController.swift index 9a9f3e38d..f59bfd284 100644 --- a/Vocable/Common/CarouselGridCollectionViewController.swift +++ b/Vocable/Common/CarouselGridCollectionViewController.swift @@ -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() + } } } @@ -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() + } } } diff --git a/Vocable/Common/CarouselGridLayout.swift b/Vocable/Common/CarouselGridLayout.swift index e7ae4259b..918c59ef6 100644 --- a/Vocable/Common/CarouselGridLayout.swift +++ b/Vocable/Common/CarouselGridLayout.swift @@ -406,7 +406,7 @@ final class CarouselGridLayout: UICollectionViewLayout { return targetScrollOffsetForItem(at: indexPath) } - private func updatePagingProgress() { + func updatePagingProgress() { guard pagesPerSection > 0 else { progress = .zero return diff --git a/VocableUITests/Tests/PaginationBaseTest.swift b/VocableUITests/Tests/PaginationBaseTest.swift index 9bb6f8232..7a393589e 100644 --- a/VocableUITests/Tests/PaginationBaseTest.swift +++ b/VocableUITests/Tests/PaginationBaseTest.swift @@ -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 diff --git a/VocableUITests/Tests/PresetsOverrideTestCase.swift b/VocableUITests/Tests/PresetsOverrideTestCase.swift index 2c17eedc0..a174608c7 100644 --- a/VocableUITests/Tests/PresetsOverrideTestCase.swift +++ b/VocableUITests/Tests/PresetsOverrideTestCase.swift @@ -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") {