XCUIElementDouble.m 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /**
  2. * Copyright (c) 2018-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import "XCUIElementDouble.h"
  10. @interface XCUIElementDouble ()
  11. @property (nonatomic, assign, readwrite) BOOL didResolve;
  12. @end
  13. @implementation XCUIElementDouble
  14. - (id)init
  15. {
  16. self = [super init];
  17. if (self) {
  18. self.wdFrame = CGRectMake(0, 0, 0, 0);
  19. self.wdName = @"testName";
  20. self.wdLabel = @"testLabel";
  21. self.wdValue = @"magicValue";
  22. self.wdVisible = YES;
  23. self.wdAccessible = YES;
  24. self.wdEnabled = YES;
  25. self.wdSelected = YES;
  26. self.wdHittable = YES;
  27. self.wdIndex = 0;
  28. #if TARGET_OS_TV
  29. self.wdFocused = YES;
  30. #endif
  31. self.children = @[];
  32. self.wdRect = @{@"x": @0,
  33. @"y": @0,
  34. @"width": @0,
  35. @"height": @0,
  36. };
  37. self.wdAccessibilityContainer = NO;
  38. self.elementType = XCUIElementTypeOther;
  39. self.wdType = @"XCUIElementTypeOther";
  40. self.wdUID = @"0";
  41. self.lastSnapshot = nil;
  42. }
  43. return self;
  44. }
  45. - (id)fb_valueForWDAttributeName:(NSString *)name
  46. {
  47. return @"test";
  48. }
  49. - (id)fb_standardSnapshot
  50. {
  51. return [self lastSnapshot];
  52. }
  53. - (id)fb_customSnapshot
  54. {
  55. return [self lastSnapshot];
  56. }
  57. - (void)resolve
  58. {
  59. self.didResolve = YES;
  60. }
  61. - (id)lastSnapshot
  62. {
  63. return self;
  64. }
  65. - (id)fb_uid
  66. {
  67. return self.wdUID;
  68. }
  69. @end