summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/maps/CoordinateRegionTest.java
blob: c37f48bf7c0d507775018ad316860830acabd2d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.mapbox.mapboxsdk.maps;

import com.mapbox.mapboxsdk.geometry.CoordinateRegion;
import com.mapbox.mapboxsdk.geometry.CoordinateSpan;
import com.mapbox.mapboxsdk.geometry.LatLng;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

public class CoordinateRegionTest {

    @Test
    public void testSanity() {
        LatLng center = new LatLng(1.2, 3.4, 5.6);
        CoordinateSpan span = new CoordinateSpan(9.8, 7.6);
        CoordinateRegion coordinateRegion = new CoordinateRegion(center, span);
        assertNotNull("coordinateRegion should not be null", coordinateRegion);
    }

    @Test
    public void testCenterConstructor() {
        LatLng center = new LatLng(1.2, 3.4, 5.6);
        CoordinateSpan span = new CoordinateSpan(9.8, 7.6);
        CoordinateRegion coordinateRegion = new CoordinateRegion(center, span);
        assertEquals("center should match", coordinateRegion.getCenter(), center);
    }

    @Test
    public void testSpanConstructor() {
        LatLng center = new LatLng(1.2, 3.4, 5.6);
        CoordinateSpan span = new CoordinateSpan(9.8, 7.6);
        CoordinateRegion coordinateRegion = new CoordinateRegion(center, span);
        assertEquals("span should match", coordinateRegion.getSpan(), span);
    }

    @Test
    public void testCenterMethod() {
        LatLng center = new LatLng(1.2, 3.4, 5.6);
        CoordinateSpan span = new CoordinateSpan(9.8, 7.6);
        CoordinateRegion coordinateRegion = new CoordinateRegion(null, span);
        coordinateRegion.setCenter(center);
        assertEquals("center should match", coordinateRegion.getCenter(), center);
    }

    @Test
    public void testSpanMethod() {
        LatLng center = new LatLng(1.2, 3.4, 5.6);
        CoordinateSpan span = new CoordinateSpan(9.8, 7.6);
        CoordinateRegion coordinateRegion = new CoordinateRegion(center, null);
        coordinateRegion.setSpan(span);
        assertEquals("span should match", coordinateRegion.getSpan(), span);
    }

}