diff --git a/KIF Tests/AccessibilityActivationTests_ViewTestActor.m b/KIF Tests/AccessibilityActivationTests_ViewTestActor.m new file mode 100644 index 00000000..a7551a48 --- /dev/null +++ b/KIF Tests/AccessibilityActivationTests_ViewTestActor.m @@ -0,0 +1,32 @@ +// +// AccessibilityActivateTests_ViewTestActor.m +// KIF Tests +// +// Created by Alex Odawa on 09/07/2024. +// + +#import + +@interface AccessibilityActivateTests_ViewTestActor : KIFTestCase +@end + + +@implementation AccessibilityActivateTests_ViewTestActor + +- (void)beforeEach +{ + [[viewTester usingLabel:@"Accessibility"] tap]; +} + +- (void)afterEach +{ + [[[viewTester usingLabel:@"Test Suite"] usingTraits:UIAccessibilityTraitButton] tap]; +} + +- (void)testAccessibilityActivate +{ + [[viewTester usingLabel:@"AccessibilityView"] performAccessibilityActivateWithExpectedResult:YES]; + [[viewTester usingValue:@"Activated"] tryFindingView]; +} + +@end diff --git a/KIF.xcodeproj/project.pbxproj b/KIF.xcodeproj/project.pbxproj index 504824c6..83b4f3c7 100644 --- a/KIF.xcodeproj/project.pbxproj +++ b/KIF.xcodeproj/project.pbxproj @@ -204,6 +204,8 @@ 9CC881AC1AD4CE4B002CD34C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAB0726B139719AC008AF393 /* Foundation.framework */; }; 9CC881AD1AD4CE50002CD34C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CC881A21AD4CAAC002CD34C /* CoreFoundation.framework */; }; 9CC967401AD4B1B600576D13 /* KIF.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC9673F1AD4B1B600576D13 /* KIF.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AC2EB99A2C9A04F90082A170 /* AccessibilityActivationTests_ViewTestActor.m in Sources */ = {isa = PBXBuildFile; fileRef = AC2EB9992C9A04F90082A170 /* AccessibilityActivationTests_ViewTestActor.m */; }; + AC2EB99D2C9A09790082A170 /* AccessibilityViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AC2EB99C2C9A09790082A170 /* AccessibilityViewController.m */; }; ACA242E42C3DA55400E6F1B6 /* CustomActionTests_ViewTestActor.m in Sources */ = {isa = PBXBuildFile; fileRef = ACA242E32C3DA55400E6F1B6 /* CustomActionTests_ViewTestActor.m */; }; ACA242E72C3DB47400E6F1B6 /* UIAccessibilityCustomAction+KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = ACA242E52C3DB46A00E6F1B6 /* UIAccessibilityCustomAction+KIFAdditions.m */; }; ACA242E92C3DB4EA00E6F1B6 /* UIAccessibilityCustomAction+KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = ACA242E82C3DB4B000E6F1B6 /* UIAccessibilityCustomAction+KIFAdditions.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -432,6 +434,8 @@ 9CC9673F1AD4B1B600576D13 /* KIF.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KIF.h; sourceTree = ""; }; AAB0726B139719AC008AF393 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; AAB072B413971AEA008AF393 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + AC2EB9992C9A04F90082A170 /* AccessibilityActivationTests_ViewTestActor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AccessibilityActivationTests_ViewTestActor.m; sourceTree = ""; }; + AC2EB99C2C9A09790082A170 /* AccessibilityViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AccessibilityViewController.m; sourceTree = ""; }; ACA242E32C3DA55400E6F1B6 /* CustomActionTests_ViewTestActor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomActionTests_ViewTestActor.m; sourceTree = ""; }; ACA242E52C3DB46A00E6F1B6 /* UIAccessibilityCustomAction+KIFAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIAccessibilityCustomAction+KIFAdditions.m"; sourceTree = ""; }; ACA242E82C3DB4B000E6F1B6 /* UIAccessibilityCustomAction+KIFAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIAccessibilityCustomAction+KIFAdditions.h"; sourceTree = ""; }; @@ -824,6 +828,7 @@ EB60ECFC177F9031005A041A /* AppDelegate.m */, EB60ECFD177F9031005A041A /* ShowHideViewController.m */, EB9FB42617A5BACB00DDF160 /* GestureViewController.m */, + AC2EB99C2C9A09790082A170 /* AccessibilityViewController.m */, EB60ECFE177F9032005A041A /* TapViewController.m */, EB60ECFF177F9032005A041A /* TestSuiteViewController.m */, EA0F25491829839E006FF825 /* CollectionViewController.m */, @@ -933,6 +938,7 @@ FA8A3C601A77320000206350 /* SystemAlertTests_ViewTestActor.m */, 8E654FC329D79BD8007F7811 /* OffscreenTests_ViewTestActor.m */, ACA242E32C3DA55400E6F1B6 /* CustomActionTests_ViewTestActor.m */, + AC2EB9992C9A04F90082A170 /* AccessibilityActivationTests_ViewTestActor.m */, ); name = "KIFUIViewTestActor Tests"; sourceTree = ""; @@ -1405,6 +1411,7 @@ FA8A3C5D1A772CD100206350 /* WaitForAbscenceTests_ViewTestActor.m in Sources */, FA8A3C5B1A77281900206350 /* WebViewTests_ViewTestActor.m in Sources */, EABD46B11857A0F300A5F081 /* SearchFieldTests.m in Sources */, + AC2EB99A2C9A04F90082A170 /* AccessibilityActivationTests_ViewTestActor.m in Sources */, EABD46B21857A0F300A5F081 /* CascadingFailureTests.m in Sources */, EABD46B31857A0F300A5F081 /* CompositionTests.m in Sources */, CD4E91F01F479A8C005D530C /* CustomPickerTests.m in Sources */, @@ -1475,6 +1482,7 @@ EB60ED02177F9032005A041A /* TapViewController.m in Sources */, 2CDEE1CB181DBED200DF6E63 /* PickerController.m in Sources */, EB60ED03177F9032005A041A /* TestSuiteViewController.m in Sources */, + AC2EB99D2C9A09790082A170 /* AccessibilityViewController.m in Sources */, D9EA274318F05A6700D87E57 /* ScrollViewController.m in Sources */, 8EAA1EE229D3AF7A008F6029 /* OffscreenViewController.m in Sources */, 3812FB611A1212A700335733 /* AnimationViewController.m in Sources */, diff --git a/Test Host/AccessibilityViewController.m b/Test Host/AccessibilityViewController.m new file mode 100644 index 00000000..ca5cc86a --- /dev/null +++ b/Test Host/AccessibilityViewController.m @@ -0,0 +1,56 @@ +// +// AccessibilityViewController.m +// Test Host +// +// Created by Alex Odawa on 17/09/2024. +// + +#import + +@interface AccessibilityViewController_AccessibilityView : UIView +@property (nonatomic, strong) UILabel *label; +@end + + +@implementation AccessibilityViewController_AccessibilityView +- (instancetype)initWithCoder:(NSCoder *)coder { + self = [super initWithCoder:coder]; + self.isAccessibilityElement = YES; + self.accessibilityLabel = @"AccessibilityView"; + self.backgroundColor = [UIColor systemPinkColor]; + self.label = [[UILabel alloc] initWithFrame:CGRectZero]; + self.label.text = @"Inactive"; + [self addSubview:self.label]; + return self; +} + +-(void)layoutSubviews { + [super layoutSubviews]; + [self.label sizeToFit]; + self.label.frame = CGRectMake(self.frame.size.width - self.label.frame.size.width / 2, + self.frame.size.height - self.label.frame.size.height / 2, + self.label.frame.size.width, + self.label.frame.size.height); +} + +- (BOOL)accessibilityActivate { + self.backgroundColor = [UIColor systemTealColor]; + self.accessibilityValue = @"Activated"; + self.label.text = @"Activated"; + return YES; +} + +@end + +@interface AccessibilityViewController : UIViewController + +@end + +@implementation AccessibilityViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} + +@end diff --git a/Test Host/Base.lproj/MainStoryboard.storyboard b/Test Host/Base.lproj/MainStoryboard.storyboard index bfb6a686..409045b9 100644 --- a/Test Host/Base.lproj/MainStoryboard.storyboard +++ b/Test Host/Base.lproj/MainStoryboard.storyboard @@ -1,9 +1,9 @@ - + - + @@ -248,14 +248,14 @@ - + - + - + + + + + + + + + + + - + @@ -273,7 +290,7 @@ - + @@ -291,7 +308,7 @@ - + @@ -311,7 +328,7 @@ - + @@ -329,7 +346,7 @@ - + @@ -1970,7 +1987,7 @@ Line Break - + @@ -2057,11 +2074,11 @@ Line Break - + - + @@ -2077,11 +2094,11 @@ Line Break - +