| 13 | static auto kColorPalette = makeShared<ColorPalette>(); |
| 14 | |
| 15 | static Value makeGradientValue(std::vector<Color> colors, std::vector<double> locations, int32_t angle, bool radial) { |
| 16 | auto outColors = ValueArray::make(colors.size()); |
| 17 | auto outLocations = ValueArray::make(locations.size()); |
| 18 | |
| 19 | for (size_t i = 0; i < colors.size(); i++) { |
| 20 | outColors->emplace(i, Value(colors[i].value)); |
| 21 | } |
| 22 | for (size_t i = 0; i < locations.size(); i++) { |
| 23 | outLocations->emplace(i, Value(locations[i])); |
| 24 | } |
| 25 | |
| 26 | return Value(ValueArray::make({Value(outColors), Value(outLocations), Value(angle), Value(radial)})); |
| 27 | } |
| 28 | |
| 29 | TEST(AttributeProcessor, canParseSimpleBackground) { |
| 30 | auto result = preprocessGradient(kColorPalette, Value(STRING_LITERAL("red"))); |