FBMathUtils.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 <UIKit/UIKit.h>
  10. @class XCUIApplication;
  11. extern CGFloat FBDefaultFrameFuzzyThreshold;
  12. /*! Returns center point of given rect */
  13. CGPoint FBRectGetCenter(CGRect rect);
  14. /*! Returns whether floatss are equal within given threshold */
  15. BOOL FBFloatFuzzyEqualToFloat(CGFloat float1, CGFloat float2, CGFloat threshold);
  16. /*! Returns whether points are equal within given threshold */
  17. BOOL FBPointFuzzyEqualToPoint(CGPoint point1, CGPoint point2, CGFloat threshold);
  18. /*! Returns whether vectors are equal within given threshold */
  19. BOOL FBVectorFuzzyEqualToVector(CGVector a, CGVector b, CGFloat threshold);
  20. /*! Returns whether size are equal within given threshold */
  21. BOOL FBSizeFuzzyEqualToSize(CGSize size1, CGSize size2, CGFloat threshold);
  22. /*! Returns whether rect are equal within given threshold */
  23. BOOL FBRectFuzzyEqualToRect(CGRect rect1, CGRect rect2, CGFloat threshold);
  24. #if !TARGET_OS_TV
  25. /*! Inverts size if necessary to match current screen orientation */
  26. CGSize FBAdjustDimensionsForApplication(CGSize actualSize, UIInterfaceOrientation orientation);
  27. #endif