[android] - Marker test coverage
This commit is contained in:
@@ -6,9 +6,10 @@ import com.mapbox.mapboxsdk.maps.MapView;
|
||||
|
||||
/**
|
||||
* Icon is the visual representation of a {@link Marker} on a {@link MapView}.
|
||||
*
|
||||
* @see Marker
|
||||
*/
|
||||
public final class Icon {
|
||||
public class Icon {
|
||||
private Bitmap mBitmap;
|
||||
private String mId;
|
||||
|
||||
@@ -39,8 +40,13 @@ public final class Icon {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = mBitmap.hashCode();
|
||||
result = 31 * result + mId.hashCode();
|
||||
int result = 0;
|
||||
if (mBitmap != null) {
|
||||
result = mBitmap.hashCode();
|
||||
}
|
||||
if (mId != null) {
|
||||
result = 31 * result + mId.hashCode();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public final class MarkerOptions extends BaseMarkerOptions<Marker, MarkerOptions
|
||||
marker = new Marker();
|
||||
position((LatLng) in.readParcelable(LatLng.class.getClassLoader()));
|
||||
snippet(in.readString());
|
||||
|
||||
title(in.readString());
|
||||
if(in.readByte()!=0){
|
||||
// this means we have an icon
|
||||
String iconId = in.readString();
|
||||
@@ -47,7 +47,6 @@ public final class MarkerOptions extends BaseMarkerOptions<Marker, MarkerOptions
|
||||
Icon icon = new Icon(iconId, iconBitmap);
|
||||
icon(icon);
|
||||
}
|
||||
title(in.readString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,13 +63,13 @@ public final class MarkerOptions extends BaseMarkerOptions<Marker, MarkerOptions
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeParcelable(getPosition(), flags);
|
||||
out.writeString(getSnippet());
|
||||
out.writeString(getTitle());
|
||||
Icon icon = getIcon();
|
||||
out.writeByte((byte) (icon != null ? 1 : 0));
|
||||
if (icon != null) {
|
||||
out.writeString(getIcon().getId());
|
||||
out.writeParcelable(getIcon().getBitmap(), flags);
|
||||
}
|
||||
out.writeString(getTitle());
|
||||
}
|
||||
|
||||
private Marker marker;
|
||||
|
||||
Reference in New Issue
Block a user