XCElementSnapshotDouble.m 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 "XCElementSnapshotDouble.h"
  10. #import "FBXCAccessibilityElement.h"
  11. #import "FBXCElementSnapshot.h"
  12. #import "XCUIHitPointResult.h"
  13. @implementation XCElementSnapshotDouble
  14. - (id)init
  15. {
  16. self = [super init];
  17. self->_value = @"magicValue";
  18. self->_label = @"testLabel";
  19. return self;
  20. }
  21. - (NSString *)identifier
  22. {
  23. return @"testName";
  24. }
  25. - (CGRect)frame
  26. {
  27. return CGRectZero;
  28. }
  29. - (NSString *)title
  30. {
  31. return @"testTitle";
  32. }
  33. - (XCUIElementType)elementType
  34. {
  35. return XCUIElementTypeOther;
  36. }
  37. - (BOOL)isEnabled
  38. {
  39. return YES;
  40. }
  41. - (XCUIUserInterfaceSizeClass)horizontalSizeClass
  42. {
  43. return XCUIUserInterfaceSizeClassUnspecified;
  44. }
  45. - (XCUIUserInterfaceSizeClass)verticalSizeClass
  46. {
  47. return XCUIUserInterfaceSizeClassUnspecified;
  48. }
  49. - (NSString *)placeholderValue
  50. {
  51. return @"testPlaceholderValue";
  52. }
  53. - (BOOL)isSelected
  54. {
  55. return YES;
  56. }
  57. - (BOOL)hasFocus
  58. {
  59. return YES;
  60. }
  61. - (NSDictionary *)additionalAttributes
  62. {
  63. return @{};
  64. }
  65. - (id<FBXCAccessibilityElement>)accessibilityElement
  66. {
  67. return nil;
  68. }
  69. - (id<FBXCElementSnapshot>)parent
  70. {
  71. return nil;
  72. }
  73. - (XCUIHitPointResult *)hitPoint:(NSError **)error
  74. {
  75. return [[XCUIHitPointResult alloc] initWithHitPoint:CGPointZero hittable:YES];
  76. }
  77. - (NSArray *)children
  78. {
  79. return @[];
  80. }
  81. - (NSArray *)_allDescendants
  82. {
  83. return @[];
  84. }
  85. - (CGRect)visibleFrame
  86. {
  87. return CGRectZero;
  88. }
  89. - (UIAccessibilityTraits)traits
  90. {
  91. return UIAccessibilityTraitButton;
  92. }
  93. @end