summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-07-02 13:00:20 +0200
committerKonstantin Käfer <mail@kkaefer.com>2015-07-08 19:46:01 +0200
commitbc41d3cf6d0b5c635f856d95acd0d4941802f51f (patch)
treec45b435abbd33c5c979cd29c2d8d32de55fe7c6d /test
parent4f48874ef08ad00b7e1e3f22c983aea6202c669e (diff)
downloadqtlocation-mapboxgl-bc41d3cf6d0b5c635f856d95acd0d4941802f51f.tar.gz
don't restrict pixelRatio in SpriteStore
this is required so that devices that aren't using 1x or 2x (like the iPhone 6 Plus with a pixelRatio of 3x) still show icons, albeit bilinearly scaled to the correct size in the SpriteAtlas
Diffstat (limited to 'test')
-rw-r--r--test/annotations/sprite_store.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/test/annotations/sprite_store.cpp b/test/annotations/sprite_store.cpp
index 58d27bd7cc..ba5c213a78 100644
--- a/test/annotations/sprite_store.cpp
+++ b/test/annotations/sprite_store.cpp
@@ -11,7 +11,7 @@ TEST(Annotations, SpriteStore) {
const auto sprite3 = std::make_shared<SpriteImage>(8, 8, 2, std::string(16 * 16 * 4, '\0'));
using Sprites = std::map<std::string, std::shared_ptr<const SpriteImage>>;
- SpriteStore store(2);
+ SpriteStore store;
// Adding single
store.setSprite("one", sprite1);
@@ -53,24 +53,17 @@ TEST(Annotations, SpriteStore) {
EXPECT_EQ(Sprites(), store.getDirty());
}
-TEST(Annotations, SpriteStoreWrongPixelRatio) {
+TEST(Annotations, SpriteStoreOtherPixelRatio) {
FixtureLog log;
const auto sprite1 = std::make_shared<SpriteImage>(8, 8, 1, std::string(8 * 8 * 4, '\0'));
using Sprites = std::map<std::string, std::shared_ptr<const SpriteImage>>;
- SpriteStore store(2);
+ SpriteStore store;
// Adding mismatched sprite image
store.setSprite("one", sprite1);
- EXPECT_EQ(Sprites({}), store.getDirty());
-
- EXPECT_EQ(1u, log.count({
- EventSeverity::Warning,
- Event::Sprite,
- int64_t(-1),
- "Sprite image has wrong pixel ratio",
- }));
+ EXPECT_EQ(Sprites({ { "one", sprite1 } }), store.getDirty());
}
TEST(Annotations, SpriteStoreMultiple) {
@@ -78,7 +71,7 @@ TEST(Annotations, SpriteStoreMultiple) {
const auto sprite2 = std::make_shared<SpriteImage>(8, 8, 2, std::string(16 * 16 * 4, '\0'));
using Sprites = std::map<std::string, std::shared_ptr<const SpriteImage>>;
- SpriteStore store(2);
+ SpriteStore store;
store.setSprites({
{ "one", sprite1 }, { "two", sprite2 },
@@ -98,7 +91,7 @@ TEST(Annotations, SpriteStoreReplaceWithDifferentDimensions) {
const auto sprite2 = std::make_shared<SpriteImage>(9, 9, 2, std::string(18 * 18 * 4, '\0'));
using Sprites = std::map<std::string, std::shared_ptr<const SpriteImage>>;
- SpriteStore store(2);
+ SpriteStore store;
store.setSprite("sprite", sprite1);
store.setSprite("sprite", sprite2);