XCUIElementDouble.m 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /**
  2. * Copyright (c) 2015-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 = CGRectZero;
  19. self.wdNativeFrame = CGRectZero;
  20. self.wdName = @"testName";
  21. self.wdLabel = @"testLabel";
  22. self.wdValue = @"magicValue";
  23. self.wdPlaceholderValue = @"testPlaceholderValue";
  24. self.wdTraits = @"testTraits";
  25. self.wdVisible = YES;
  26. self.wdAccessible = YES;
  27. self.wdEnabled = YES;
  28. self.wdSelected = YES;
  29. self.wdFocused = YES;
  30. self.wdHittable = YES;
  31. self.wdIndex = 0;
  32. #if TARGET_OS_TV
  33. self.wdFocused = YES;
  34. #endif
  35. self.children = @[];
  36. self.wdRect = @{@"x": @0,
  37. @"y": @0,
  38. @"width": @0,
  39. @"height": @0,
  40. };
  41. self.wdAccessibilityContainer = NO;
  42. self.elementType = XCUIElementTypeOther;
  43. self.wdType = @"XCUIElementTypeOther";
  44. self.wdUID = @"0";
  45. self.lastSnapshot = nil;
  46. }
  47. return self;
  48. }
  49. - (id)fb_valueForWDAttributeName:(NSString *)name
  50. {
  51. return @"test";
  52. }
  53. - (id)query
  54. {
  55. return nil;
  56. }
  57. - (void)resolve
  58. {
  59. self.didResolve = YES;
  60. }
  61. - (void)fb_nativeResolve
  62. {
  63. self.didResolve = YES;
  64. }
  65. - (id _Nonnull)fb_standardSnapshot;
  66. {
  67. return [self lastSnapshot];
  68. }
  69. - (id _Nonnull)fb_customSnapshot;
  70. {
  71. return [self lastSnapshot];
  72. }
  73. - (NSString *)fb_cacheId
  74. {
  75. return self.wdUID;
  76. }
  77. - (id)lastSnapshot
  78. {
  79. return self;
  80. }
  81. - (id)fb_uid
  82. {
  83. return self.wdUID;
  84. }
  85. - (NSString *)wdTraits
  86. {
  87. return self.wdTraits;
  88. }
  89. @end