twonly-app-dependencies/camera_avfoundation/darwin/Tests/QueueUtilsTests.swift
2026-10-07 22:18:23 +02:00

35 lines
897 B
Swift

// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import XCTest
@testable import camera_avfoundation
final class QueueUtilsTests: XCTestCase {
func testShouldStayOnMainQueueIfCalledFromMainQueue() {
let expectation = expectation(description: "Block must be run on the main queue")
ensureToRunOnMainQueue {
if Thread.isMainThread {
expectation.fulfill()
}
}
waitForExpectations(timeout: 30)
}
func testShouldDispatchToMainQueueIfCalledFromBackgroundQueue() {
let expectation = expectation(description: "Block must be run on the main queue")
DispatchQueue.global(qos: .default).async {
ensureToRunOnMainQueue {
if Thread.isMainThread {
expectation.fulfill()
}
}
}
waitForExpectations(timeout: 30)
}
}