mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 03:48:27 +00:00
Improved display of voice messages in the timeline (#1873)
This commit is contained in:
@@ -100,9 +100,9 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
func testHandlingAudioPlayerActionDidStartLoading() async throws {
|
||||
audioPlayerState.attachAudioPlayer(audioPlayerMock)
|
||||
|
||||
let deferred = deferFulfillment(audioPlayerActions) { action in
|
||||
let deferred = deferFulfillment(audioPlayerState.$playbackState) { action in
|
||||
switch action {
|
||||
case .didStartLoading:
|
||||
case .loading:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
@@ -119,33 +119,29 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
await audioPlayerState.updateState(progress: originalStateProgress)
|
||||
audioPlayerState.attachAudioPlayer(audioPlayerMock)
|
||||
|
||||
let deferred = deferFulfillment(audioPlayerActions) { action in
|
||||
let deferred = deferFulfillment(audioPlayerState.$playbackState) { action in
|
||||
switch action {
|
||||
case .didFinishLoading:
|
||||
case .readyToPlay:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
// The progress should be restored
|
||||
let deferedProgress = deferFulfillment(audioPlayerSeekCalls) { progress in
|
||||
progress == originalStateProgress
|
||||
}
|
||||
|
||||
audioPlayerActionsSubject.send(.didFinishLoading)
|
||||
try await deferred.fulfill()
|
||||
try await deferedProgress.fulfill()
|
||||
|
||||
// The state is expected to be .readyToPlay
|
||||
XCTAssertEqual(audioPlayerState.playbackState, .readyToPlay)
|
||||
}
|
||||
|
||||
func testHandlingAudioPlayerActionDidStartPlaying() async throws {
|
||||
await audioPlayerState.updateState(progress: 0.4)
|
||||
audioPlayerState.attachAudioPlayer(audioPlayerMock)
|
||||
|
||||
let deferred = deferFulfillment(audioPlayerActions) { action in
|
||||
let deferred = deferFulfillment(audioPlayerState.$playbackState) { action in
|
||||
switch action {
|
||||
case .didStartPlaying:
|
||||
case .playing:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
@@ -154,6 +150,7 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
|
||||
audioPlayerActionsSubject.send(.didStartPlaying)
|
||||
try await deferred.fulfill()
|
||||
XCTAssertEqual(audioPlayerMock.seekToReceivedProgress, 0.4)
|
||||
XCTAssertEqual(audioPlayerState.playbackState, .playing)
|
||||
XCTAssert(audioPlayerState.isPublishingProgress)
|
||||
}
|
||||
@@ -162,9 +159,9 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
await audioPlayerState.updateState(progress: 0.4)
|
||||
audioPlayerState.attachAudioPlayer(audioPlayerMock)
|
||||
|
||||
let deferred = deferFulfillment(audioPlayerActions) { action in
|
||||
let deferred = deferFulfillment(audioPlayerState.$playbackState) { action in
|
||||
switch action {
|
||||
case .didPausePlaying:
|
||||
case .stopped:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
@@ -182,9 +179,9 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
await audioPlayerState.updateState(progress: 0.4)
|
||||
audioPlayerState.attachAudioPlayer(audioPlayerMock)
|
||||
|
||||
let deferred = deferFulfillment(audioPlayerActions) { action in
|
||||
let deferred = deferFulfillment(audioPlayerState.$playbackState) { action in
|
||||
switch action {
|
||||
case .didStopPlaying:
|
||||
case .stopped:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
@@ -202,9 +199,9 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
await audioPlayerState.updateState(progress: 0.4)
|
||||
audioPlayerState.attachAudioPlayer(audioPlayerMock)
|
||||
|
||||
let deferred = deferFulfillment(audioPlayerActions) { action in
|
||||
let deferred = deferFulfillment(audioPlayerState.$playbackState) { action in
|
||||
switch action {
|
||||
case .didFinishPlaying:
|
||||
case .stopped:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:65e67cda37af645057b17dda50c358fdd668ada01ced5e35bdd6f98f45d62c6a
|
||||
size 64555
|
||||
oid sha256:94220df542660991357d13105cc681ecb81c054180cf7471e93952a2525d5c0c
|
||||
size 64635
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ccdf089f3797b43730655a249072b89df1ac111f7156f44c28bf4cf26dde0882
|
||||
size 73820
|
||||
oid sha256:9efd5d8236996e5c954df098f3ec8336283a768e458d9a64ebbb7a9a21e6ac8a
|
||||
size 73225
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5db9f1f6ceaa65dfcd1b2720e62572a4cff2f57abbc6773b9b9023589a79eb09
|
||||
size 69605
|
||||
oid sha256:1b8af911824187b1041c7b1124d347514433e5ed95448b869af11e88a78a06cd
|
||||
size 69693
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:82130c80be62ed9d3ba0d54df5fec6803c3bed6ef0dc00d044696938d5c41598
|
||||
size 64238
|
||||
oid sha256:8dfd0301b8fd911e44b1f5f1caf9b74f575eb57e74d39a7765bde7966e5872d0
|
||||
size 63481
|
||||
|
||||
Reference in New Issue
Block a user