@amazon-devices/expo-linear-gradient 2.0.1758683737 → 2.0.9000000000

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,4 @@
1
1
  License from package.json:
2
2
  ==============================
3
3
 
4
- The MIT License (MIT)
5
-
6
- Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in all
16
- copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- SOFTWARE.
4
+ MIT
@@ -1,21 +1,22 @@
1
1
  /*
2
- * Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ * Copyright (c) 2024-2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  *
4
4
  * PROPRIETARY/CONFIDENTIAL
5
5
  *
6
6
  * Use is subject to license terms.
7
7
  */
8
8
 
9
+ #include "../ExpoLinearGradientDrawableLayer.h"
10
+
9
11
  #include <gmock/gmock-actions.h>
10
12
  #include <gmock/gmock.h>
11
13
  #include <gtest/gtest.h>
12
14
 
13
15
  #include "catch.hpp"
14
16
 
15
- #include "../ExpoLinearGradientDrawableLayer.h"
16
-
17
- using namespace volta::react;
17
+ namespace volta::react {
18
18
 
19
+ // NOLINTNEXTLINE - warnings caused by catch2 macro internal implementation
19
20
  TEST_CASE("ExpoLinearGradientDrawableLayer") {
20
21
  std::vector<uint32_t> colors{0xFF0000, 0x00FF00, 0x0000FF};
21
22
  std::vector<float> locations{10, 20, 30};
@@ -25,32 +26,25 @@ TEST_CASE("ExpoLinearGradientDrawableLayer") {
25
26
  volta::graphics::Path path;
26
27
  path.addRect(rect);
27
28
 
28
- // TODO: PROJVEGA-211833 - Fix these test cases - removing volta::graphics::Canvas mocks
29
- // SECTION("Test ExpoLinearGradientDrawableLayer::onDraw - No metrics set") {
30
- // ExpoLinearGradientDrawableLayer testExpoLinearGradientDrawableLayer{};
31
- // volta::graphics::Canvas canvas{};
32
- // EXPECT_CALL(canvas, drawPath(::testing::_, ::testing::_)).Times(0);
33
- // EXPECT_CALL(canvas, drawRect(::testing::_, ::testing::_)).Times(0);
34
- // testExpoLinearGradientDrawableLayer.onDraw(canvas);
35
- // }
36
-
37
- // SECTION("Test ExpoLinearGradientDrawableLayer::onDraw - Rect not set") {
38
- // ExpoLinearGradientDrawableLayer testExpoLinearGradientDrawableLayer{};
39
- // volta::graphics::Canvas canvas{};
40
- // testExpoLinearGradientDrawableLayer.setRect(rect);
41
- // EXPECT_CALL(canvas, drawPath(::testing::_, ::testing::_)).Times(0);
42
- // EXPECT_CALL(canvas, drawRect(::testing::_, ::testing::_)).Times(1);
43
- // testExpoLinearGradientDrawableLayer.onDraw(canvas);
44
- // }
45
-
46
- // SECTION("Test ExpoLinearGradientDrawableLayer::onDraw - Path not set") {
47
- // ExpoLinearGradientDrawableLayer testExpoLinearGradientDrawableLayer{};
48
- // volta::graphics::Canvas canvas{};
49
- // testExpoLinearGradientDrawableLayer.setPath(path);
50
- // EXPECT_CALL(canvas, drawPath(::testing::_, ::testing::_)).Times(1);
51
- // EXPECT_CALL(canvas, drawRect(::testing::_, ::testing::_)).Times(0);
52
- // testExpoLinearGradientDrawableLayer.onDraw(canvas);
53
- // }
29
+ SECTION("Test ExpoLinearGradientDrawableLayer::onDraw - No metrics set") {
30
+ ExpoLinearGradientDrawableLayer testExpoLinearGradientDrawableLayer{};
31
+ auto canvas = volta::graphics::Canvas::makeTestingCanvas();
32
+ testExpoLinearGradientDrawableLayer.onDraw(canvas);
33
+ }
34
+
35
+ SECTION("Test ExpoLinearGradientDrawableLayer::onDraw - Rect not set") {
36
+ ExpoLinearGradientDrawableLayer testExpoLinearGradientDrawableLayer{};
37
+ auto canvas = volta::graphics::Canvas::makeTestingCanvas();
38
+ testExpoLinearGradientDrawableLayer.setRect(rect);
39
+ testExpoLinearGradientDrawableLayer.onDraw(canvas);
40
+ }
41
+
42
+ SECTION("Test ExpoLinearGradientDrawableLayer::onDraw - Path not set") {
43
+ ExpoLinearGradientDrawableLayer testExpoLinearGradientDrawableLayer{};
44
+ auto canvas = volta::graphics::Canvas::makeTestingCanvas();
45
+ testExpoLinearGradientDrawableLayer.setPath(path);
46
+ testExpoLinearGradientDrawableLayer.onDraw(canvas);
47
+ }
54
48
 
55
49
  SECTION("Test ExpoLinearGradientDrawableLayer::calculateGradient - Colors are empty") {
56
50
  ExpoLinearGradientDrawableLayer testExpoLinearGradientDrawableLayer{};
@@ -60,8 +54,8 @@ TEST_CASE("ExpoLinearGradientDrawableLayer") {
60
54
 
61
55
  SECTION("Test ExpoLinearGradientDrawableLayer::calculateGradient - MismatchedLocationsWithColors") {
62
56
  ExpoLinearGradientDrawableLayer testExpoLinearGradientDrawableLayer{};
63
- std::vector<uint32_t> colors_more{0xFF0000, 0x00FF00, 0x0000FF, 0x000000};
64
- testExpoLinearGradientDrawableLayer.setColors(colors_more);
57
+ std::vector<uint32_t> colorsMore{0xFF0000, 0x00FF00, 0x0000FF, 0x000000};
58
+ testExpoLinearGradientDrawableLayer.setColors(colorsMore);
65
59
  testExpoLinearGradientDrawableLayer.setLocations(locations);
66
60
  testExpoLinearGradientDrawableLayer.calculateGradient();
67
61
  REQUIRE(testExpoLinearGradientDrawableLayer.linearGradientShader_ == nullptr);
@@ -76,7 +70,7 @@ TEST_CASE("ExpoLinearGradientDrawableLayer") {
76
70
  testExpoLinearGradientDrawableLayer.calculateGradient();
77
71
  REQUIRE(testExpoLinearGradientDrawableLayer.linearGradientShader_ != nullptr);
78
72
  }
79
-
73
+
80
74
  SECTION("Test ExpoLinearGradientDrawableLayer::calculateGradient - Locations are not empty") {
81
75
  ExpoLinearGradientDrawableLayer testExpoLinearGradientDrawableLayer{};
82
76
  REQUIRE(testExpoLinearGradientDrawableLayer.linearGradientShader_ == nullptr);
@@ -87,7 +81,7 @@ TEST_CASE("ExpoLinearGradientDrawableLayer") {
87
81
  testExpoLinearGradientDrawableLayer.calculateGradient();
88
82
  REQUIRE(testExpoLinearGradientDrawableLayer.linearGradientShader_ != nullptr);
89
83
  }
90
-
84
+
91
85
  SECTION("Test ExpoLinearGradientDrawableLayer::setColors") {
92
86
  ExpoLinearGradientDrawableLayer testExpoLinearGradientDrawableLayer{};
93
87
  testExpoLinearGradientDrawableLayer.setColors(colors);
@@ -127,8 +121,11 @@ TEST_CASE("ExpoLinearGradientDrawableLayer") {
127
121
 
128
122
  SECTION("Test ExpoLinearGradientDrawableLayer::setSize") {
129
123
  ExpoLinearGradientDrawableLayer testExpoLinearGradientDrawableLayer{};
130
- float w=10.0f, h=20.0f;
124
+ float w = 10.0f;
125
+ float h = 20.0f;
131
126
  testExpoLinearGradientDrawableLayer.setSize(w, h);
132
127
  REQUIRE(testExpoLinearGradientDrawableLayer.size_ == volta::graphics::Point{w, h});
133
128
  }
134
129
  }
130
+
131
+ } // namespace volta::react
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@amazon-devices/expo-linear-gradient", "version": "2.0.1758683737+12.6.0", "description": "Provides a React component that renders a gradient view.", "main": "build/LinearGradient.js", "types": "build/LinearGradient.d.ts", "sideEffects": false, "scripts": {"build": "expo-module build", "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", "expo-module": "expo-module"}, "kepler": {"temporary-alias-for-package": {"name": "expo-linear-gradient", "version": "12.6.0"}}, "keywords": ["react-native", "expo", "gradient"], "jest": {"preset": "expo-module-scripts"}, "repository": {"type": "git", "url": "https://github.com/expo/expo.git", "directory": "packages/expo-linear-gradient"}, "bugs": {"url": "https://github.com/expo/expo/issues"}, "author": "650 Industries, Inc.", "license": "See license in LICENSE", "homepage": "https://docs.expo.dev/versions/latest/sdk/linear-gradient/", "devDependencies": {"@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/react-native": "^11.3.0", "expo-module-scripts": "^3.0.0"}, "peerDependencies": {"expo": "*"}}
1
+ {"name": "@amazon-devices/expo-linear-gradient", "version": "2.0.9000000000+12.6.0", "description": "Provides a React component that renders a gradient view.", "main": "build/LinearGradient.js", "types": "build/LinearGradient.d.ts", "sideEffects": false, "scripts": {"build": "expo-module build", "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module"}, "kepler": {"temporary-alias-for-package": {"name": "expo-linear-gradient", "version": "12.6.0"}}, "keywords": ["react-native", "expo", "gradient"], "jest": {"preset": "expo-module-scripts"}, "repository": {"type": "git", "url": "https://github.com/expo/expo.git", "directory": "packages/expo-linear-gradient"}, "bugs": {"url": "https://github.com/expo/expo/issues"}, "author": "650 Industries, Inc.", "license": "See license in LICENSE", "homepage": "https://docs.expo.dev/versions/latest/sdk/linear-gradient/", "devDependencies": {"@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/react-native": "^11.3.0", "expo-module-scripts": "^3.0.0"}, "peerDependencies": {"expo": "*"}}