forked from upstream-mirrors/OpenTracks
Rename to Google Spreadsheets.
This commit is contained in:
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012 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.io.docs;
|
||||
|
||||
import android.test.AndroidTestCase;
|
||||
|
||||
/**
|
||||
* Tests {@link SendDocsUtils}.
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class SendDocsUtilsTest extends AndroidTestCase {
|
||||
|
||||
/**
|
||||
* Tests {@link SendDocsUtils#getDistance(double, boolean)} with metric units.
|
||||
*/
|
||||
public void testGetDistance_metric() {
|
||||
assertEquals("1.22", SendDocsUtils.getDistance(1222.3, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link SendDocsUtils#getDistance(double, boolean)} with imperial
|
||||
* units.
|
||||
*/
|
||||
public void testGetDistance_imperial() {
|
||||
assertEquals("0.76", SendDocsUtils.getDistance(1222.3, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link SendDocsUtils#getSpeed(double, boolean)} with metric units.
|
||||
*/
|
||||
public void testGetSpeed_metric() {
|
||||
assertEquals("15.55", SendDocsUtils.getSpeed(4.32, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link SendDocsUtils#getSpeed(double, boolean)} with imperial units.
|
||||
*/
|
||||
public void testGetSpeed_imperial() {
|
||||
assertEquals("9.66", SendDocsUtils.getSpeed(4.32, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link SendDocsUtils#getElevation(double, boolean)} with metric
|
||||
* units.
|
||||
*/
|
||||
public void testGetElevation_metric() {
|
||||
assertEquals("3", SendDocsUtils.getElevation(3.456, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link SendDocsUtils#getElevation(double, boolean)} with imperial
|
||||
* units.
|
||||
*/
|
||||
public void testGetElevation_imperial() {
|
||||
assertEquals("11", SendDocsUtils.getElevation(3.456, false));
|
||||
}
|
||||
}
|
||||
+14
-14
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
package com.google.android.apps.mytracks.io.fusiontables;
|
||||
|
||||
import com.google.android.apps.mytracks.io.docs.SendDocsActivity;
|
||||
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
||||
import com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity;
|
||||
import com.google.android.apps.mytracks.io.spreadsheets.SendSpreadsheetsActivity;
|
||||
|
||||
import android.test.AndroidTestCase;
|
||||
|
||||
@@ -41,10 +41,10 @@ public class SendFusionTablesActivityTest extends AndroidTestCase {
|
||||
/**
|
||||
* Tests the method
|
||||
* {@link SendFusionTablesActivity#getNextClass(SendRequest, boolean)}. Sets
|
||||
* the flags of "sendDocs" and "cancel" to false and false.
|
||||
* the flags of "sendSpreadsheets" and "cancel" to false and false.
|
||||
*/
|
||||
public void testGetNextClass_notCancelNotSendDocs() {
|
||||
sendRequest.setSendDocs(false);
|
||||
public void testGetNextClass_notCancelNotSendSpreadsheets() {
|
||||
sendRequest.setSendSpreadsheets(false);
|
||||
Class<?> next = sendFusionTablesActivity.getNextClass(sendRequest, false);
|
||||
assertEquals(UploadResultActivity.class, next);
|
||||
}
|
||||
@@ -52,21 +52,21 @@ public class SendFusionTablesActivityTest extends AndroidTestCase {
|
||||
/**
|
||||
* Tests the method
|
||||
* {@link SendFusionTablesActivity#getNextClass(SendRequest, boolean)}. Sets
|
||||
* the flags of "sendDocs" and "cancel" to true and false.
|
||||
* the flags of "sendSpreadsheets" and "cancel" to true and false.
|
||||
*/
|
||||
public void testGetNextClass_notCancelSendDocs() {
|
||||
sendRequest.setSendDocs(true);
|
||||
public void testGetNextClass_notCancelSendSpreadsheets() {
|
||||
sendRequest.setSendSpreadsheets(true);
|
||||
Class<?> next = sendFusionTablesActivity.getNextClass(sendRequest, false);
|
||||
assertEquals(SendDocsActivity.class, next);
|
||||
assertEquals(SendSpreadsheetsActivity.class, next);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the method
|
||||
* {@link SendFusionTablesActivity#getNextClass(SendRequest,boolean)}. Sets
|
||||
* the flags of "sendDocs" and "cancel" to true and true.
|
||||
* the flags of "sendSpreadsheets" and "cancel" to true and true.
|
||||
*/
|
||||
public void testGetNextClass_cancelSendDocs() {
|
||||
sendRequest.setSendDocs(true);
|
||||
public void testGetNextClass_cancelSendSpreadsheets() {
|
||||
sendRequest.setSendSpreadsheets(true);
|
||||
Class<?> next = sendFusionTablesActivity.getNextClass(sendRequest, true);
|
||||
assertEquals(UploadResultActivity.class, next);
|
||||
}
|
||||
@@ -74,10 +74,10 @@ public class SendFusionTablesActivityTest extends AndroidTestCase {
|
||||
/**
|
||||
* Tests the method
|
||||
* {@link SendFusionTablesActivity#getNextClass(SendRequest,boolean)}. Sets
|
||||
* the flags of "sendDocs" and "cancel" to false and true.
|
||||
* the flags of "sendSpreadsheets" and "cancel" to false and true.
|
||||
*/
|
||||
public void testGetNextClass_cancelNotSendDocs() {
|
||||
sendRequest.setSendDocs(false);
|
||||
public void testGetNextClass_cancelNotSendSpreadsheets() {
|
||||
sendRequest.setSendSpreadsheets(false);
|
||||
Class<?> next = sendFusionTablesActivity.getNextClass(sendRequest, true);
|
||||
assertEquals(UploadResultActivity.class, next);
|
||||
}
|
||||
|
||||
+12
-12
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package com.google.android.apps.mytracks.io.maps;
|
||||
|
||||
import com.google.android.apps.mytracks.io.docs.SendDocsActivity;
|
||||
import com.google.android.apps.mytracks.io.fusiontables.SendFusionTablesActivity;
|
||||
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
||||
import com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity;
|
||||
import com.google.android.apps.mytracks.io.spreadsheets.SendSpreadsheetsActivity;
|
||||
|
||||
import android.test.AndroidTestCase;
|
||||
|
||||
@@ -42,11 +42,11 @@ public class SendMapsActivityTest extends AndroidTestCase {
|
||||
/**
|
||||
* Tests the method
|
||||
* {@link SendMapsActivity#getNextClass(SendRequest, boolean)}. Sets the flags
|
||||
* of "sendFusionTables","sendDocs" and "cancel" to true, true and false.
|
||||
* of "sendFusionTables","sendSpreadsheets" and "cancel" to true, true and false.
|
||||
*/
|
||||
public void testGetNextClass_notCancelSendFusionTables() {
|
||||
sendRequest.setSendFusionTables(true);
|
||||
sendRequest.setSendDocs(true);
|
||||
sendRequest.setSendSpreadsheets(true);
|
||||
Class<?> next = sendMapsActivity.getNextClass(sendRequest, false);
|
||||
assertEquals(SendFusionTablesActivity.class, next);
|
||||
}
|
||||
@@ -54,23 +54,23 @@ public class SendMapsActivityTest extends AndroidTestCase {
|
||||
/**
|
||||
* Tests the method
|
||||
* {@link SendMapsActivity#getNextClass(SendRequest, boolean)}. Sets the flags
|
||||
* of "sendFusionTables","sendDocs" and "cancel" to false, true and false.
|
||||
* of "sendFusionTables","sendSpreadsheets" and "cancel" to false, true and false.
|
||||
*/
|
||||
public void testGetNextClass_notCancelSendDocs() {
|
||||
public void testGetNextClass_notCancelSendSpreadsheets() {
|
||||
sendRequest.setSendFusionTables(false);
|
||||
sendRequest.setSendDocs(true);
|
||||
sendRequest.setSendSpreadsheets(true);
|
||||
Class<?> next = sendMapsActivity.getNextClass(sendRequest, false);
|
||||
assertEquals(SendDocsActivity.class, next);
|
||||
assertEquals(SendSpreadsheetsActivity.class, next);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the method
|
||||
* {@link SendMapsActivity#getNextClass(SendRequest, boolean)}. Sets the flags
|
||||
* of "sendFusionTables","sendDocs" and "cancel" to false, false and false.
|
||||
* of "sendFusionTables","sendSpreadsheets" and "cancel" to false, false and false.
|
||||
*/
|
||||
public void testGetNextClass_notCancelNotSend() {
|
||||
sendRequest.setSendFusionTables(false);
|
||||
sendRequest.setSendDocs(false);
|
||||
sendRequest.setSendSpreadsheets(false);
|
||||
Class<?> next = sendMapsActivity.getNextClass(sendRequest, false);
|
||||
assertEquals(UploadResultActivity.class, next);
|
||||
}
|
||||
@@ -78,11 +78,11 @@ public class SendMapsActivityTest extends AndroidTestCase {
|
||||
/**
|
||||
* Tests the method
|
||||
* {@link SendMapsActivity#getNextClass(SendRequest, boolean)}. Sets the flags
|
||||
* of "sendFusionTables","sendDocs" and "cancel" to true, true and true.
|
||||
* of "sendFusionTables","sendSpreadsheets" and "cancel" to true, true and true.
|
||||
*/
|
||||
public void testGetNextClass_cancelSendDocs() {
|
||||
public void testGetNextClass_cancelSendSpreadsheets() {
|
||||
sendRequest.setSendFusionTables(true);
|
||||
sendRequest.setSendDocs(true);
|
||||
sendRequest.setSendSpreadsheets(true);
|
||||
Class<?> next = sendMapsActivity.getNextClass(sendRequest, true);
|
||||
assertEquals(UploadResultActivity.class, next);
|
||||
}
|
||||
|
||||
+24
-24
@@ -59,13 +59,13 @@ public class SendRequestTest extends AndroidTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the method {@link SendRequest#isSendDocs()}. The value should be set
|
||||
* Tests the method {@link SendRequest#isSendSpreadsheets()}. The value should be set
|
||||
* to false which is its default value when it is initialed in setup method.
|
||||
*/
|
||||
public void testIsSendDocs() {
|
||||
assertEquals(false, sendRequest.isSendDocs());
|
||||
sendRequest.setSendDocs(true);
|
||||
assertEquals(true, sendRequest.isSendDocs());
|
||||
public void testIsSendSpreadsheets() {
|
||||
assertEquals(false, sendRequest.isSendSpreadsheets());
|
||||
sendRequest.setSendSpreadsheets(true);
|
||||
assertEquals(true, sendRequest.isSendSpreadsheets());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,14 +122,14 @@ public class SendRequestTest extends AndroidTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the method {@link SendRequest#isDocsSuccess()}. The value should be
|
||||
* Tests the method {@link SendRequest#isSpreadsheetsSuccess()}. The value should be
|
||||
* set to false which is its default value when it is initialed in setup
|
||||
* method.
|
||||
*/
|
||||
public void testIsDocsSuccess() {
|
||||
assertEquals(false, sendRequest.isDocsSuccess());
|
||||
sendRequest.setDocsSuccess(true);
|
||||
assertEquals(true, sendRequest.isDocsSuccess());
|
||||
public void testIsSpreadsheetsSuccess() {
|
||||
assertEquals(false, sendRequest.isSpreadsheetsSuccess());
|
||||
sendRequest.setSpreadsheetSuccess(true);
|
||||
assertEquals(true, sendRequest.isSpreadsheetsSuccess());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,14 +163,14 @@ public class SendRequestTest extends AndroidTestCase {
|
||||
assertTrue(sendRequest.isSendDrive());
|
||||
assertTrue(sendRequest.isSendMaps());
|
||||
assertTrue(sendRequest.isSendFusionTables());
|
||||
assertTrue(sendRequest.isSendDocs());
|
||||
assertTrue(sendRequest.isSendSpreadsheets());
|
||||
assertTrue(sendRequest.isNewMap());
|
||||
assertEquals(account, sendRequest.getAccount());
|
||||
assertEquals(MAPID, sendRequest.getMapId());
|
||||
assertTrue(sendRequest.isDriveSuccess());
|
||||
assertTrue(sendRequest.isMapsSuccess());
|
||||
assertTrue(sendRequest.isFusionTablesSuccess());
|
||||
assertTrue(sendRequest.isDocsSuccess());
|
||||
assertTrue(sendRequest.isSpreadsheetsSuccess());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -204,14 +204,14 @@ public class SendRequestTest extends AndroidTestCase {
|
||||
assertFalse(sendRequest.isSendDrive());
|
||||
assertFalse(sendRequest.isSendMaps());
|
||||
assertFalse(sendRequest.isSendFusionTables());
|
||||
assertFalse(sendRequest.isSendDocs());
|
||||
assertFalse(sendRequest.isSendSpreadsheets());
|
||||
assertFalse(sendRequest.isNewMap());
|
||||
assertEquals(account, sendRequest.getAccount());
|
||||
assertEquals(MAPID, sendRequest.getMapId());
|
||||
assertFalse(sendRequest.isDriveSuccess());
|
||||
assertFalse(sendRequest.isMapsSuccess());
|
||||
assertFalse(sendRequest.isFusionTablesSuccess());
|
||||
assertFalse(sendRequest.isDocsSuccess());
|
||||
assertFalse(sendRequest.isSpreadsheetsSuccess());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,14 +230,14 @@ public class SendRequestTest extends AndroidTestCase {
|
||||
boolean sendDrive = parcel.readByte() == 1;
|
||||
boolean sendMaps = parcel.readByte() == 1;
|
||||
boolean sendFusionTables = parcel.readByte() == 1;
|
||||
boolean sendDocs = parcel.readByte() == 1;
|
||||
boolean sendSpreadsheets = parcel.readByte() == 1;
|
||||
boolean newMap = parcel.readByte() == 1;
|
||||
Parcelable account = parcel.readParcelable(null);
|
||||
String mapId = parcel.readString();
|
||||
boolean driveSuccess = parcel.readByte() == 1;
|
||||
boolean mapsSuccess = parcel.readByte() == 1;
|
||||
boolean fusionTablesSuccess = parcel.readByte() == 1;
|
||||
boolean docsSuccess = parcel.readByte() == 1;
|
||||
boolean spreadsheetsSuccess = parcel.readByte() == 1;
|
||||
assertEquals(1, trackId);
|
||||
assertNull(sharingAppPackageName);
|
||||
assertNull(sharingAppClassName);
|
||||
@@ -245,14 +245,14 @@ public class SendRequestTest extends AndroidTestCase {
|
||||
assertFalse(sendDrive);
|
||||
assertFalse(sendMaps);
|
||||
assertFalse(sendFusionTables);
|
||||
assertFalse(sendDocs);
|
||||
assertFalse(sendSpreadsheets);
|
||||
assertFalse(newMap);
|
||||
assertNull(account);
|
||||
assertNull(mapId);
|
||||
assertFalse(driveSuccess);
|
||||
assertFalse(mapsSuccess);
|
||||
assertFalse(fusionTablesSuccess);
|
||||
assertFalse(docsSuccess);
|
||||
assertFalse(spreadsheetsSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,7 +266,7 @@ public class SendRequestTest extends AndroidTestCase {
|
||||
sendRequest.setSendDrive(true);
|
||||
sendRequest.setSendMaps(true);
|
||||
sendRequest.setSendFusionTables(true);
|
||||
sendRequest.setSendDocs(true);
|
||||
sendRequest.setSendSpreadsheets(true);
|
||||
sendRequest.setNewMap(true);
|
||||
Account accountNew = new Account(ACCOUNTNAME + "2", ACCOUNTYPE + "2");
|
||||
sendRequest.setAccount(accountNew);
|
||||
@@ -274,7 +274,7 @@ public class SendRequestTest extends AndroidTestCase {
|
||||
sendRequest.setMapsSuccess(true);
|
||||
sendRequest.setDriveSuccess(true);
|
||||
sendRequest.setFusionTablesSuccess(true);
|
||||
sendRequest.setDocsSuccess(true);
|
||||
sendRequest.setSpreadsheetSuccess(true);
|
||||
Parcel parcel = Parcel.obtain();
|
||||
parcel.setDataPosition(0);
|
||||
sendRequest.writeToParcel(parcel, 1);
|
||||
@@ -286,14 +286,14 @@ public class SendRequestTest extends AndroidTestCase {
|
||||
boolean sendDrive = parcel.readByte() == 1;
|
||||
boolean sendMaps = parcel.readByte() == 1;
|
||||
boolean sendFusionTables = parcel.readByte() == 1;
|
||||
boolean sendDocs = parcel.readByte() == 1;
|
||||
boolean sendSpreadsheets = parcel.readByte() == 1;
|
||||
boolean newMap = parcel.readByte() == 1;
|
||||
Parcelable account = parcel.readParcelable(null);
|
||||
String mapId = parcel.readString();
|
||||
boolean driveSuccess = parcel.readByte() == 1;
|
||||
boolean mapsSuccess = parcel.readByte() == 1;
|
||||
boolean fusionTablesSuccess = parcel.readByte() == 1;
|
||||
boolean docsSuccess = parcel.readByte() == 1;
|
||||
boolean spreadsheetsSuccess = parcel.readByte() == 1;
|
||||
assertEquals(4, trackId);
|
||||
assertEquals("package", sharingAppPackageName);
|
||||
assertEquals("class", sharingAppClassName);
|
||||
@@ -301,13 +301,13 @@ public class SendRequestTest extends AndroidTestCase {
|
||||
assertTrue(sendDrive);
|
||||
assertTrue(sendMaps);
|
||||
assertTrue(sendFusionTables);
|
||||
assertTrue(sendDocs);
|
||||
assertTrue(sendSpreadsheets);
|
||||
assertTrue(newMap);
|
||||
assertEquals(accountNew, account);
|
||||
assertEquals(MAPID, mapId);
|
||||
assertTrue(driveSuccess);
|
||||
assertTrue(mapsSuccess);
|
||||
assertTrue(fusionTablesSuccess);
|
||||
assertTrue(docsSuccess);
|
||||
assertTrue(spreadsheetsSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
+18
-18
@@ -38,10 +38,10 @@ public class UploadResultActivityTest extends
|
||||
private TextView successFooter;
|
||||
private LinearLayout mapsResult;
|
||||
private LinearLayout fusionTablesResult;
|
||||
private LinearLayout docsResult;
|
||||
private LinearLayout spreadsheetsResult;
|
||||
private ImageView mapsResultIcon;
|
||||
private ImageView fusionTablesResultIcon;
|
||||
private ImageView docsResultIcon;
|
||||
private ImageView spreadsheetsResultIcon;
|
||||
|
||||
private String successTitle;
|
||||
private String errorTitle;
|
||||
@@ -64,11 +64,11 @@ public class UploadResultActivityTest extends
|
||||
|
||||
assertEquals(View.VISIBLE, mapsResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, fusionTablesResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, docsResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, spreadsheetsResult.getVisibility());
|
||||
|
||||
assertEquals(successTitle, mapsResultIcon.getContentDescription());
|
||||
assertEquals(successTitle, fusionTablesResultIcon.getContentDescription());
|
||||
assertEquals(successTitle, docsResultIcon.getContentDescription());
|
||||
assertEquals(successTitle, spreadsheetsResultIcon.getContentDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,19 +83,19 @@ public class UploadResultActivityTest extends
|
||||
|
||||
assertEquals(View.VISIBLE, mapsResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, fusionTablesResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, docsResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, spreadsheetsResult.getVisibility());
|
||||
|
||||
assertEquals(errorTitle, mapsResultIcon.getContentDescription());
|
||||
assertEquals(errorTitle, fusionTablesResultIcon.getContentDescription());
|
||||
assertEquals(errorTitle, docsResultIcon.getContentDescription());
|
||||
assertEquals(errorTitle, spreadsheetsResultIcon.getContentDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the display of dialog when match following items:
|
||||
* <ul>
|
||||
* <li>Only send to Maps and Docs.</li>
|
||||
* <li>Only send to Maps and Spreadsheets.</li>
|
||||
* <li>Send to Maps successful.</li>
|
||||
* <li>Send to Docs failed.</li>
|
||||
* <li>Send to Spreadsheets failed.</li>
|
||||
* </ul>
|
||||
*/
|
||||
public void testPartialSuccess() {
|
||||
@@ -105,10 +105,10 @@ public class UploadResultActivityTest extends
|
||||
|
||||
assertEquals(View.VISIBLE, mapsResult.getVisibility());
|
||||
assertEquals(View.GONE, fusionTablesResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, docsResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, spreadsheetsResult.getVisibility());
|
||||
|
||||
assertEquals(successTitle, mapsResultIcon.getContentDescription());
|
||||
assertEquals(errorTitle, docsResultIcon.getContentDescription());
|
||||
assertEquals(errorTitle, spreadsheetsResultIcon.getContentDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,21 +116,21 @@ public class UploadResultActivityTest extends
|
||||
*
|
||||
* @param isSendMaps
|
||||
* @param isSendFusionTables
|
||||
* @param isSendDocs
|
||||
* @param isSendSpreadsheets
|
||||
* @param isMapsSuccess
|
||||
* @param isFusionTablesSuccess
|
||||
* @param isDocsSuccess
|
||||
* @param isSpreadsheetSuccess
|
||||
*/
|
||||
private void initialActivity(boolean isSendMaps, boolean isSendFusionTables, boolean isSendDocs,
|
||||
boolean isMapsSuccess, boolean isFusionTablesSuccess, boolean isDocsSuccess) {
|
||||
private void initialActivity(boolean isSendMaps, boolean isSendFusionTables, boolean isSendSpreadsheets,
|
||||
boolean isMapsSuccess, boolean isFusionTablesSuccess, boolean isSpreadsheetSuccess) {
|
||||
Intent intent = new Intent();
|
||||
SendRequest sendRequest = new SendRequest(1L);
|
||||
sendRequest.setSendMaps(isSendMaps);
|
||||
sendRequest.setSendFusionTables(isSendFusionTables);
|
||||
sendRequest.setSendDocs(isSendDocs);
|
||||
sendRequest.setSendSpreadsheets(isSendSpreadsheets);
|
||||
sendRequest.setMapsSuccess(isMapsSuccess);
|
||||
sendRequest.setFusionTablesSuccess(isFusionTablesSuccess);
|
||||
sendRequest.setDocsSuccess(isDocsSuccess);
|
||||
sendRequest.setSpreadsheetSuccess(isSpreadsheetSuccess);
|
||||
intent.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
||||
setActivityIntent(intent);
|
||||
uploadResultActivity = this.getActivity();
|
||||
@@ -149,11 +149,11 @@ public class UploadResultActivityTest extends
|
||||
|
||||
mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result);
|
||||
fusionTablesResult = (LinearLayout) view.findViewById(R.id.upload_result_fusion_tables_result);
|
||||
docsResult = (LinearLayout) view.findViewById(R.id.upload_result_docs_result);
|
||||
spreadsheetsResult = (LinearLayout) view.findViewById(R.id.upload_result_spreadsheets_result);
|
||||
|
||||
mapsResultIcon = (ImageView) view.findViewById(R.id.upload_result_maps_result_icon);
|
||||
fusionTablesResultIcon = (ImageView) view
|
||||
.findViewById(R.id.upload_result_fusion_tables_result_icon);
|
||||
docsResultIcon = (ImageView) view.findViewById(R.id.upload_result_docs_result_icon);
|
||||
spreadsheetsResultIcon = (ImageView) view.findViewById(R.id.upload_result_spreadsheets_result_icon);
|
||||
}
|
||||
}
|
||||
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2012 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.io.spreadsheets;
|
||||
|
||||
import com.google.android.apps.mytracks.io.spreadsheets.SendSpreadsheetsUtils;
|
||||
|
||||
import android.test.AndroidTestCase;
|
||||
|
||||
/**
|
||||
* Tests {@link SendSpreadsheetsUtils}.
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class SendSpreadsheetsUtilsTest extends AndroidTestCase {
|
||||
|
||||
/**
|
||||
* Tests {@link SendSpreadsheetsUtils#getDistance(double, boolean)} with metric units.
|
||||
*/
|
||||
public void testGetDistance_metric() {
|
||||
assertEquals("1.22", SendSpreadsheetsUtils.getDistance(1222.3, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link SendSpreadsheetsUtils#getDistance(double, boolean)} with imperial
|
||||
* units.
|
||||
*/
|
||||
public void testGetDistance_imperial() {
|
||||
assertEquals("0.76", SendSpreadsheetsUtils.getDistance(1222.3, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link SendSpreadsheetsUtils#getSpeed(double, boolean)} with metric units.
|
||||
*/
|
||||
public void testGetSpeed_metric() {
|
||||
assertEquals("15.55", SendSpreadsheetsUtils.getSpeed(4.32, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link SendSpreadsheetsUtils#getSpeed(double, boolean)} with imperial units.
|
||||
*/
|
||||
public void testGetSpeed_imperial() {
|
||||
assertEquals("9.66", SendSpreadsheetsUtils.getSpeed(4.32, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link SendSpreadsheetsUtils#getElevation(double, boolean)} with metric
|
||||
* units.
|
||||
*/
|
||||
public void testGetElevation_metric() {
|
||||
assertEquals("3", SendSpreadsheetsUtils.getElevation(3.456, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link SendSpreadsheetsUtils#getElevation(double, boolean)} with imperial
|
||||
* units.
|
||||
*/
|
||||
public void testGetElevation_imperial() {
|
||||
assertEquals("11", SendSpreadsheetsUtils.getElevation(3.456, false));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user