mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-03 01:53:05 +02:00
Share: removed Google's chart generator
This commit is contained in:
-75
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.util;
|
||||
|
||||
import com.google.android.apps.mytracks.content.Track;
|
||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* Tests for the Chart URL generator.
|
||||
*
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
public class ChartURLGeneratorTest extends TestCase {
|
||||
|
||||
public void testgetChartUrl() {
|
||||
Vector<Double> distances = new Vector<Double>();
|
||||
Vector<Double> elevations = new Vector<Double>();
|
||||
Track t = new Track();
|
||||
TripStatistics stats = t.getTripStatistics();
|
||||
stats.setMinElevation(0);
|
||||
stats.setMaxElevation(2000);
|
||||
stats.setTotalDistance(100);
|
||||
|
||||
distances.add(0.0);
|
||||
elevations.add(10.0);
|
||||
|
||||
distances.add(10.0);
|
||||
elevations.add(300.0);
|
||||
|
||||
distances.add(20.0);
|
||||
elevations.add(800.0);
|
||||
|
||||
distances.add(50.0);
|
||||
elevations.add(1900.0);
|
||||
|
||||
distances.add(75.0);
|
||||
elevations.add(1200.0);
|
||||
|
||||
distances.add(90.0);
|
||||
elevations.add(700.0);
|
||||
|
||||
distances.add(100.0);
|
||||
elevations.add(70.0);
|
||||
|
||||
String chart = ChartURLGenerator.getChartUrl(distances,
|
||||
elevations,
|
||||
t,
|
||||
"Title",
|
||||
true);
|
||||
|
||||
assertEquals(
|
||||
"http://chart.apis.google.com/chart?&chs=600x350&cht=lxy&"
|
||||
+ "chtt=Title&chxt=x,y&chxr=0,0,0,0|1,0.0,2100.0,300&chco=009A00&"
|
||||
+ "chm=B,00AA00,0,0,0&chg=100000,14.285714285714286,1,0&"
|
||||
+ "chd=e:AAGZMzf.v.5l..,ATJJYY55kkVVCI",
|
||||
chart);
|
||||
}
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.util;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* A unit test for {@link ChartsExtendedEncoder}.
|
||||
*
|
||||
* @author Bartlomiej Niechwiej
|
||||
*/
|
||||
public class ChartsExtendedEncoderTest extends TestCase {
|
||||
|
||||
public void testGetEncodedValue_validArguments() {
|
||||
// Valid arguments.
|
||||
assertEquals("AK", ChartsExtendedEncoder.getEncodedValue(10));
|
||||
assertEquals("JO", ChartsExtendedEncoder.getEncodedValue(590));
|
||||
assertEquals("AA", ChartsExtendedEncoder.getEncodedValue(0));
|
||||
// 64^2 = 4096.
|
||||
assertEquals("..", ChartsExtendedEncoder.getEncodedValue(4095));
|
||||
}
|
||||
|
||||
public void testGetEncodedValue_invalidArguments() {
|
||||
// Invalid arguments.
|
||||
assertEquals("__", ChartsExtendedEncoder.getEncodedValue(4096));
|
||||
assertEquals("__", ChartsExtendedEncoder.getEncodedValue(1234564096));
|
||||
assertEquals("__", ChartsExtendedEncoder.getEncodedValue(-10));
|
||||
assertEquals("__", ChartsExtendedEncoder.getEncodedValue(-12324435));
|
||||
}
|
||||
|
||||
public void testGetSeparator() {
|
||||
assertEquals(",", ChartsExtendedEncoder.getSeparator());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user