summaryrefslogtreecommitdiff
path: root/test/sprite
diff options
context:
space:
mode:
authorMike Morris <mikemorris@users.noreply.github.com>2016-11-01 11:47:53 -0400
committerMike Morris <mikemorris@users.noreply.github.com>2016-11-04 14:47:34 -0400
commit39e9b30ebc1647a72234f8cf37e0c095983253cf (patch)
treeaea9ffa8e6f3094993ce468caa31bdcbd36f02ad /test/sprite
parent6c30105a5390b1821ba698d6b9c05c4c24294db6 (diff)
downloadqtlocation-mapboxgl-39e9b30ebc1647a72234f8cf37e0c095983253cf.tar.gz
[core] add more detail to invalid metrics error in createSpriteImage
Diffstat (limited to 'test/sprite')
-rw-r--r--test/sprite/sprite_parser.test.cpp97
1 files changed, 91 insertions, 6 deletions
diff --git a/test/sprite/sprite_parser.test.cpp b/test/sprite/sprite_parser.test.cpp
index 7bedf7bc28..d634df1c1a 100644
--- a/test/sprite/sprite_parser.test.cpp
+++ b/test/sprite/sprite_parser.test.cpp
@@ -41,12 +41,97 @@ TEST(Sprite, SpriteImageCreationInvalid) {
ASSERT_EQ(nullptr, createSpriteImage(image_1x, 0, 0, image_1x.size.width + 1, 16, 1, false)); // right edge out of bounds
ASSERT_EQ(nullptr, createSpriteImage(image_1x, 0, 0, 16, image_1x.size.height + 1, 1, false)); // bottom edge out of bounds
- EXPECT_EQ(13u, log.count({
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Error,
+ Event::Sprite,
+ int64_t(-1),
+ "Can't create sprite with invalid metrics: 0x16@0,0 in 200x299@1x sprite",
+ }));
+
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Error,
+ Event::Sprite,
+ int64_t(-1),
+ "Can't create sprite with invalid metrics: 16x0@0,0 in 200x299@1x sprite",
+ }));
+
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Error,
+ Event::Sprite,
+ int64_t(-1),
+ "Can't create sprite with invalid metrics: 4294967295x16@0,0 in 200x299@1x sprite",
+ }));
+
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Error,
+ Event::Sprite,
+ int64_t(-1),
+ "Can't create sprite with invalid metrics: 16x4294967295@0,0 in 200x299@1x sprite",
+ }));
+
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Error,
+ Event::Sprite,
+ int64_t(-1),
+ "Can't create sprite with invalid metrics: 1x1@0,0 in 200x299@0x sprite",
+ }));
+
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Error,
+ Event::Sprite,
+ int64_t(-1),
+ "Can't create sprite with invalid metrics: 1x1@0,0 in 200x299@-1x sprite",
+ }));
+
+ EXPECT_EQ(1u, log.count({
EventSeverity::Error,
Event::Sprite,
int64_t(-1),
- "Can't create sprite with invalid metrics",
+ "Can't create sprite with invalid metrics: 1x1@0,0 in 200x299@23x sprite",
}));
+
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Error,
+ Event::Sprite,
+ int64_t(-1),
+ "Can't create sprite with invalid metrics: 2048x16@0,0 in 200x299@1x sprite",
+ }));
+
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Error,
+ Event::Sprite,
+ int64_t(-1),
+ "Can't create sprite with invalid metrics: 16x1025@0,0 in 200x299@1x sprite",
+ }));
+
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Error,
+ Event::Sprite,
+ int64_t(-1),
+ "Can't create sprite with invalid metrics: 16x16@4294967295,0 in 200x299@1x sprite",
+ }));
+
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Error,
+ Event::Sprite,
+ int64_t(-1),
+ "Can't create sprite with invalid metrics: 16x16@0,4294967295 in 200x299@1x sprite",
+ }));
+
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Error,
+ Event::Sprite,
+ int64_t(-1),
+ "Can't create sprite with invalid metrics: 201x16@0,0 in 200x299@1x sprite",
+ }));
+
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Error,
+ Event::Sprite,
+ int64_t(-1),
+ "Can't create sprite with invalid metrics: 16x300@0,0 in 200x299@1x sprite",
+ }));
+
}
TEST(Sprite, SpriteImageCreation1x) {
@@ -228,7 +313,7 @@ TEST(Sprite, SpriteParsingEmptyImage) {
EventSeverity::Error,
Event::Sprite,
int64_t(-1),
- "Can't create sprite with invalid metrics",
+ "Can't create sprite with invalid metrics: 0x0@0,0 in 200x299@1x sprite",
}));
}
@@ -261,7 +346,7 @@ TEST(Sprite, SpriteParsingWidthTooBig) {
EventSeverity::Error,
Event::Sprite,
int64_t(-1),
- "Can't create sprite with invalid metrics",
+ "Can't create sprite with invalid metrics: 0x32@0,0 in 200x299@1x sprite",
}));
}
@@ -284,7 +369,7 @@ TEST(Sprite, SpriteParsingNegativeWidth) {
EventSeverity::Error,
Event::Sprite,
int64_t(-1),
- "Can't create sprite with invalid metrics",
+ "Can't create sprite with invalid metrics: 0x32@0,0 in 200x299@1x sprite",
}));
}
@@ -301,6 +386,6 @@ TEST(Sprite, SpriteParsingNullRatio) {
EventSeverity::Error,
Event::Sprite,
int64_t(-1),
- "Can't create sprite with invalid metrics",
+ "Can't create sprite with invalid metrics: 32x32@0,0 in 200x299@0x sprite",
}));
}