summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuha Alanen <juha.alanen@mapbox.com>2019-08-21 13:58:26 +0300
committerJuha Alanen <19551460+jmalanen@users.noreply.github.com>2019-09-18 14:29:15 +0300
commit97c4f13beca451cd2bd9443adc0859ec2da88f40 (patch)
tree70f9aa14541237551f74548f7d21f934f4117974
parent1b639d08198373c1b838aeea838527ce3fc4f59f (diff)
downloadqtlocation-mapboxgl-97c4f13beca451cd2bd9443adc0859ec2da88f40.tar.gz
[tests] Add feature state unit test
-rw-r--r--test/api/query.test.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp
index bf3f64a0c8..83aeec81ec 100644
--- a/test/api/query.test.cpp
+++ b/test/api/query.test.cpp
@@ -126,6 +126,22 @@ TEST(Query, QuerySourceFeatures) {
EXPECT_EQ(features1.size(), 1u);
}
+TEST(Query, QuerySourceFeatureStates) {
+ QueryTest test;
+
+ FeatureState newState;
+ newState["hover"] = true;
+ newState["radius"].set<uint64_t>(20);
+ test.frontend.getRenderer()->setFeatureState("source1", {}, "feature1", newState);
+
+ FeatureState states;
+ test.frontend.getRenderer()->getFeatureState(states, "source1", {}, "feature1");
+ ASSERT_EQ(states.size(), 2u);
+ ASSERT_EQ(states["hover"], true);
+ ASSERT_EQ(states["radius"].get<uint64_t>(), 20u);
+ ASSERT_EQ(newState, states);
+}
+
TEST(Query, QuerySourceFeaturesOptionValidation) {
QueryTest test;