Home | History | Annotate | Download | only in xy
      1 /*
      2  * Copyright 2012 AndroidPlot.com
      3  *
      4  *    Licensed under the Apache License, Version 2.0 (the "License");
      5  *    you may not use this file except in compliance with the License.
      6  *    You may obtain a copy of the License at
      7  *
      8  *        http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  *    Unless required by applicable law or agreed to in writing, software
     11  *    distributed under the License is distributed on an "AS IS" BASIS,
     12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  *    See the License for the specific language governing permissions and
     14  *    limitations under the License.
     15  */
     16 
     17 package com.androidplot.xy;
     18 
     19 import org.junit.After;
     20 import org.junit.Before;
     21 import org.junit.Test;
     22 
     23 import static junit.framework.Assert.assertEquals;
     24 
     25 public class XYStepCalculatorTest {
     26     @Before
     27     public void setUp() throws Exception {
     28 
     29     }
     30 
     31     @After
     32     public void tearDown() throws Exception {
     33 
     34     }
     35 
     36     @Test
     37     public void testGetStep() throws Exception {
     38 
     39     }
     40 
     41     @Test
     42     public void testSubdivide() throws Exception {
     43         int numSegments = 10;
     44         float plotSize = 100;
     45         double minVal = 0;
     46         double maxVal = 100;
     47         XYStep step = XYStepCalculator.getStep(XYStepMode.SUBDIVIDE, plotSize, numSegments, minVal, maxVal);
     48 
     49         assertEquals(plotSize/(numSegments-1), step.getStepPix());
     50         //assertEquals(10, step.getStepVal());
     51 
     52         // make sure large values dont break anything:
     53         minVal = 1000000000;
     54         maxVal = 2000000000;
     55         step = XYStepCalculator.getStep(XYStepMode.SUBDIVIDE, plotSize, numSegments, minVal, maxVal);
     56         assertEquals(plotSize/(numSegments-1), step.getStepPix());
     57 
     58     }
     59 
     60     @Test
     61     public void testIncrementByVal() throws Exception {
     62 
     63     }
     64 
     65     @Test
     66     public void testIncrementByPixels() throws Exception {
     67 
     68     }
     69 }
     70