diff options
author | tobrun <tobrun.van.nuland@gmail.com> | 2018-05-29 13:10:16 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2018-05-29 15:53:38 +0200 |
commit | 83ebd5f6ff56fddd4a2923f6c082977476cddd99 (patch) | |
tree | b56ab08a2490f100efc91ebae8d97c987dd0f775 /platform/android/MapboxGLAndroidSDK/src/test | |
parent | 2e2d5bf03c23b2ece3d977532c589275681973be (diff) | |
download | qtlocation-mapboxgl-83ebd5f6ff56fddd4a2923f6c082977476cddd99.tar.gz |
[android] - fix literal wrapping in comparission expressions
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/test')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/expressions/ExpressionTest.java | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/expressions/ExpressionTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/expressions/ExpressionTest.java index f87fd31172..1070a25f55 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/expressions/ExpressionTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/style/expressions/ExpressionTest.java @@ -1,9 +1,7 @@ package com.mapbox.mapboxsdk.style.expressions; import android.graphics.Color; - import com.mapbox.mapboxsdk.style.layers.PropertyFactory; - import org.junit.Test; import java.util.Arrays; @@ -139,6 +137,13 @@ public class ExpressionTest { } @Test + public void testEqExpression() throws Exception { + Object[] expected = new Object[] {"==",new Object[]{"get", "hello"}, 1f}; + Object[] actual = eq(get("hello"), 1).toArray(); + assertTrue("expression should match", Arrays.deepEquals(expected, actual)); + } + + @Test public void testNeq() throws Exception { Object[] expected = new Object[] {"!=", 0f, 1f}; Object[] actual = neq(literal(0), literal(1)).toArray(); @@ -153,6 +158,13 @@ public class ExpressionTest { } @Test + public void testNeqExpression() throws Exception { + Object[] expected = new Object[] {"!=",new Object[]{"get", "hello"}, 1f}; + Object[] actual = neq(get("hello"), 1).toArray(); + assertTrue("expression should match", Arrays.deepEquals(expected, actual)); + } + + @Test public void testGt() throws Exception { Object[] expected = new Object[] {">", 0f, 1f}; Object[] actual = gt(literal(0), literal(1)).toArray(); @@ -167,6 +179,13 @@ public class ExpressionTest { } @Test + public void testGtExpression() throws Exception { + Object[] expected = new Object[] {">", new Object[] {"get", "hello"}, 1f}; + Object[] actual = gt(get("hello"), 1).toArray(); + assertTrue("expression should match", Arrays.deepEquals(expected, actual)); + } + + @Test public void testLt() throws Exception { Object[] expected = new Object[] {"<", 1f, 0f}; Object[] actual = lt(literal(1), literal(0)).toArray(); @@ -181,6 +200,13 @@ public class ExpressionTest { } @Test + public void testLtExpression() throws Exception { + Object[] expected = new Object[] {"<", new Object[] {"get", "hello"}, 1f}; + Object[] actual = lt(get("hello"), 1).toArray(); + assertTrue("expression should match", Arrays.deepEquals(expected, actual)); + } + + @Test public void testGte() throws Exception { Object[] expected = new Object[] {">=", 1f, 1f}; Object[] actual = gte(literal(1), literal(1)).toArray(); @@ -195,6 +221,13 @@ public class ExpressionTest { } @Test + public void testGteExpression() throws Exception { + Object[] expected = new Object[] {">=", new Object[] {"get", "hello"}, 1f}; + Object[] actual = gte(get("hello"), 1).toArray(); + assertTrue("expression should match", Arrays.deepEquals(expected, actual)); + } + + @Test public void testLte() throws Exception { Object[] expected = new Object[] {"<=", 1f, 1f}; Object[] actual = lte(literal(1), literal(1)).toArray(); @@ -202,6 +235,13 @@ public class ExpressionTest { } @Test + public void testLteExpression() throws Exception { + Object[] expected = new Object[] {"<=", new Object[] {"get", "hello"}, 1f}; + Object[] actual = lte(get("hello"), 1).toArray(); + assertTrue("expression should match", Arrays.deepEquals(expected, actual)); + } + + @Test public void testLteLiteral() throws Exception { Object[] expected = new Object[] {"<=", 1f, 1f}; Object[] actual = lte(literal(1), 1).toArray(); |