#![allow(unused_imports)]
#![allow(deprecated)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(missing_docs)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::type_complexity)]
#![allow(clippy::upper_case_acronyms)]
#![allow(clippy::identity_op)]
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::doc_lazy_continuation)]
#![allow(rustdoc::broken_intra_doc_links)]
#![allow(rustdoc::bare_urls)]
#![allow(rustdoc::invalid_html_tags)]
#[link(name = "XCTest", kind = "framework")]
extern "C" {}
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-xc-ui-automation")]
use objc2_xc_ui_automation::*;
use crate::*;
extern "C" {
pub static XCTestErrorDomain: &'static NSErrorDomain;
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct XCTestErrorCode(pub NSInteger);
impl XCTestErrorCode {
#[doc(alias = "XCTestErrorCodeTimeoutWhileWaiting")]
pub const TimeoutWhileWaiting: Self = Self(0);
#[doc(alias = "XCTestErrorCodeFailureWhileWaiting")]
pub const FailureWhileWaiting: Self = Self(1);
}
unsafe impl Encode for XCTestErrorCode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for XCTestErrorCode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTest;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTest {}
);
impl XCTest {
extern_methods!(
#[unsafe(method(testCaseCount))]
#[unsafe(method_family = none)]
pub fn testCaseCount(&self) -> NSUInteger;
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub fn name(&self) -> Retained<NSString>;
#[unsafe(method(testRunClass))]
#[unsafe(method_family = none)]
pub fn testRunClass(&self) -> Option<&'static AnyClass>;
#[unsafe(method(testRun))]
#[unsafe(method_family = none)]
pub fn testRun(&self) -> Option<Retained<XCTestRun>>;
#[unsafe(method(performTest:))]
#[unsafe(method_family = none)]
pub fn performTest(&self, run: &XCTestRun);
#[unsafe(method(runTest))]
#[unsafe(method_family = none)]
pub fn runTest(&self);
#[cfg(feature = "block2")]
#[unsafe(method(setUpWithCompletionHandler:))]
#[unsafe(method_family = none)]
pub fn setUpWithCompletionHandler(
&self,
completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
#[unsafe(method(setUpWithError:_))]
#[unsafe(method_family = none)]
pub fn setUpWithError(&self) -> Result<(), Retained<NSError>>;
#[unsafe(method(setUp))]
#[unsafe(method_family = none)]
pub fn setUp(&self);
#[unsafe(method(tearDown))]
#[unsafe(method_family = none)]
pub fn tearDown(&self);
#[unsafe(method(tearDownWithError:_))]
#[unsafe(method_family = none)]
pub fn tearDownWithError(&self) -> Result<(), Retained<NSError>>;
#[cfg(feature = "block2")]
#[unsafe(method(tearDownWithCompletionHandler:))]
#[unsafe(method_family = none)]
pub fn tearDownWithCompletionHandler(
&self,
completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
);
}
impl XCTest {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTest {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSException, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct _XCTestCaseInterruptionException;
);
extern_conformance!(
unsafe impl NSCoding for _XCTestCaseInterruptionException {}
);
extern_conformance!(
unsafe impl NSCopying for _XCTestCaseInterruptionException {}
);
unsafe impl CopyingHelper for _XCTestCaseInterruptionException {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for _XCTestCaseInterruptionException {}
);
extern_conformance!(
unsafe impl NSSecureCoding for _XCTestCaseInterruptionException {}
);
impl _XCTestCaseInterruptionException {
extern_methods!();
}
impl _XCTestCaseInterruptionException {
extern_methods!(
#[unsafe(method(initWithName:reason:userInfo:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithName_reason_userInfo(
this: Allocated<Self>,
a_name: &NSExceptionName,
a_reason: Option<&NSString>,
a_user_info: Option<&NSDictionary>,
) -> Retained<Self>;
);
}
impl _XCTestCaseInterruptionException {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for _XCTestCaseInterruptionException {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
#[inline]
pub(crate) extern "C-unwind" fn _XCTPreformattedFailureHandler(
test: Option<&XCTestCase>,
expected: bool,
file_path: &NSString,
line_number: NSUInteger,
condition: &NSString,
message: &NSString,
) {
extern "C-unwind" {
fn _XCTPreformattedFailureHandler(
test: Option<&XCTestCase>,
expected: Bool,
file_path: &NSString,
line_number: NSUInteger,
condition: &NSString,
message: &NSString,
);
}
unsafe {
_XCTPreformattedFailureHandler(
test,
Bool::new(expected),
file_path,
line_number,
condition,
message,
)
}
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct _XCTAssertionType(pub NSUInteger);
impl _XCTAssertionType {
#[doc(alias = "_XCTAssertion_Fail")]
pub const Fail: Self = Self(0);
#[doc(alias = "_XCTAssertion_Nil")]
pub const Nil: Self = Self(1);
#[doc(alias = "_XCTAssertion_NotNil")]
pub const NotNil: Self = Self(2);
#[doc(alias = "_XCTAssertion_EqualObjects")]
pub const EqualObjects: Self = Self(3);
#[doc(alias = "_XCTAssertion_NotEqualObjects")]
pub const NotEqualObjects: Self = Self(4);
#[doc(alias = "_XCTAssertion_Equal")]
pub const Equal: Self = Self(5);
#[doc(alias = "_XCTAssertion_NotEqual")]
pub const NotEqual: Self = Self(6);
#[doc(alias = "_XCTAssertion_EqualWithAccuracy")]
pub const EqualWithAccuracy: Self = Self(7);
#[doc(alias = "_XCTAssertion_NotEqualWithAccuracy")]
pub const NotEqualWithAccuracy: Self = Self(8);
#[doc(alias = "_XCTAssertion_GreaterThan")]
pub const GreaterThan: Self = Self(9);
#[doc(alias = "_XCTAssertion_GreaterThanOrEqual")]
pub const GreaterThanOrEqual: Self = Self(10);
#[doc(alias = "_XCTAssertion_LessThan")]
pub const LessThan: Self = Self(11);
#[doc(alias = "_XCTAssertion_LessThanOrEqual")]
pub const LessThanOrEqual: Self = Self(12);
#[doc(alias = "_XCTAssertion_True")]
pub const True: Self = Self(13);
#[doc(alias = "_XCTAssertion_False")]
pub const False: Self = Self(14);
#[doc(alias = "_XCTAssertion_Throws")]
pub const Throws: Self = Self(15);
#[doc(alias = "_XCTAssertion_ThrowsSpecific")]
pub const ThrowsSpecific: Self = Self(16);
#[doc(alias = "_XCTAssertion_ThrowsSpecificNamed")]
pub const ThrowsSpecificNamed: Self = Self(17);
#[doc(alias = "_XCTAssertion_NoThrow")]
pub const NoThrow: Self = Self(18);
#[doc(alias = "_XCTAssertion_NoThrowSpecific")]
pub const NoThrowSpecific: Self = Self(19);
#[doc(alias = "_XCTAssertion_NoThrowSpecificNamed")]
pub const NoThrowSpecificNamed: Self = Self(20);
#[doc(alias = "_XCTAssertion_Unwrap")]
pub const Unwrap: Self = Self(21);
#[doc(alias = "_XCTAssertion_Identical")]
pub const Identical: Self = Self(22);
#[doc(alias = "_XCTAssertion_NotIdentical")]
pub const NotIdentical: Self = Self(23);
}
unsafe impl Encode for _XCTAssertionType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for _XCTAssertionType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[inline]
pub(crate) extern "C-unwind" fn _XCTFailureFormat(
assertion_type: _XCTAssertionType,
format_index: NSUInteger,
) -> Retained<NSString> {
extern "C-unwind" {
fn _XCTFailureFormat(
assertion_type: _XCTAssertionType,
format_index: NSUInteger,
) -> *mut NSString;
}
let ret = unsafe { _XCTFailureFormat(assertion_type, format_index) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[inline]
pub(crate) extern "C-unwind" fn _XCTDescriptionForValue(value: &NSValue) -> Retained<NSString> {
extern "C-unwind" {
fn _XCTDescriptionForValue(value: &NSValue) -> *mut NSString;
}
let ret = unsafe { _XCTDescriptionForValue(value) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[inline]
pub(crate) extern "C-unwind" fn _XCTGetCurrentExceptionReasonWithFallback(
fallback: Option<&NSString>,
) -> Retained<NSString> {
extern "C-unwind" {
fn _XCTGetCurrentExceptionReasonWithFallback(fallback: Option<&NSString>) -> *mut NSString;
}
let ret = unsafe { _XCTGetCurrentExceptionReasonWithFallback(fallback) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
extern_protocol!(
pub unsafe trait XCTActivity: NSObjectProtocol {
#[unsafe(method(name))]
#[unsafe(method_family = none)]
fn name(&self) -> Retained<NSString>;
#[unsafe(method(addAttachment:))]
#[unsafe(method_family = none)]
fn addAttachment(&self, attachment: &XCTAttachment);
}
);
extern_class!(
#[unsafe(super(XCTest, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTestCase;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTestCase {}
);
impl XCTestCase {
extern_methods!(
#[unsafe(method(testCaseWithInvocation:))]
#[unsafe(method_family = none)]
pub unsafe fn testCaseWithInvocation(invocation: Option<&NSInvocation>) -> Retained<Self>;
#[unsafe(method(initWithInvocation:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithInvocation(
this: Allocated<Self>,
invocation: Option<&NSInvocation>,
) -> Retained<Self>;
#[unsafe(method(testCaseWithSelector:))]
#[unsafe(method_family = none)]
pub unsafe fn testCaseWithSelector(selector: Sel) -> Option<Retained<Self>>;
#[unsafe(method(initWithSelector:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithSelector(this: Allocated<Self>, selector: Sel) -> Retained<Self>;
#[unsafe(method(invocation))]
#[unsafe(method_family = none)]
pub unsafe fn invocation(&self) -> Option<Retained<NSInvocation>>;
#[unsafe(method(setInvocation:))]
#[unsafe(method_family = none)]
pub unsafe fn setInvocation(&self, invocation: Option<&NSInvocation>);
#[unsafe(method(invokeTest))]
#[unsafe(method_family = none)]
pub fn invokeTest(&self);
#[unsafe(method(continueAfterFailure))]
#[unsafe(method_family = none)]
pub fn continueAfterFailure(&self) -> bool;
#[unsafe(method(setContinueAfterFailure:))]
#[unsafe(method_family = none)]
pub fn setContinueAfterFailure(&self, continue_after_failure: bool);
#[unsafe(method(recordIssue:))]
#[unsafe(method_family = none)]
pub fn recordIssue(&self, issue: &XCTIssue);
#[unsafe(method(testInvocations))]
#[unsafe(method_family = none)]
pub fn testInvocations() -> Retained<NSArray<NSInvocation>>;
#[cfg(feature = "block2")]
#[unsafe(method(addTeardownBlock:))]
#[unsafe(method_family = none)]
pub fn addTeardownBlock(&self, block: &block2::DynBlock<dyn Fn()>);
#[cfg(feature = "block2")]
#[unsafe(method(addAsyncTeardownBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn addAsyncTeardownBlock(
&self,
block: &block2::DynBlock<dyn Fn(NonNull<block2::DynBlock<dyn Fn(*mut NSError)>>)>,
);
#[unsafe(method(executionTimeAllowance))]
#[unsafe(method_family = none)]
pub fn executionTimeAllowance(&self) -> NSTimeInterval;
#[unsafe(method(setExecutionTimeAllowance:))]
#[unsafe(method_family = none)]
pub fn setExecutionTimeAllowance(&self, execution_time_allowance: NSTimeInterval);
);
}
impl XCTestCase {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTestCase {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
impl XCTestCase {
extern_methods!(
#[unsafe(method(defaultTestSuite))]
#[unsafe(method_family = none)]
pub fn defaultTestSuite() -> Retained<XCTestSuite>;
#[unsafe(method(setUp))]
#[unsafe(method_family = none)]
pub fn setUp();
#[unsafe(method(tearDown))]
#[unsafe(method_family = none)]
pub fn tearDown();
);
}
impl XCTestCase {
extern_methods!();
}
extern_conformance!(
unsafe impl XCTActivity for XCTestCase {}
);
pub type XCTPerformanceMetric = NSString;
extern "C" {
pub static XCTPerformanceMetric_WallClockTime: &'static XCTPerformanceMetric;
}
impl XCTestCase {
extern_methods!(
#[unsafe(method(defaultPerformanceMetrics))]
#[unsafe(method_family = none)]
pub fn defaultPerformanceMetrics() -> Retained<NSArray<XCTPerformanceMetric>>;
#[cfg(feature = "block2")]
#[unsafe(method(measureBlock:))]
#[unsafe(method_family = none)]
pub fn measureBlock(&self, block: &block2::DynBlock<dyn Fn() + '_>);
#[cfg(feature = "block2")]
#[unsafe(method(measureMetrics:automaticallyStartMeasuring:forBlock:))]
#[unsafe(method_family = none)]
pub fn measureMetrics_automaticallyStartMeasuring_forBlock(
&self,
metrics: &NSArray<XCTPerformanceMetric>,
automatically_start_measuring: bool,
block: &block2::DynBlock<dyn Fn() + '_>,
);
#[unsafe(method(startMeasuring))]
#[unsafe(method_family = none)]
pub fn startMeasuring(&self);
#[unsafe(method(stopMeasuring))]
#[unsafe(method_family = none)]
pub fn stopMeasuring(&self);
#[unsafe(method(defaultMetrics))]
#[unsafe(method_family = none)]
pub fn defaultMetrics() -> Retained<NSArray<ProtocolObject<dyn XCTMetric>>>;
#[unsafe(method(defaultMeasureOptions))]
#[unsafe(method_family = none)]
pub fn defaultMeasureOptions() -> Retained<XCTMeasureOptions>;
#[cfg(feature = "block2")]
#[unsafe(method(measureWithMetrics:block:))]
#[unsafe(method_family = none)]
pub fn measureWithMetrics_block(
&self,
metrics: &NSArray<ProtocolObject<dyn XCTMetric>>,
block: &block2::DynBlock<dyn Fn() + '_>,
);
#[cfg(feature = "block2")]
#[unsafe(method(measureWithOptions:block:))]
#[unsafe(method_family = none)]
pub fn measureWithOptions_block(
&self,
options: &XCTMeasureOptions,
block: &block2::DynBlock<dyn Fn() + '_>,
);
#[cfg(feature = "block2")]
#[unsafe(method(measureWithMetrics:options:block:))]
#[unsafe(method_family = none)]
pub fn measureWithMetrics_options_block(
&self,
metrics: &NSArray<ProtocolObject<dyn XCTMetric>>,
options: &XCTMeasureOptions,
block: &block2::DynBlock<dyn Fn() + '_>,
);
);
}
impl XCTestCase {
extern_methods!(
#[deprecated]
#[unsafe(method(recordFailureWithDescription:inFile:atLine:expected:))]
#[unsafe(method_family = none)]
pub fn recordFailureWithDescription_inFile_atLine_expected(
&self,
description: &NSString,
file_path: &NSString,
line_number: NSUInteger,
expected: bool,
);
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTestRun;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTestRun {}
);
impl XCTestRun {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(testRunWithTest:))]
#[unsafe(method_family = none)]
pub fn testRunWithTest(test: &XCTest) -> Retained<Self>;
#[unsafe(method(initWithTest:))]
#[unsafe(method_family = init)]
pub fn initWithTest(this: Allocated<Self>, test: &XCTest) -> Retained<Self>;
#[unsafe(method(test))]
#[unsafe(method_family = none)]
pub fn test(&self) -> Retained<XCTest>;
#[unsafe(method(start))]
#[unsafe(method_family = none)]
pub fn start(&self);
#[unsafe(method(stop))]
#[unsafe(method_family = none)]
pub fn stop(&self);
#[unsafe(method(startDate))]
#[unsafe(method_family = none)]
pub fn startDate(&self) -> Option<Retained<NSDate>>;
#[unsafe(method(stopDate))]
#[unsafe(method_family = none)]
pub fn stopDate(&self) -> Option<Retained<NSDate>>;
#[unsafe(method(totalDuration))]
#[unsafe(method_family = none)]
pub fn totalDuration(&self) -> NSTimeInterval;
#[unsafe(method(testDuration))]
#[unsafe(method_family = none)]
pub fn testDuration(&self) -> NSTimeInterval;
#[unsafe(method(testCaseCount))]
#[unsafe(method_family = none)]
pub fn testCaseCount(&self) -> NSUInteger;
#[unsafe(method(executionCount))]
#[unsafe(method_family = none)]
pub fn executionCount(&self) -> NSUInteger;
#[unsafe(method(skipCount))]
#[unsafe(method_family = none)]
pub fn skipCount(&self) -> NSUInteger;
#[unsafe(method(failureCount))]
#[unsafe(method_family = none)]
pub fn failureCount(&self) -> NSUInteger;
#[unsafe(method(unexpectedExceptionCount))]
#[unsafe(method_family = none)]
pub fn unexpectedExceptionCount(&self) -> NSUInteger;
#[unsafe(method(totalFailureCount))]
#[unsafe(method_family = none)]
pub fn totalFailureCount(&self) -> NSUInteger;
#[unsafe(method(hasSucceeded))]
#[unsafe(method_family = none)]
pub fn hasSucceeded(&self) -> bool;
#[unsafe(method(hasBeenSkipped))]
#[unsafe(method_family = none)]
pub fn hasBeenSkipped(&self) -> bool;
#[unsafe(method(recordIssue:))]
#[unsafe(method_family = none)]
pub fn recordIssue(&self, issue: &XCTIssue);
);
}
impl XCTestRun {
extern_methods!(
#[deprecated]
#[unsafe(method(recordFailureWithDescription:inFile:atLine:expected:))]
#[unsafe(method_family = none)]
pub fn recordFailureWithDescription_inFile_atLine_expected(
&self,
description: &NSString,
file_path: Option<&NSString>,
line_number: NSUInteger,
expected: bool,
);
);
}
extern_class!(
#[unsafe(super(XCTestRun, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTestCaseRun;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTestCaseRun {}
);
impl XCTestCaseRun {
extern_methods!(
#[deprecated]
#[unsafe(method(recordFailureInTest:withDescription:inFile:atLine:expected:))]
#[unsafe(method_family = none)]
pub fn recordFailureInTest_withDescription_inFile_atLine_expected(
&self,
test_case: &XCTestCase,
description: &NSString,
file_path: &NSString,
line_number: NSUInteger,
expected: bool,
);
);
}
impl XCTestCaseRun {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(testRunWithTest:))]
#[unsafe(method_family = none)]
pub fn testRunWithTest(test: &XCTest) -> Retained<Self>;
#[unsafe(method(initWithTest:))]
#[unsafe(method_family = init)]
pub fn initWithTest(this: Allocated<Self>, test: &XCTest) -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated]
pub struct XCTestObserver;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTestObserver {}
);
impl XCTestObserver {
extern_methods!(
#[unsafe(method(startObserving))]
#[unsafe(method_family = none)]
pub fn startObserving(&self);
#[unsafe(method(stopObserving))]
#[unsafe(method_family = none)]
pub fn stopObserving(&self);
#[unsafe(method(testSuiteDidStart:))]
#[unsafe(method_family = none)]
pub unsafe fn testSuiteDidStart(&self, test_run: Option<&XCTestRun>);
#[unsafe(method(testSuiteDidStop:))]
#[unsafe(method_family = none)]
pub unsafe fn testSuiteDidStop(&self, test_run: Option<&XCTestRun>);
#[unsafe(method(testCaseDidStart:))]
#[unsafe(method_family = none)]
pub unsafe fn testCaseDidStart(&self, test_run: Option<&XCTestRun>);
#[unsafe(method(testCaseDidStop:))]
#[unsafe(method_family = none)]
pub unsafe fn testCaseDidStop(&self, test_run: Option<&XCTestRun>);
#[unsafe(method(testCaseDidFail:withDescription:inFile:atLine:))]
#[unsafe(method_family = none)]
pub unsafe fn testCaseDidFail_withDescription_inFile_atLine(
&self,
test_run: Option<&XCTestRun>,
description: Option<&NSString>,
file_path: Option<&NSString>,
line_number: NSUInteger,
);
);
}
impl XCTestObserver {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTestObserver {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern "C" {
#[deprecated]
pub static XCTestObserverClassKey: Option<&'static NSString>;
}
extern_class!(
#[unsafe(super(XCTestObserver, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated]
pub struct XCTestLog;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTestLog {}
);
impl XCTestLog {
extern_methods!(
#[unsafe(method(logFileHandle))]
#[unsafe(method_family = none)]
pub fn logFileHandle(&self) -> Option<Retained<NSFileHandle>>;
);
}
impl XCTestLog {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTestLog {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
pub unsafe trait XCTestObservation: NSObjectProtocol {
#[optional]
#[unsafe(method(testBundleWillStart:))]
#[unsafe(method_family = none)]
fn testBundleWillStart(&self, test_bundle: &NSBundle);
#[optional]
#[unsafe(method(testBundleDidFinish:))]
#[unsafe(method_family = none)]
fn testBundleDidFinish(&self, test_bundle: &NSBundle);
#[optional]
#[unsafe(method(testSuiteWillStart:))]
#[unsafe(method_family = none)]
fn testSuiteWillStart(&self, test_suite: &XCTestSuite);
#[optional]
#[unsafe(method(testSuite:didRecordIssue:))]
#[unsafe(method_family = none)]
fn testSuite_didRecordIssue(&self, test_suite: &XCTestSuite, issue: &XCTIssue);
#[optional]
#[unsafe(method(testSuite:didRecordExpectedFailure:))]
#[unsafe(method_family = none)]
fn testSuite_didRecordExpectedFailure(
&self,
test_suite: &XCTestSuite,
expected_failure: &XCTExpectedFailure,
);
#[optional]
#[unsafe(method(testSuiteDidFinish:))]
#[unsafe(method_family = none)]
fn testSuiteDidFinish(&self, test_suite: &XCTestSuite);
#[optional]
#[unsafe(method(testCaseWillStart:))]
#[unsafe(method_family = none)]
fn testCaseWillStart(&self, test_case: &XCTestCase);
#[optional]
#[unsafe(method(testCase:didRecordIssue:))]
#[unsafe(method_family = none)]
fn testCase_didRecordIssue(&self, test_case: &XCTestCase, issue: &XCTIssue);
#[optional]
#[unsafe(method(testCase:didRecordExpectedFailure:))]
#[unsafe(method_family = none)]
fn testCase_didRecordExpectedFailure(
&self,
test_case: &XCTestCase,
expected_failure: &XCTExpectedFailure,
);
#[optional]
#[unsafe(method(testCaseDidFinish:))]
#[unsafe(method_family = none)]
fn testCaseDidFinish(&self, test_case: &XCTestCase);
#[deprecated]
#[optional]
#[unsafe(method(testSuite:didFailWithDescription:inFile:atLine:))]
#[unsafe(method_family = none)]
fn testSuite_didFailWithDescription_inFile_atLine(
&self,
test_suite: &XCTestSuite,
description: &NSString,
file_path: Option<&NSString>,
line_number: NSUInteger,
);
#[deprecated]
#[optional]
#[unsafe(method(testCase:didFailWithDescription:inFile:atLine:))]
#[unsafe(method_family = none)]
fn testCase_didFailWithDescription_inFile_atLine(
&self,
test_case: &XCTestCase,
description: &NSString,
file_path: Option<&NSString>,
line_number: NSUInteger,
);
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTestObservationCenter;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTestObservationCenter {}
);
impl XCTestObservationCenter {
extern_methods!(
#[unsafe(method(sharedTestObservationCenter))]
#[unsafe(method_family = none)]
pub fn sharedTestObservationCenter() -> Retained<XCTestObservationCenter>;
#[unsafe(method(addTestObserver:))]
#[unsafe(method_family = none)]
pub fn addTestObserver(&self, test_observer: &ProtocolObject<dyn XCTestObservation>);
#[unsafe(method(removeTestObserver:))]
#[unsafe(method_family = none)]
pub fn removeTestObserver(&self, test_observer: &ProtocolObject<dyn XCTestObservation>);
);
}
impl XCTestObservationCenter {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTestObservationCenter {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
#[deprecated]
#[inline]
pub extern "C-unwind" fn XCTSelfTestMain() -> c_int {
extern "C-unwind" {
fn XCTSelfTestMain() -> c_int;
}
unsafe { XCTSelfTestMain() }
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated]
pub struct XCTestProbe;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTestProbe {}
);
impl XCTestProbe {
extern_methods!(
#[unsafe(method(isTesting))]
#[unsafe(method_family = none)]
pub fn isTesting() -> bool;
);
}
impl XCTestProbe {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTestProbe {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern "C" {
#[deprecated]
pub static XCTestedUnitPath: Option<&'static NSString>;
}
extern "C" {
#[deprecated]
pub static XCTestScopeKey: Option<&'static NSString>;
}
extern "C" {
#[deprecated]
pub static XCTestScopeAll: Option<&'static NSString>;
}
extern "C" {
#[deprecated]
pub static XCTestScopeNone: Option<&'static NSString>;
}
extern "C" {
#[deprecated]
pub static XCTestScopeSelf: Option<&'static NSString>;
}
extern "C" {
#[deprecated]
pub static XCTestToolKey: Option<&'static NSString>;
}
extern_class!(
#[unsafe(super(NSException, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct _XCTSkipFailureException;
);
extern_conformance!(
unsafe impl NSCoding for _XCTSkipFailureException {}
);
extern_conformance!(
unsafe impl NSCopying for _XCTSkipFailureException {}
);
unsafe impl CopyingHelper for _XCTSkipFailureException {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for _XCTSkipFailureException {}
);
extern_conformance!(
unsafe impl NSSecureCoding for _XCTSkipFailureException {}
);
impl _XCTSkipFailureException {
extern_methods!();
}
impl _XCTSkipFailureException {
extern_methods!(
#[unsafe(method(initWithName:reason:userInfo:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithName_reason_userInfo(
this: Allocated<Self>,
a_name: &NSExceptionName,
a_reason: Option<&NSString>,
a_user_info: Option<&NSDictionary>,
) -> Retained<Self>;
);
}
impl _XCTSkipFailureException {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for _XCTSkipFailureException {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(XCTest, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTestSuite;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTestSuite {}
);
impl XCTestSuite {
extern_methods!(
#[unsafe(method(defaultTestSuite))]
#[unsafe(method_family = none)]
pub fn defaultTestSuite() -> Retained<XCTestSuite>;
#[unsafe(method(testSuiteForBundlePath:))]
#[unsafe(method_family = none)]
pub fn testSuiteForBundlePath(bundle_path: &NSString) -> Retained<Self>;
#[unsafe(method(testSuiteForTestCaseWithName:))]
#[unsafe(method_family = none)]
pub fn testSuiteForTestCaseWithName(name: &NSString) -> Retained<Self>;
#[unsafe(method(testSuiteForTestCaseClass:))]
#[unsafe(method_family = none)]
pub unsafe fn testSuiteForTestCaseClass(test_case_class: &AnyClass) -> Retained<Self>;
#[unsafe(method(testSuiteWithName:))]
#[unsafe(method_family = none)]
pub fn testSuiteWithName(name: &NSString) -> Retained<Self>;
#[unsafe(method(initWithName:))]
#[unsafe(method_family = init)]
pub fn initWithName(this: Allocated<Self>, name: &NSString) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(addTest:))]
#[unsafe(method_family = none)]
pub fn addTest(&self, test: &XCTest);
#[unsafe(method(tests))]
#[unsafe(method_family = none)]
pub fn tests(&self) -> Retained<NSArray<XCTest>>;
);
}
extern_class!(
#[unsafe(super(XCTestRun, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTestSuiteRun;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTestSuiteRun {}
);
impl XCTestSuiteRun {
extern_methods!(
#[unsafe(method(testRuns))]
#[unsafe(method_family = none)]
pub fn testRuns(&self) -> Retained<NSArray<XCTestRun>>;
#[unsafe(method(addTestRun:))]
#[unsafe(method_family = none)]
pub fn addTestRun(&self, test_run: &XCTestRun);
);
}
impl XCTestSuiteRun {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(testRunWithTest:))]
#[unsafe(method_family = none)]
pub fn testRunWithTest(test: &XCTest) -> Retained<Self>;
#[unsafe(method(initWithTest:))]
#[unsafe(method_family = init)]
pub fn initWithTest(this: Allocated<Self>, test: &XCTest) -> Retained<Self>;
);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct XCTAttachmentLifetime(pub NSInteger);
impl XCTAttachmentLifetime {
#[doc(alias = "XCTAttachmentLifetimeKeepAlways")]
pub const KeepAlways: Self = Self(0);
#[doc(alias = "XCTAttachmentLifetimeDeleteOnSuccess")]
pub const DeleteOnSuccess: Self = Self(1);
}
unsafe impl Encode for XCTAttachmentLifetime {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for XCTAttachmentLifetime {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTAttachment;
);
extern_conformance!(
unsafe impl NSCoding for XCTAttachment {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTAttachment {}
);
extern_conformance!(
unsafe impl NSSecureCoding for XCTAttachment {}
);
impl XCTAttachment {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithUniformTypeIdentifier:name:payload:userInfo:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithUniformTypeIdentifier_name_payload_userInfo(
this: Allocated<Self>,
identifier: Option<&NSString>,
name: Option<&NSString>,
payload: Option<&NSData>,
user_info: Option<&NSDictionary>,
) -> Retained<Self>;
#[unsafe(method(attachmentWithUniformTypeIdentifier:name:payload:userInfo:))]
#[unsafe(method_family = none)]
pub unsafe fn attachmentWithUniformTypeIdentifier_name_payload_userInfo(
identifier: Option<&NSString>,
name: Option<&NSString>,
payload: Option<&NSData>,
user_info: Option<&NSDictionary>,
) -> Retained<Self>;
#[unsafe(method(uniformTypeIdentifier))]
#[unsafe(method_family = none)]
pub fn uniformTypeIdentifier(&self) -> Retained<NSString>;
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub fn name(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setName:))]
#[unsafe(method_family = none)]
pub fn setName(&self, name: Option<&NSString>);
#[unsafe(method(userInfo))]
#[unsafe(method_family = none)]
pub fn userInfo(&self) -> Option<Retained<NSDictionary>>;
#[unsafe(method(setUserInfo:))]
#[unsafe(method_family = none)]
pub unsafe fn setUserInfo(&self, user_info: Option<&NSDictionary>);
#[unsafe(method(lifetime))]
#[unsafe(method_family = none)]
pub fn lifetime(&self) -> XCTAttachmentLifetime;
#[unsafe(method(setLifetime:))]
#[unsafe(method_family = none)]
pub fn setLifetime(&self, lifetime: XCTAttachmentLifetime);
);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct XCTImageQuality(pub NSInteger);
impl XCTImageQuality {
#[doc(alias = "XCTImageQualityOriginal")]
pub const Original: Self = Self(0);
#[doc(alias = "XCTImageQualityMedium")]
pub const Medium: Self = Self(1);
#[doc(alias = "XCTImageQualityLow")]
pub const Low: Self = Self(2);
}
unsafe impl Encode for XCTImageQuality {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for XCTImageQuality {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
impl XCTAttachment {
extern_methods!(
#[unsafe(method(attachmentWithData:))]
#[unsafe(method_family = none)]
pub fn attachmentWithData(payload: &NSData) -> Retained<Self>;
#[unsafe(method(attachmentWithData:uniformTypeIdentifier:))]
#[unsafe(method_family = none)]
pub fn attachmentWithData_uniformTypeIdentifier(
payload: &NSData,
identifier: &NSString,
) -> Retained<Self>;
#[unsafe(method(attachmentWithString:))]
#[unsafe(method_family = none)]
pub fn attachmentWithString(string: &NSString) -> Retained<Self>;
#[unsafe(method(attachmentWithArchivableObject:))]
#[unsafe(method_family = none)]
pub unsafe fn attachmentWithArchivableObject(
object: &ProtocolObject<dyn NSSecureCoding>,
) -> Retained<Self>;
#[unsafe(method(attachmentWithArchivableObject:uniformTypeIdentifier:))]
#[unsafe(method_family = none)]
pub unsafe fn attachmentWithArchivableObject_uniformTypeIdentifier(
object: &ProtocolObject<dyn NSSecureCoding>,
identifier: &NSString,
) -> Retained<Self>;
#[unsafe(method(attachmentWithPlistObject:))]
#[unsafe(method_family = none)]
pub unsafe fn attachmentWithPlistObject(object: &AnyObject) -> Retained<Self>;
#[unsafe(method(attachmentWithContentsOfFileAtURL:))]
#[unsafe(method_family = none)]
pub fn attachmentWithContentsOfFileAtURL(url: &NSURL) -> Retained<Self>;
#[unsafe(method(attachmentWithContentsOfFileAtURL:uniformTypeIdentifier:))]
#[unsafe(method_family = none)]
pub fn attachmentWithContentsOfFileAtURL_uniformTypeIdentifier(
url: &NSURL,
identifier: &NSString,
) -> Retained<Self>;
#[unsafe(method(attachmentWithCompressedContentsOfDirectoryAtURL:))]
#[unsafe(method_family = none)]
pub fn attachmentWithCompressedContentsOfDirectoryAtURL(url: &NSURL) -> Retained<Self>;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
#[unsafe(method(attachmentWithImage:))]
#[unsafe(method_family = none)]
pub fn attachmentWithImage(image: &NSImage) -> Retained<Self>;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
#[unsafe(method(attachmentWithImage:quality:))]
#[unsafe(method_family = none)]
pub fn attachmentWithImage_quality(
image: &NSImage,
quality: XCTImageQuality,
) -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTContext;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTContext {}
);
impl XCTContext {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
#[cfg(feature = "block2")]
#[unsafe(method(runActivityNamed:block:))]
#[unsafe(method_family = none)]
pub fn runActivityNamed_block(
name: &NSString,
block: &block2::DynBlock<dyn Fn(NonNull<ProtocolObject<dyn XCTActivity>>) + '_>,
);
);
}
impl DefaultRetained for XCTContext {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
#[inline]
pub extern "C-unwind" fn XCTExpectFailure(failure_reason: Option<&NSString>) {
extern "C-unwind" {
fn XCTExpectFailure(failure_reason: Option<&NSString>);
}
unsafe { XCTExpectFailure(failure_reason) }
}
#[inline]
pub extern "C-unwind" fn XCTExpectFailureWithOptions(
failure_reason: Option<&NSString>,
options: &XCTExpectedFailureOptions,
) {
extern "C-unwind" {
fn XCTExpectFailureWithOptions(
failure_reason: Option<&NSString>,
options: &XCTExpectedFailureOptions,
);
}
unsafe { XCTExpectFailureWithOptions(failure_reason, options) }
}
#[cfg(feature = "block2")]
#[inline]
pub extern "C-unwind" fn XCTExpectFailureInBlock(
failure_reason: Option<&NSString>,
failing_block: &block2::DynBlock<dyn Fn()>,
) {
extern "C-unwind" {
fn XCTExpectFailureInBlock(
failure_reason: Option<&NSString>,
failing_block: &block2::DynBlock<dyn Fn()>,
);
}
unsafe { XCTExpectFailureInBlock(failure_reason, failing_block) }
}
#[cfg(feature = "block2")]
#[inline]
pub extern "C-unwind" fn XCTExpectFailureWithOptionsInBlock(
failure_reason: Option<&NSString>,
options: &XCTExpectedFailureOptions,
failing_block: &block2::DynBlock<dyn Fn()>,
) {
extern "C-unwind" {
fn XCTExpectFailureWithOptionsInBlock(
failure_reason: Option<&NSString>,
options: &XCTExpectedFailureOptions,
failing_block: &block2::DynBlock<dyn Fn()>,
);
}
unsafe { XCTExpectFailureWithOptionsInBlock(failure_reason, options, failing_block) }
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTExpectedFailureOptions;
);
extern_conformance!(
unsafe impl NSCoding for XCTExpectedFailureOptions {}
);
extern_conformance!(
unsafe impl NSCopying for XCTExpectedFailureOptions {}
);
unsafe impl CopyingHelper for XCTExpectedFailureOptions {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for XCTExpectedFailureOptions {}
);
extern_conformance!(
unsafe impl NSSecureCoding for XCTExpectedFailureOptions {}
);
impl XCTExpectedFailureOptions {
extern_methods!(
#[cfg(feature = "block2")]
#[unsafe(method(issueMatcher))]
#[unsafe(method_family = none)]
pub unsafe fn issueMatcher(
&self,
) -> NonNull<block2::DynBlock<dyn Fn(NonNull<XCTIssue>) -> Bool>>;
#[cfg(feature = "block2")]
#[unsafe(method(setIssueMatcher:))]
#[unsafe(method_family = none)]
pub fn setIssueMatcher(
&self,
issue_matcher: &block2::DynBlock<dyn Fn(NonNull<XCTIssue>) -> Bool>,
);
#[unsafe(method(isEnabled))]
#[unsafe(method_family = none)]
pub fn isEnabled(&self) -> bool;
#[unsafe(method(setEnabled:))]
#[unsafe(method_family = none)]
pub fn setEnabled(&self, enabled: bool);
#[unsafe(method(isStrict))]
#[unsafe(method_family = none)]
pub fn isStrict(&self) -> bool;
#[unsafe(method(setStrict:))]
#[unsafe(method_family = none)]
pub fn setStrict(&self, strict: bool);
#[unsafe(method(nonStrictOptions))]
#[unsafe(method_family = none)]
pub fn nonStrictOptions() -> Retained<XCTExpectedFailureOptions>;
);
}
impl XCTExpectedFailureOptions {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTExpectedFailureOptions {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTExpectedFailure;
);
extern_conformance!(
unsafe impl NSCoding for XCTExpectedFailure {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTExpectedFailure {}
);
extern_conformance!(
unsafe impl NSSecureCoding for XCTExpectedFailure {}
);
impl XCTExpectedFailure {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
#[unsafe(method(failureReason))]
#[unsafe(method_family = none)]
pub fn failureReason(&self) -> Option<Retained<NSString>>;
#[unsafe(method(issue))]
#[unsafe(method_family = none)]
pub fn issue(&self) -> Retained<XCTIssue>;
);
}
impl DefaultRetained for XCTExpectedFailure {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct XCTIssueType(pub NSInteger);
impl XCTIssueType {
#[doc(alias = "XCTIssueTypeAssertionFailure")]
pub const AssertionFailure: Self = Self(0);
#[doc(alias = "XCTIssueTypeThrownError")]
pub const ThrownError: Self = Self(1);
#[doc(alias = "XCTIssueTypeUncaughtException")]
pub const UncaughtException: Self = Self(2);
#[doc(alias = "XCTIssueTypePerformanceRegression")]
pub const PerformanceRegression: Self = Self(3);
#[doc(alias = "XCTIssueTypeSystem")]
pub const System: Self = Self(4);
#[doc(alias = "XCTIssueTypeUnmatchedExpectedFailure")]
pub const UnmatchedExpectedFailure: Self = Self(5);
}
unsafe impl Encode for XCTIssueType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for XCTIssueType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct XCTIssueSeverity(pub NSInteger);
impl XCTIssueSeverity {
#[doc(alias = "XCTIssueSeverityWarning")]
pub const Warning: Self = Self(4);
#[doc(alias = "XCTIssueSeverityError")]
pub const Error: Self = Self(8);
}
unsafe impl Encode for XCTIssueSeverity {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for XCTIssueSeverity {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTIssue;
);
extern_conformance!(
unsafe impl NSCoding for XCTIssue {}
);
extern_conformance!(
unsafe impl NSCopying for XCTIssue {}
);
unsafe impl CopyingHelper for XCTIssue {
type Result = Self;
}
extern_conformance!(
unsafe impl NSMutableCopying for XCTIssue {}
);
unsafe impl MutableCopyingHelper for XCTIssue {
type Result = XCTMutableIssue;
}
extern_conformance!(
unsafe impl NSObjectProtocol for XCTIssue {}
);
extern_conformance!(
unsafe impl NSSecureCoding for XCTIssue {}
);
impl XCTIssue {
extern_methods!(
#[unsafe(method(initWithType:compactDescription:detailedDescription:sourceCodeContext:associatedError:attachments:))]
#[unsafe(method_family = init)]
pub fn initWithType_compactDescription_detailedDescription_sourceCodeContext_associatedError_attachments(
this: Allocated<Self>,
r#type: XCTIssueType,
compact_description: &NSString,
detailed_description: Option<&NSString>,
source_code_context: &XCTSourceCodeContext,
associated_error: Option<&NSError>,
attachments: &NSArray<XCTAttachment>,
) -> Retained<Self>;
#[unsafe(method(initWithType:compactDescription:detailedDescription:sourceCodeContext:associatedError:attachments:severity:))]
#[unsafe(method_family = init)]
pub fn initWithType_compactDescription_detailedDescription_sourceCodeContext_associatedError_attachments_severity(
this: Allocated<Self>,
r#type: XCTIssueType,
compact_description: &NSString,
detailed_description: Option<&NSString>,
source_code_context: &XCTSourceCodeContext,
associated_error: Option<&NSError>,
attachments: &NSArray<XCTAttachment>,
severity: XCTIssueSeverity,
) -> Retained<Self>;
#[unsafe(method(initWithType:compactDescription:severity:))]
#[unsafe(method_family = init)]
pub fn initWithType_compactDescription_severity(
this: Allocated<Self>,
r#type: XCTIssueType,
compact_description: &NSString,
severity: XCTIssueSeverity,
) -> Retained<Self>;
#[unsafe(method(initWithType:compactDescription:))]
#[unsafe(method_family = init)]
pub fn initWithType_compactDescription(
this: Allocated<Self>,
r#type: XCTIssueType,
compact_description: &NSString,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(type))]
#[unsafe(method_family = none)]
pub fn r#type(&self) -> XCTIssueType;
#[unsafe(method(compactDescription))]
#[unsafe(method_family = none)]
pub fn compactDescription(&self) -> Retained<NSString>;
#[unsafe(method(detailedDescription))]
#[unsafe(method_family = none)]
pub fn detailedDescription(&self) -> Option<Retained<NSString>>;
#[unsafe(method(sourceCodeContext))]
#[unsafe(method_family = none)]
pub fn sourceCodeContext(&self) -> Retained<XCTSourceCodeContext>;
#[unsafe(method(associatedError))]
#[unsafe(method_family = none)]
pub fn associatedError(&self) -> Option<Retained<NSError>>;
#[unsafe(method(attachments))]
#[unsafe(method_family = none)]
pub fn attachments(&self) -> Retained<NSArray<XCTAttachment>>;
#[unsafe(method(severity))]
#[unsafe(method_family = none)]
pub fn severity(&self) -> XCTIssueSeverity;
#[unsafe(method(isFailure))]
#[unsafe(method_family = none)]
pub fn isFailure(&self) -> bool;
);
}
extern_class!(
#[unsafe(super(XCTIssue, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTMutableIssue;
);
extern_conformance!(
unsafe impl NSCoding for XCTMutableIssue {}
);
extern_conformance!(
unsafe impl NSCopying for XCTMutableIssue {}
);
unsafe impl CopyingHelper for XCTMutableIssue {
type Result = XCTIssue;
}
extern_conformance!(
unsafe impl NSMutableCopying for XCTMutableIssue {}
);
unsafe impl MutableCopyingHelper for XCTMutableIssue {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for XCTMutableIssue {}
);
extern_conformance!(
unsafe impl NSSecureCoding for XCTMutableIssue {}
);
impl XCTMutableIssue {
extern_methods!(
#[unsafe(method(type))]
#[unsafe(method_family = none)]
pub fn r#type(&self) -> XCTIssueType;
#[unsafe(method(setType:))]
#[unsafe(method_family = none)]
pub fn setType(&self, r#type: XCTIssueType);
#[unsafe(method(compactDescription))]
#[unsafe(method_family = none)]
pub fn compactDescription(&self) -> Retained<NSString>;
#[unsafe(method(setCompactDescription:))]
#[unsafe(method_family = none)]
pub fn setCompactDescription(&self, compact_description: &NSString);
#[unsafe(method(detailedDescription))]
#[unsafe(method_family = none)]
pub fn detailedDescription(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setDetailedDescription:))]
#[unsafe(method_family = none)]
pub fn setDetailedDescription(&self, detailed_description: Option<&NSString>);
#[unsafe(method(sourceCodeContext))]
#[unsafe(method_family = none)]
pub fn sourceCodeContext(&self) -> Retained<XCTSourceCodeContext>;
#[unsafe(method(setSourceCodeContext:))]
#[unsafe(method_family = none)]
pub fn setSourceCodeContext(&self, source_code_context: &XCTSourceCodeContext);
#[unsafe(method(associatedError))]
#[unsafe(method_family = none)]
pub fn associatedError(&self) -> Option<Retained<NSError>>;
#[unsafe(method(setAssociatedError:))]
#[unsafe(method_family = none)]
pub fn setAssociatedError(&self, associated_error: Option<&NSError>);
#[unsafe(method(attachments))]
#[unsafe(method_family = none)]
pub fn attachments(&self) -> Retained<NSArray<XCTAttachment>>;
#[unsafe(method(setAttachments:))]
#[unsafe(method_family = none)]
pub fn setAttachments(&self, attachments: &NSArray<XCTAttachment>);
#[unsafe(method(severity))]
#[unsafe(method_family = none)]
pub fn severity(&self) -> XCTIssueSeverity;
#[unsafe(method(setSeverity:))]
#[unsafe(method_family = none)]
pub fn setSeverity(&self, severity: XCTIssueSeverity);
#[unsafe(method(addAttachment:))]
#[unsafe(method_family = none)]
pub fn addAttachment(&self, attachment: &XCTAttachment);
);
}
impl XCTMutableIssue {
extern_methods!(
#[unsafe(method(initWithType:compactDescription:detailedDescription:sourceCodeContext:associatedError:attachments:))]
#[unsafe(method_family = init)]
pub fn initWithType_compactDescription_detailedDescription_sourceCodeContext_associatedError_attachments(
this: Allocated<Self>,
r#type: XCTIssueType,
compact_description: &NSString,
detailed_description: Option<&NSString>,
source_code_context: &XCTSourceCodeContext,
associated_error: Option<&NSError>,
attachments: &NSArray<XCTAttachment>,
) -> Retained<Self>;
#[unsafe(method(initWithType:compactDescription:detailedDescription:sourceCodeContext:associatedError:attachments:severity:))]
#[unsafe(method_family = init)]
pub fn initWithType_compactDescription_detailedDescription_sourceCodeContext_associatedError_attachments_severity(
this: Allocated<Self>,
r#type: XCTIssueType,
compact_description: &NSString,
detailed_description: Option<&NSString>,
source_code_context: &XCTSourceCodeContext,
associated_error: Option<&NSError>,
attachments: &NSArray<XCTAttachment>,
severity: XCTIssueSeverity,
) -> Retained<Self>;
#[unsafe(method(initWithType:compactDescription:severity:))]
#[unsafe(method_family = init)]
pub fn initWithType_compactDescription_severity(
this: Allocated<Self>,
r#type: XCTIssueType,
compact_description: &NSString,
severity: XCTIssueSeverity,
) -> Retained<Self>;
#[unsafe(method(initWithType:compactDescription:))]
#[unsafe(method_family = init)]
pub fn initWithType_compactDescription(
this: Allocated<Self>,
r#type: XCTIssueType,
compact_description: &NSString,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct XCTMeasurementInvocationOptions(pub NSUInteger);
bitflags::bitflags! {
impl XCTMeasurementInvocationOptions: NSUInteger {
#[doc(alias = "XCTMeasurementInvocationNone")]
const None = 0;
#[doc(alias = "XCTMeasurementInvocationManuallyStart")]
const ManuallyStart = 1<<0;
#[doc(alias = "XCTMeasurementInvocationManuallyStop")]
const ManuallyStop = 1<<1;
}
}
unsafe impl Encode for XCTMeasurementInvocationOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for XCTMeasurementInvocationOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTMeasureOptions;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTMeasureOptions {}
);
impl XCTMeasureOptions {
extern_methods!(
#[unsafe(method(defaultOptions))]
#[unsafe(method_family = none)]
pub fn defaultOptions() -> Retained<XCTMeasureOptions>;
#[unsafe(method(invocationOptions))]
#[unsafe(method_family = none)]
pub fn invocationOptions(&self) -> XCTMeasurementInvocationOptions;
#[unsafe(method(setInvocationOptions:))]
#[unsafe(method_family = none)]
pub fn setInvocationOptions(&self, invocation_options: XCTMeasurementInvocationOptions);
#[unsafe(method(iterationCount))]
#[unsafe(method_family = none)]
pub fn iterationCount(&self) -> NSUInteger;
#[unsafe(method(setIterationCount:))]
#[unsafe(method_family = none)]
pub fn setIterationCount(&self, iteration_count: NSUInteger);
);
}
impl XCTMeasureOptions {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTMeasureOptions {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct XCTPerformanceMeasurementPolarity(pub NSInteger);
impl XCTPerformanceMeasurementPolarity {
#[doc(alias = "XCTPerformanceMeasurementPolarityPrefersSmaller")]
pub const PrefersSmaller: Self = Self(-1);
#[doc(alias = "XCTPerformanceMeasurementPolarityUnspecified")]
pub const Unspecified: Self = Self(0);
#[doc(alias = "XCTPerformanceMeasurementPolarityPrefersLarger")]
pub const PrefersLarger: Self = Self(1);
}
unsafe impl Encode for XCTPerformanceMeasurementPolarity {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for XCTPerformanceMeasurementPolarity {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTPerformanceMeasurementTimestamp;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTPerformanceMeasurementTimestamp {}
);
impl XCTPerformanceMeasurementTimestamp {
extern_methods!(
#[unsafe(method(absoluteTime))]
#[unsafe(method_family = none)]
pub fn absoluteTime(&self) -> u64;
#[unsafe(method(absoluteTimeNanoSeconds))]
#[unsafe(method_family = none)]
pub fn absoluteTimeNanoSeconds(&self) -> u64;
#[unsafe(method(date))]
#[unsafe(method_family = none)]
pub fn date(&self) -> Retained<NSDate>;
#[unsafe(method(initWithAbsoluteTime:date:))]
#[unsafe(method_family = init)]
pub fn initWithAbsoluteTime_date(
this: Allocated<Self>,
absolute_time: u64,
date: &NSDate,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
impl XCTPerformanceMeasurementTimestamp {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTPerformanceMeasurementTimestamp {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTPerformanceMeasurement;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTPerformanceMeasurement {}
);
impl XCTPerformanceMeasurement {
extern_methods!(
#[unsafe(method(identifier))]
#[unsafe(method_family = none)]
pub fn identifier(&self) -> Retained<NSString>;
#[unsafe(method(displayName))]
#[unsafe(method_family = none)]
pub fn displayName(&self) -> Retained<NSString>;
#[unsafe(method(value))]
#[unsafe(method_family = none)]
pub fn value(&self) -> Retained<NSMeasurement>;
#[unsafe(method(doubleValue))]
#[unsafe(method_family = none)]
pub fn doubleValue(&self) -> c_double;
#[unsafe(method(unitSymbol))]
#[unsafe(method_family = none)]
pub fn unitSymbol(&self) -> Retained<NSString>;
#[unsafe(method(polarity))]
#[unsafe(method_family = none)]
pub fn polarity(&self) -> XCTPerformanceMeasurementPolarity;
#[unsafe(method(initWithIdentifier:displayName:value:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithIdentifier_displayName_value(
this: Allocated<Self>,
identifier: &NSString,
display_name: &NSString,
value: &NSMeasurement,
) -> Retained<Self>;
#[unsafe(method(initWithIdentifier:displayName:doubleValue:unitSymbol:))]
#[unsafe(method_family = init)]
pub fn initWithIdentifier_displayName_doubleValue_unitSymbol(
this: Allocated<Self>,
identifier: &NSString,
display_name: &NSString,
double_value: c_double,
unit_symbol: &NSString,
) -> Retained<Self>;
#[unsafe(method(initWithIdentifier:displayName:value:polarity:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithIdentifier_displayName_value_polarity(
this: Allocated<Self>,
identifier: &NSString,
display_name: &NSString,
value: &NSMeasurement,
polarity: XCTPerformanceMeasurementPolarity,
) -> Retained<Self>;
#[unsafe(method(initWithIdentifier:displayName:doubleValue:unitSymbol:polarity:))]
#[unsafe(method_family = init)]
pub fn initWithIdentifier_displayName_doubleValue_unitSymbol_polarity(
this: Allocated<Self>,
identifier: &NSString,
display_name: &NSString,
double_value: c_double,
unit_symbol: &NSString,
polarity: XCTPerformanceMeasurementPolarity,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTPerformanceMeasurement {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
pub unsafe trait XCTMetric: NSCopying + NSObjectProtocol {
#[unsafe(method(reportMeasurementsFromStartTime:toEndTime:error:_))]
#[unsafe(method_family = none)]
fn reportMeasurementsFromStartTime_toEndTime_error(
&self,
start_time: &XCTPerformanceMeasurementTimestamp,
end_time: &XCTPerformanceMeasurementTimestamp,
) -> Result<Retained<NSArray<XCTPerformanceMeasurement>>, Retained<NSError>>;
#[optional]
#[unsafe(method(willBeginMeasuring))]
#[unsafe(method_family = none)]
fn willBeginMeasuring(&self);
#[optional]
#[unsafe(method(didStopMeasuring))]
#[unsafe(method_family = none)]
fn didStopMeasuring(&self);
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTClockMetric;
);
extern_conformance!(
unsafe impl NSCopying for XCTClockMetric {}
);
unsafe impl CopyingHelper for XCTClockMetric {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for XCTClockMetric {}
);
extern_conformance!(
unsafe impl XCTMetric for XCTClockMetric {}
);
impl XCTClockMetric {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
impl XCTClockMetric {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTClockMetric {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTOSSignpostMetric;
);
extern_conformance!(
unsafe impl NSCopying for XCTOSSignpostMetric {}
);
unsafe impl CopyingHelper for XCTOSSignpostMetric {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for XCTOSSignpostMetric {}
);
extern_conformance!(
unsafe impl XCTMetric for XCTOSSignpostMetric {}
);
impl XCTOSSignpostMetric {
extern_methods!(
#[unsafe(method(initWithSubsystem:category:name:))]
#[unsafe(method_family = init)]
pub fn initWithSubsystem_category_name(
this: Allocated<Self>,
subsystem: &NSString,
category: &NSString,
name: &NSString,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTOSSignpostMetric {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
impl XCTOSSignpostMetric {
extern_methods!(
#[deprecated = "Use XCTApplicationLaunchMetric instead"]
#[unsafe(method(applicationLaunchMetric))]
#[unsafe(method_family = none)]
pub fn applicationLaunchMetric() -> Retained<XCTOSSignpostMetric>;
#[unsafe(method(navigationTransitionMetric))]
#[unsafe(method_family = none)]
pub fn navigationTransitionMetric() -> Retained<ProtocolObject<dyn XCTMetric>>;
#[unsafe(method(customNavigationTransitionMetric))]
#[unsafe(method_family = none)]
pub fn customNavigationTransitionMetric() -> Retained<ProtocolObject<dyn XCTMetric>>;
#[unsafe(method(scrollingAndDecelerationMetric))]
#[unsafe(method_family = none)]
pub fn scrollingAndDecelerationMetric() -> Retained<ProtocolObject<dyn XCTMetric>>;
#[deprecated]
#[unsafe(method(scrollDecelerationMetric))]
#[unsafe(method_family = none)]
pub fn scrollDecelerationMetric() -> Retained<ProtocolObject<dyn XCTMetric>>;
#[deprecated]
#[unsafe(method(scrollDraggingMetric))]
#[unsafe(method_family = none)]
pub fn scrollDraggingMetric() -> Retained<ProtocolObject<dyn XCTMetric>>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTApplicationLaunchMetric;
);
extern_conformance!(
unsafe impl NSCopying for XCTApplicationLaunchMetric {}
);
unsafe impl CopyingHelper for XCTApplicationLaunchMetric {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for XCTApplicationLaunchMetric {}
);
extern_conformance!(
unsafe impl XCTMetric for XCTApplicationLaunchMetric {}
);
impl XCTApplicationLaunchMetric {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithWaitUntilResponsive:))]
#[unsafe(method_family = init)]
pub fn initWithWaitUntilResponsive(
this: Allocated<Self>,
wait_until_responsive: bool,
) -> Retained<Self>;
);
}
impl XCTApplicationLaunchMetric {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTApplicationLaunchMetric {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTCPUMetric;
);
extern_conformance!(
unsafe impl NSCopying for XCTCPUMetric {}
);
unsafe impl CopyingHelper for XCTCPUMetric {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for XCTCPUMetric {}
);
extern_conformance!(
unsafe impl XCTMetric for XCTCPUMetric {}
);
impl XCTCPUMetric {
extern_methods!(
#[unsafe(method(initLimitingToCurrentThread:))]
#[unsafe(method_family = init)]
pub fn initLimitingToCurrentThread(
this: Allocated<Self>,
limit_to_current_thread: bool,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
impl XCTCPUMetric {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTCPUMetric {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTMemoryMetric;
);
extern_conformance!(
unsafe impl NSCopying for XCTMemoryMetric {}
);
unsafe impl CopyingHelper for XCTMemoryMetric {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for XCTMemoryMetric {}
);
extern_conformance!(
unsafe impl XCTMetric for XCTMemoryMetric {}
);
impl XCTMemoryMetric {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
impl XCTMemoryMetric {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTMemoryMetric {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTStorageMetric;
);
extern_conformance!(
unsafe impl NSCopying for XCTStorageMetric {}
);
unsafe impl CopyingHelper for XCTStorageMetric {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for XCTStorageMetric {}
);
extern_conformance!(
unsafe impl XCTMetric for XCTStorageMetric {}
);
impl XCTStorageMetric {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
impl XCTStorageMetric {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTStorageMetric {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTHitchMetric;
);
extern_conformance!(
unsafe impl NSCopying for XCTHitchMetric {}
);
unsafe impl CopyingHelper for XCTHitchMetric {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for XCTHitchMetric {}
);
extern_conformance!(
unsafe impl XCTMetric for XCTHitchMetric {}
);
impl XCTHitchMetric {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTSourceCodeLocation;
);
extern_conformance!(
unsafe impl NSCoding for XCTSourceCodeLocation {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTSourceCodeLocation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for XCTSourceCodeLocation {}
);
impl XCTSourceCodeLocation {
extern_methods!(
#[unsafe(method(initWithFileURL:lineNumber:))]
#[unsafe(method_family = init)]
pub fn initWithFileURL_lineNumber(
this: Allocated<Self>,
file_url: &NSURL,
line_number: NSInteger,
) -> Retained<Self>;
#[unsafe(method(initWithFilePath:lineNumber:))]
#[unsafe(method_family = init)]
pub fn initWithFilePath_lineNumber(
this: Allocated<Self>,
file_path: &NSString,
line_number: NSInteger,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(fileURL))]
#[unsafe(method_family = none)]
pub fn fileURL(&self) -> Retained<NSURL>;
#[unsafe(method(lineNumber))]
#[unsafe(method_family = none)]
pub fn lineNumber(&self) -> NSInteger;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTSourceCodeSymbolInfo;
);
extern_conformance!(
unsafe impl NSCoding for XCTSourceCodeSymbolInfo {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTSourceCodeSymbolInfo {}
);
extern_conformance!(
unsafe impl NSSecureCoding for XCTSourceCodeSymbolInfo {}
);
impl XCTSourceCodeSymbolInfo {
extern_methods!(
#[unsafe(method(initWithImageName:symbolName:location:))]
#[unsafe(method_family = init)]
pub fn initWithImageName_symbolName_location(
this: Allocated<Self>,
image_name: &NSString,
symbol_name: &NSString,
location: Option<&XCTSourceCodeLocation>,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(imageName))]
#[unsafe(method_family = none)]
pub fn imageName(&self) -> Retained<NSString>;
#[unsafe(method(symbolName))]
#[unsafe(method_family = none)]
pub fn symbolName(&self) -> Retained<NSString>;
#[unsafe(method(location))]
#[unsafe(method_family = none)]
pub fn location(&self) -> Option<Retained<XCTSourceCodeLocation>>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTSourceCodeFrame;
);
extern_conformance!(
unsafe impl NSCoding for XCTSourceCodeFrame {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTSourceCodeFrame {}
);
extern_conformance!(
unsafe impl NSSecureCoding for XCTSourceCodeFrame {}
);
impl XCTSourceCodeFrame {
extern_methods!(
#[unsafe(method(initWithAddress:symbolInfo:))]
#[unsafe(method_family = init)]
pub fn initWithAddress_symbolInfo(
this: Allocated<Self>,
address: u64,
symbol_info: Option<&XCTSourceCodeSymbolInfo>,
) -> Retained<Self>;
#[unsafe(method(initWithAddress:))]
#[unsafe(method_family = init)]
pub fn initWithAddress(this: Allocated<Self>, address: u64) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(address))]
#[unsafe(method_family = none)]
pub fn address(&self) -> u64;
#[unsafe(method(symbolInfo))]
#[unsafe(method_family = none)]
pub fn symbolInfo(&self) -> Option<Retained<XCTSourceCodeSymbolInfo>>;
#[unsafe(method(symbolicationError))]
#[unsafe(method_family = none)]
pub fn symbolicationError(&self) -> Option<Retained<NSError>>;
#[unsafe(method(symbolInfoWithError:_))]
#[unsafe(method_family = none)]
pub fn symbolInfoWithError(
&self,
) -> Result<Retained<XCTSourceCodeSymbolInfo>, Retained<NSError>>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTSourceCodeContext;
);
extern_conformance!(
unsafe impl NSCoding for XCTSourceCodeContext {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTSourceCodeContext {}
);
extern_conformance!(
unsafe impl NSSecureCoding for XCTSourceCodeContext {}
);
impl XCTSourceCodeContext {
extern_methods!(
#[unsafe(method(initWithCallStack:location:))]
#[unsafe(method_family = init)]
pub fn initWithCallStack_location(
this: Allocated<Self>,
call_stack: &NSArray<XCTSourceCodeFrame>,
location: Option<&XCTSourceCodeLocation>,
) -> Retained<Self>;
#[unsafe(method(initWithCallStackAddresses:location:))]
#[unsafe(method_family = init)]
pub fn initWithCallStackAddresses_location(
this: Allocated<Self>,
call_stack_addresses: &NSArray<NSNumber>,
location: Option<&XCTSourceCodeLocation>,
) -> Retained<Self>;
#[unsafe(method(initWithLocation:))]
#[unsafe(method_family = init)]
pub fn initWithLocation(
this: Allocated<Self>,
location: Option<&XCTSourceCodeLocation>,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(callStack))]
#[unsafe(method_family = none)]
pub fn callStack(&self) -> Retained<NSArray<XCTSourceCodeFrame>>;
#[unsafe(method(location))]
#[unsafe(method_family = none)]
pub fn location(&self) -> Option<Retained<XCTSourceCodeLocation>>;
);
}
impl XCTSourceCodeContext {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTSourceCodeContext {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct XCTWaiterResult(pub NSInteger);
impl XCTWaiterResult {
#[doc(alias = "XCTWaiterResultCompleted")]
pub const Completed: Self = Self(1);
#[doc(alias = "XCTWaiterResultTimedOut")]
pub const TimedOut: Self = Self(2);
#[doc(alias = "XCTWaiterResultIncorrectOrder")]
pub const IncorrectOrder: Self = Self(3);
#[doc(alias = "XCTWaiterResultInvertedFulfillment")]
pub const InvertedFulfillment: Self = Self(4);
#[doc(alias = "XCTWaiterResultInterrupted")]
pub const Interrupted: Self = Self(5);
}
unsafe impl Encode for XCTWaiterResult {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for XCTWaiterResult {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTWaiter;
);
unsafe impl Send for XCTWaiter {}
unsafe impl Sync for XCTWaiter {}
extern_conformance!(
unsafe impl NSObjectProtocol for XCTWaiter {}
);
impl XCTWaiter {
extern_methods!(
#[unsafe(method(initWithDelegate:))]
#[unsafe(method_family = init)]
pub fn initWithDelegate(
this: Allocated<Self>,
delegate: Option<&ProtocolObject<dyn XCTWaiterDelegate>>,
) -> Retained<Self>;
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn XCTWaiterDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn XCTWaiterDelegate>>);
#[unsafe(method(fulfilledExpectations))]
#[unsafe(method_family = none)]
pub fn fulfilledExpectations(&self) -> Retained<NSArray<XCTestExpectation>>;
#[unsafe(method(waitForExpectations:))]
#[unsafe(method_family = none)]
pub fn waitForExpectations(
&self,
expectations: &NSArray<XCTestExpectation>,
) -> XCTWaiterResult;
#[unsafe(method(waitForExpectations:timeout:))]
#[unsafe(method_family = none)]
pub fn waitForExpectations_timeout(
&self,
expectations: &NSArray<XCTestExpectation>,
seconds: NSTimeInterval,
) -> XCTWaiterResult;
#[unsafe(method(waitForExpectations:enforceOrder:))]
#[unsafe(method_family = none)]
pub fn waitForExpectations_enforceOrder(
&self,
expectations: &NSArray<XCTestExpectation>,
enforce_order_of_fulfillment: bool,
) -> XCTWaiterResult;
#[unsafe(method(waitForExpectations:timeout:enforceOrder:))]
#[unsafe(method_family = none)]
pub fn waitForExpectations_timeout_enforceOrder(
&self,
expectations: &NSArray<XCTestExpectation>,
seconds: NSTimeInterval,
enforce_order_of_fulfillment: bool,
) -> XCTWaiterResult;
#[must_use]
#[unsafe(method(waitForExpectations:))]
#[unsafe(method_family = none)]
pub fn waitForExpectations_class(
expectations: &NSArray<XCTestExpectation>,
) -> XCTWaiterResult;
#[must_use]
#[unsafe(method(waitForExpectations:timeout:))]
#[unsafe(method_family = none)]
pub fn waitForExpectations_timeout_class(
expectations: &NSArray<XCTestExpectation>,
seconds: NSTimeInterval,
) -> XCTWaiterResult;
#[must_use]
#[unsafe(method(waitForExpectations:enforceOrder:))]
#[unsafe(method_family = none)]
pub fn waitForExpectations_enforceOrder_class(
expectations: &NSArray<XCTestExpectation>,
enforce_order_of_fulfillment: bool,
) -> XCTWaiterResult;
#[must_use]
#[unsafe(method(waitForExpectations:timeout:enforceOrder:))]
#[unsafe(method_family = none)]
pub fn waitForExpectations_timeout_enforceOrder_class(
expectations: &NSArray<XCTestExpectation>,
seconds: NSTimeInterval,
enforce_order_of_fulfillment: bool,
) -> XCTWaiterResult;
);
}
impl XCTWaiter {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTWaiter {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
pub unsafe trait XCTWaiterDelegate: NSObjectProtocol {
#[optional]
#[unsafe(method(waiter:didTimeoutWithUnfulfilledExpectations:))]
#[unsafe(method_family = none)]
fn waiter_didTimeoutWithUnfulfilledExpectations(
&self,
waiter: &XCTWaiter,
unfulfilled_expectations: &NSArray<XCTestExpectation>,
);
#[optional]
#[unsafe(method(waiter:fulfillmentDidViolateOrderingConstraintsForExpectation:requiredExpectation:))]
#[unsafe(method_family = none)]
fn waiter_fulfillmentDidViolateOrderingConstraintsForExpectation_requiredExpectation(
&self,
waiter: &XCTWaiter,
expectation: &XCTestExpectation,
required_expectation: &XCTestExpectation,
);
#[optional]
#[unsafe(method(waiter:didFulfillInvertedExpectation:))]
#[unsafe(method_family = none)]
fn waiter_didFulfillInvertedExpectation(
&self,
waiter: &XCTWaiter,
expectation: &XCTestExpectation,
);
#[optional]
#[unsafe(method(nestedWaiter:wasInterruptedByTimedOutWaiter:))]
#[unsafe(method_family = none)]
fn nestedWaiter_wasInterruptedByTimedOutWaiter(
&self,
waiter: &XCTWaiter,
outer_waiter: &XCTWaiter,
);
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTestExpectation;
);
unsafe impl Send for XCTestExpectation {}
unsafe impl Sync for XCTestExpectation {}
extern_conformance!(
unsafe impl NSObjectProtocol for XCTestExpectation {}
);
impl XCTestExpectation {
extern_methods!(
#[unsafe(method(initWithDescription:))]
#[unsafe(method_family = init)]
pub fn initWithDescription(
this: Allocated<Self>,
expectation_description: &NSString,
) -> Retained<Self>;
#[unsafe(method(expectationDescription))]
#[unsafe(method_family = none)]
pub fn expectationDescription(&self) -> Retained<NSString>;
#[unsafe(method(setExpectationDescription:))]
#[unsafe(method_family = none)]
pub fn setExpectationDescription(&self, expectation_description: &NSString);
#[unsafe(method(isInverted))]
#[unsafe(method_family = none)]
pub fn isInverted(&self) -> bool;
#[unsafe(method(setInverted:))]
#[unsafe(method_family = none)]
pub fn setInverted(&self, inverted: bool);
#[unsafe(method(expectedFulfillmentCount))]
#[unsafe(method_family = none)]
pub unsafe fn expectedFulfillmentCount(&self) -> NSUInteger;
#[unsafe(method(setExpectedFulfillmentCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setExpectedFulfillmentCount(&self, expected_fulfillment_count: NSUInteger);
#[unsafe(method(assertForOverFulfill))]
#[unsafe(method_family = none)]
pub unsafe fn assertForOverFulfill(&self) -> bool;
#[unsafe(method(setAssertForOverFulfill:))]
#[unsafe(method_family = none)]
pub unsafe fn setAssertForOverFulfill(&self, assert_for_over_fulfill: bool);
#[unsafe(method(fulfill))]
#[unsafe(method_family = none)]
pub fn fulfill(&self);
);
}
impl XCTestExpectation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for XCTestExpectation {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
#[cfg(feature = "block2")]
pub type XCKeyValueObservingExpectationHandler =
*mut block2::DynBlock<dyn Fn(NonNull<AnyObject>, NonNull<NSDictionary>) -> Bool>;
extern_class!(
#[unsafe(super(XCTestExpectation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTKVOExpectation;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTKVOExpectation {}
);
impl XCTKVOExpectation {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithDescription:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithDescription(
this: Allocated<Self>,
expectation_description: &NSString,
) -> Retained<Self>;
#[unsafe(method(initWithKeyPath:object:expectedValue:options:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithKeyPath_object_expectedValue_options(
this: Allocated<Self>,
key_path: &NSString,
object: &AnyObject,
expected_value: Option<&AnyObject>,
options: NSKeyValueObservingOptions,
) -> Retained<Self>;
#[unsafe(method(initWithKeyPath:object:expectedValue:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithKeyPath_object_expectedValue(
this: Allocated<Self>,
key_path: &NSString,
object: &AnyObject,
expected_value: Option<&AnyObject>,
) -> Retained<Self>;
#[unsafe(method(initWithKeyPath:object:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithKeyPath_object(
this: Allocated<Self>,
key_path: &NSString,
object: &AnyObject,
) -> Retained<Self>;
#[unsafe(method(keyPath))]
#[unsafe(method_family = none)]
pub fn keyPath(&self) -> Retained<NSString>;
#[unsafe(method(observedObject))]
#[unsafe(method_family = none)]
pub fn observedObject(&self) -> Retained<AnyObject>;
#[unsafe(method(expectedValue))]
#[unsafe(method_family = none)]
pub fn expectedValue(&self) -> Option<Retained<AnyObject>>;
#[unsafe(method(options))]
#[unsafe(method_family = none)]
pub fn options(&self) -> NSKeyValueObservingOptions;
#[cfg(feature = "block2")]
#[unsafe(method(handler))]
#[unsafe(method_family = none)]
pub unsafe fn handler(&self) -> XCKeyValueObservingExpectationHandler;
#[cfg(feature = "block2")]
#[unsafe(method(setHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn setHandler(&self, handler: XCKeyValueObservingExpectationHandler);
);
}
#[cfg(feature = "block2")]
pub type XCNotificationExpectationHandler =
*mut block2::DynBlock<dyn Fn(NonNull<NSNotification>) -> Bool>;
extern_class!(
#[unsafe(super(XCTestExpectation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTNSNotificationExpectation;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTNSNotificationExpectation {}
);
impl XCTNSNotificationExpectation {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithDescription:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithDescription(
this: Allocated<Self>,
expectation_description: &NSString,
) -> Retained<Self>;
#[unsafe(method(initWithName:object:notificationCenter:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithName_object_notificationCenter(
this: Allocated<Self>,
notification_name: &NSNotificationName,
object: Option<&AnyObject>,
notification_center: &NSNotificationCenter,
) -> Retained<Self>;
#[unsafe(method(initWithName:object:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithName_object(
this: Allocated<Self>,
notification_name: &NSNotificationName,
object: Option<&AnyObject>,
) -> Retained<Self>;
#[unsafe(method(initWithName:))]
#[unsafe(method_family = init)]
pub fn initWithName(
this: Allocated<Self>,
notification_name: &NSNotificationName,
) -> Retained<Self>;
#[unsafe(method(notificationName))]
#[unsafe(method_family = none)]
pub fn notificationName(&self) -> Retained<NSNotificationName>;
#[unsafe(method(observedObject))]
#[unsafe(method_family = none)]
pub fn observedObject(&self) -> Option<Retained<AnyObject>>;
#[unsafe(method(notificationCenter))]
#[unsafe(method_family = none)]
pub fn notificationCenter(&self) -> Retained<NSNotificationCenter>;
#[cfg(feature = "block2")]
#[unsafe(method(handler))]
#[unsafe(method_family = none)]
pub unsafe fn handler(&self) -> XCNotificationExpectationHandler;
#[cfg(feature = "block2")]
#[unsafe(method(setHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn setHandler(&self, handler: XCNotificationExpectationHandler);
);
}
#[cfg(feature = "block2")]
pub type XCPredicateExpectationHandler = *mut block2::DynBlock<dyn Fn() -> Bool>;
extern_class!(
#[unsafe(super(XCTestExpectation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTNSPredicateExpectation;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTNSPredicateExpectation {}
);
impl XCTNSPredicateExpectation {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithDescription:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithDescription(
this: Allocated<Self>,
expectation_description: &NSString,
) -> Retained<Self>;
#[unsafe(method(initWithPredicate:object:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithPredicate_object(
this: Allocated<Self>,
predicate: &NSPredicate,
object: Option<&AnyObject>,
) -> Retained<Self>;
#[unsafe(method(predicate))]
#[unsafe(method_family = none)]
pub fn predicate(&self) -> Retained<NSPredicate>;
#[unsafe(method(object))]
#[unsafe(method_family = none)]
pub fn object(&self) -> Option<Retained<AnyObject>>;
#[cfg(feature = "block2")]
#[unsafe(method(handler))]
#[unsafe(method_family = none)]
pub unsafe fn handler(&self) -> XCPredicateExpectationHandler;
#[cfg(feature = "block2")]
#[unsafe(method(setHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn setHandler(&self, handler: XCPredicateExpectationHandler);
#[unsafe(method(expectedFulfillmentCount))]
#[unsafe(method_family = none)]
pub unsafe fn expectedFulfillmentCount(&self) -> NSUInteger;
#[unsafe(method(setExpectedFulfillmentCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setExpectedFulfillmentCount(&self, expected_fulfillment_count: NSUInteger);
);
}
#[cfg(feature = "block2")]
pub type XCWaitCompletionHandler = *mut block2::DynBlock<dyn Fn(*mut NSError)>;
impl XCTestCase {
extern_methods!(
#[must_use]
#[unsafe(method(expectationWithDescription:))]
#[unsafe(method_family = none)]
pub fn expectationWithDescription(
&self,
description: &NSString,
) -> Retained<XCTestExpectation>;
#[cfg(feature = "block2")]
#[unsafe(method(waitForExpectationsWithTimeout:handler:))]
#[unsafe(method_family = none)]
pub unsafe fn waitForExpectationsWithTimeout_handler(
&self,
timeout: NSTimeInterval,
handler: XCWaitCompletionHandler,
mtm: MainThreadMarker,
);
#[unsafe(method(waitForExpectations:))]
#[unsafe(method_family = none)]
pub fn waitForExpectations(&self, expectations: &NSArray<XCTestExpectation>);
#[unsafe(method(waitForExpectations:timeout:))]
#[unsafe(method_family = none)]
pub fn waitForExpectations_timeout(
&self,
expectations: &NSArray<XCTestExpectation>,
seconds: NSTimeInterval,
);
#[unsafe(method(waitForExpectations:enforceOrder:))]
#[unsafe(method_family = none)]
pub fn waitForExpectations_enforceOrder(
&self,
expectations: &NSArray<XCTestExpectation>,
enforce_order_of_fulfillment: bool,
);
#[unsafe(method(waitForExpectations:timeout:enforceOrder:))]
#[unsafe(method_family = none)]
pub fn waitForExpectations_timeout_enforceOrder(
&self,
expectations: &NSArray<XCTestExpectation>,
seconds: NSTimeInterval,
enforce_order_of_fulfillment: bool,
);
#[unsafe(method(keyValueObservingExpectationForObject:keyPath:expectedValue:))]
#[unsafe(method_family = none)]
pub unsafe fn keyValueObservingExpectationForObject_keyPath_expectedValue(
&self,
object_to_observe: &AnyObject,
key_path: &NSString,
expected_value: Option<&AnyObject>,
) -> Retained<XCTestExpectation>;
#[cfg(feature = "block2")]
#[unsafe(method(keyValueObservingExpectationForObject:keyPath:handler:))]
#[unsafe(method_family = none)]
pub unsafe fn keyValueObservingExpectationForObject_keyPath_handler(
&self,
object_to_observe: &AnyObject,
key_path: &NSString,
handler: XCKeyValueObservingExpectationHandler,
) -> Retained<XCTestExpectation>;
#[cfg(feature = "block2")]
#[unsafe(method(expectationForNotification:object:handler:))]
#[unsafe(method_family = none)]
pub unsafe fn expectationForNotification_object_handler(
&self,
notification_name: &NSNotificationName,
object_to_observe: Option<&AnyObject>,
handler: XCNotificationExpectationHandler,
) -> Retained<XCTestExpectation>;
#[cfg(feature = "block2")]
#[unsafe(method(expectationForNotification:object:notificationCenter:handler:))]
#[unsafe(method_family = none)]
pub unsafe fn expectationForNotification_object_notificationCenter_handler(
&self,
notification_name: &NSNotificationName,
object_to_observe: Option<&AnyObject>,
notification_center: &NSNotificationCenter,
handler: XCNotificationExpectationHandler,
) -> Retained<XCTestExpectation>;
#[cfg(feature = "block2")]
#[unsafe(method(expectationForPredicate:evaluatedWithObject:handler:))]
#[unsafe(method_family = none)]
pub unsafe fn expectationForPredicate_evaluatedWithObject_handler(
&self,
predicate: &NSPredicate,
object: Option<&AnyObject>,
handler: XCPredicateExpectationHandler,
) -> Retained<XCTestExpectation>;
);
}
extern_conformance!(
unsafe impl XCTWaiterDelegate for XCTestCase {}
);
#[cfg(feature = "block2")]
pub type XCTDarwinNotificationExpectationHandler = *mut block2::DynBlock<dyn Fn() -> Bool>;
extern_class!(
#[unsafe(super(XCTestExpectation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct XCTDarwinNotificationExpectation;
);
extern_conformance!(
unsafe impl NSObjectProtocol for XCTDarwinNotificationExpectation {}
);
impl XCTDarwinNotificationExpectation {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithDescription:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithDescription(
this: Allocated<Self>,
expectation_description: &NSString,
) -> Retained<Self>;
#[unsafe(method(initWithNotificationName:))]
#[unsafe(method_family = init)]
pub fn initWithNotificationName(
this: Allocated<Self>,
notification_name: &NSString,
) -> Retained<Self>;
#[unsafe(method(notificationName))]
#[unsafe(method_family = none)]
pub fn notificationName(&self) -> Retained<NSString>;
#[cfg(feature = "block2")]
#[unsafe(method(handler))]
#[unsafe(method_family = none)]
pub unsafe fn handler(&self) -> XCTDarwinNotificationExpectationHandler;
#[cfg(feature = "block2")]
#[unsafe(method(setHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn setHandler(&self, handler: XCTDarwinNotificationExpectationHandler);
);
}
impl XCTAttachment {
extern_methods!(
#[cfg(feature = "objc2-xc-ui-automation")]
#[unsafe(method(attachmentWithScreenshot:))]
#[unsafe(method_family = none)]
pub fn attachmentWithScreenshot(screenshot: &XCUIScreenshot) -> Retained<Self>;
#[cfg(feature = "objc2-xc-ui-automation")]
#[unsafe(method(attachmentWithScreenshot:quality:))]
#[unsafe(method_family = none)]
pub fn attachmentWithScreenshot_quality(
screenshot: &XCUIScreenshot,
quality: XCTImageQuality,
) -> Retained<Self>;
);
}
impl XCTestCase {
extern_methods!(
#[unsafe(method(runsForEachTargetApplicationUIConfiguration))]
#[unsafe(method_family = none)]
pub fn runsForEachTargetApplicationUIConfiguration() -> bool;
);
}
impl XCTestCase {
extern_methods!(
#[cfg(all(feature = "block2", feature = "objc2-xc-ui-automation"))]
#[unsafe(method(addUIInterruptionMonitorWithDescription:handler:))]
#[unsafe(method_family = none)]
pub fn addUIInterruptionMonitorWithDescription_handler(
&self,
handler_description: &NSString,
handler: &block2::DynBlock<dyn Fn(NonNull<XCUIElement>) -> Bool>,
) -> Retained<ProtocolObject<dyn NSObjectProtocol>>;
#[unsafe(method(removeUIInterruptionMonitor:))]
#[unsafe(method_family = none)]
pub unsafe fn removeUIInterruptionMonitor(
&self,
monitor: &ProtocolObject<dyn NSObjectProtocol>,
);
);
}
impl XCTCPUMetric {
extern_methods!(
#[cfg(feature = "objc2-xc-ui-automation")]
#[unsafe(method(initWithApplication:))]
#[unsafe(method_family = init)]
pub fn initWithApplication(
this: Allocated<Self>,
application: &XCUIApplication,
) -> Retained<Self>;
);
}
impl XCTMemoryMetric {
extern_methods!(
#[cfg(feature = "objc2-xc-ui-automation")]
#[unsafe(method(initWithApplication:))]
#[unsafe(method_family = init)]
pub fn initWithApplication(
this: Allocated<Self>,
application: &XCUIApplication,
) -> Retained<Self>;
);
}
impl XCTStorageMetric {
extern_methods!(
#[cfg(feature = "objc2-xc-ui-automation")]
#[unsafe(method(initWithApplication:))]
#[unsafe(method_family = init)]
pub fn initWithApplication(
this: Allocated<Self>,
application: &XCUIApplication,
) -> Retained<Self>;
);
}
impl XCTHitchMetric {
extern_methods!(
#[cfg(feature = "objc2-xc-ui-automation")]
#[unsafe(method(initWithApplication:))]
#[unsafe(method_family = init)]
pub fn initWithApplication(
this: Allocated<Self>,
application: &XCUIApplication,
) -> Retained<Self>;
);
}