ParagraphAttributesTest.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #include <memory>
  8. #include <assert.h>
  9. #include <gtest/gtest.h>
  10. #include <react/attributedstring/ParagraphAttributes.h>
  11. #include <react/attributedstring/conversions.h>
  12. #include <react/attributedstring/primitives.h>
  13. namespace facebook {
  14. namespace react {
  15. #ifdef ANDROID
  16. TEST(ParagraphAttributesTest, testToDynamic) {
  17. auto paragraphAttributes = ParagraphAttributes();
  18. paragraphAttributes.maximumNumberOfLines = 2;
  19. paragraphAttributes.adjustsFontSizeToFit = false;
  20. paragraphAttributes.ellipsizeMode = EllipsizeMode::Middle;
  21. auto result = toDynamic(paragraphAttributes);
  22. assert(
  23. result["maximumNumberOfLines"] ==
  24. paragraphAttributes.maximumNumberOfLines);
  25. assert(
  26. result["adjustsFontSizeToFit"] ==
  27. paragraphAttributes.adjustsFontSizeToFit);
  28. assert(
  29. result["ellipsizeMode"] == toString(paragraphAttributes.ellipsizeMode));
  30. }
  31. #endif
  32. } // namespace react
  33. } // namespace facebook