[core] move icon rotation from shaping to quad generation to mirror JS
This commit is contained in:
committed by
Alexander Shalamov
parent
1342cb44b3
commit
027e803b72
@@ -18,11 +18,11 @@ TEST(getIconQuads, normal) {
|
||||
style::Image::Impl("test", PremultipliedImage({1,1}), 1.0)
|
||||
};
|
||||
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{ -6.5f, -4.5f }}, SymbolAnchorType::Center, 0);
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-6.5f, -4.5f}}, SymbolAnchorType::Center);
|
||||
|
||||
GeometryCoordinates line;
|
||||
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, SymbolContent::IconRGBA);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
|
||||
|
||||
ASSERT_EQ(quads.size(), 1);
|
||||
const auto& quad = quads[0];
|
||||
@@ -54,7 +54,7 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// none
|
||||
{
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center, 0);
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
|
||||
|
||||
EXPECT_FLOAT_EQ(-18.5f, shapedIcon.top());
|
||||
EXPECT_FLOAT_EQ(-0.5f, shapedIcon.right());
|
||||
@@ -62,7 +62,7 @@ TEST(getIconQuads, style) {
|
||||
EXPECT_FLOAT_EQ(-18.5f, shapedIcon.left());
|
||||
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, SymbolContent::IconRGBA);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
|
||||
|
||||
ASSERT_EQ(quads.size(), 1);
|
||||
const auto& quad = quads[0];
|
||||
@@ -79,9 +79,9 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// width
|
||||
{
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center, 0);
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
|
||||
shapedIcon.fitIconToText(shapedText, IconTextFitType::Width, {{0, 0, 0, 0}}, {{0, 0}}, 24.0f / 24.0f);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, SymbolContent::IconRGBA);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
|
||||
|
||||
ASSERT_EQ(quads.size(), 1);
|
||||
const auto& quad = quads[0];
|
||||
@@ -98,9 +98,9 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// width x textSize
|
||||
{
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center, 0);
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
|
||||
shapedIcon.fitIconToText(shapedText, IconTextFitType::Width, {{0, 0, 0, 0}}, {{0, 0}}, 12.0f / 24.0f);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, SymbolContent::IconRGBA);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
|
||||
|
||||
ASSERT_EQ(quads.size(), 1);
|
||||
const auto& quad = quads[0];
|
||||
@@ -117,9 +117,9 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// width x textSize + padding
|
||||
{
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center, 0);
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
|
||||
shapedIcon.fitIconToText(shapedText, IconTextFitType::Width, {{5, 10, 5, 10}}, {{0, 0}}, 12.0f / 24.0f);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, SymbolContent::IconRGBA);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
|
||||
|
||||
ASSERT_EQ(quads.size(), 1);
|
||||
const auto& quad = quads[0];
|
||||
@@ -136,9 +136,9 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// height
|
||||
{
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center, 0);
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
|
||||
shapedIcon.fitIconToText(shapedText, IconTextFitType::Height, {{0, 0, 0, 0}}, {{0, 0}}, 24.0f / 24.0f);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, SymbolContent::IconRGBA);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
|
||||
|
||||
ASSERT_EQ(quads.size(), 1);
|
||||
const auto& quad = quads[0];
|
||||
@@ -156,9 +156,9 @@ TEST(getIconQuads, style) {
|
||||
// height x textSize
|
||||
{
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center, 0);
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
|
||||
shapedIcon.fitIconToText(shapedText, IconTextFitType::Height, {{0, 0, 0, 0}}, {{0, 0}}, 12.0f / 24.0f);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, SymbolContent::IconRGBA);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
|
||||
|
||||
ASSERT_EQ(quads.size(), 1);
|
||||
const auto& quad = quads[0];
|
||||
@@ -175,9 +175,9 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// height x textSize + padding
|
||||
{
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center, 0);
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
|
||||
shapedIcon.fitIconToText(shapedText, IconTextFitType::Height, {{5, 10, 5, 20}}, {{0, 0}}, 12.0f / 24.0f);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, SymbolContent::IconRGBA);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
|
||||
|
||||
ASSERT_EQ(quads.size(), 1);
|
||||
const auto& quad = quads[0];
|
||||
@@ -194,9 +194,9 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// both
|
||||
{
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center, 0);
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
|
||||
shapedIcon.fitIconToText(shapedText, IconTextFitType::Both, {{0, 0, 0, 0}}, {{0, 0}}, 24.0f / 24.0f);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, SymbolContent::IconRGBA);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
|
||||
|
||||
ASSERT_EQ(quads.size(), 1);
|
||||
const auto& quad = quads[0];
|
||||
@@ -213,9 +213,9 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// both x textSize
|
||||
{
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center, 0);
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
|
||||
shapedIcon.fitIconToText(shapedText, IconTextFitType::Both, {{0, 0, 0, 0}}, {{0, 0}}, 12.0f / 24.0f);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, SymbolContent::IconRGBA);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
|
||||
|
||||
ASSERT_EQ(quads.size(), 1);
|
||||
const auto& quad = quads[0];
|
||||
@@ -232,9 +232,9 @@ TEST(getIconQuads, style) {
|
||||
|
||||
// both x textSize + padding
|
||||
{
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center, 0);
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
|
||||
shapedIcon.fitIconToText(shapedText, IconTextFitType::Both, {{5, 10, 5, 10}}, {{0, 0}}, 12.0f / 24.0f);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, SymbolContent::IconRGBA);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
|
||||
|
||||
ASSERT_EQ(quads.size(), 1);
|
||||
const auto& quad = quads[0];
|
||||
@@ -253,9 +253,9 @@ TEST(getIconQuads, style) {
|
||||
{
|
||||
SymbolLayoutProperties::Evaluated layout;
|
||||
layout.get<TextSize>() = 12.0f;
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center, 0);
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
|
||||
shapedIcon.fitIconToText(shapedText, IconTextFitType::Both, {{0, 5, 10, 15}}, {{0, 0}}, 12.0f / 24.0f);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, SymbolContent::IconRGBA);
|
||||
SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
|
||||
|
||||
ASSERT_EQ(quads.size(), 1);
|
||||
const auto& quad = quads[0];
|
||||
|
||||
Reference in New Issue
Block a user