XCUIElementDouble.m 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_takeSnapshot
  50. {
  51. return [self lastSnapshot];
  52. }
  53. - (void)resolve
  54. {
  55. self.didResolve = YES;
  56. }
  57. - (id)lastSnapshot
  58. {
  59. return self;
  60. }
  61. - (id)fb_uid
  62. {
  63. return self.wdUID;
  64. }
  65. @end