Fixing up the tests.
- Recent change b35ab01 changed the prefix highlight colour but didn't
update the test. This fixes the test.
- ContactUtils.areObjectsEqual() method is no longer in use, so was being
removed by Proguard, causing the test to fail. The method may be useful
in the future, annotated it with @NeededForTesting.
- Some setTextWithHighlightingFactory... methods in both
DisplayNameFormatter and ContactListItemView were not being used any
longer, only by the unit tests that tested them. Proguard was therefore
removing them, causing the tests to fail.
Change-Id: I8e52a6d4dc7eac398777897b38cad4ef44d4fa7d
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index d3d8f34..f1f73ed 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -18,6 +18,7 @@
import com.android.contacts.model.AccountTypeManager;
import com.android.contacts.model.AccountWithDataSet;
+import com.android.contacts.test.NeededForTesting;
import com.android.i18n.phonenumbers.PhoneNumberUtil;
import android.content.Context;
@@ -91,6 +92,7 @@
/**
* Returns true if two objects are considered equal. Two null references are equal here.
*/
+ @NeededForTesting
public static boolean areObjectsEqual(Object a, Object b) {
return a == b || (a != null && a.equals(b));
}
diff --git a/src/com/android/contacts/format/DisplayNameFormatter.java b/src/com/android/contacts/format/DisplayNameFormatter.java
index e525217..2099c53 100644
--- a/src/com/android/contacts/format/DisplayNameFormatter.java
+++ b/src/com/android/contacts/format/DisplayNameFormatter.java
@@ -20,9 +20,6 @@
import com.android.contacts.widget.TextWithHighlightingFactory;
import android.database.CharArrayBuffer;
-import android.graphics.Typeface;
-import android.provider.ContactsContract;
-import android.text.Spannable;
import android.widget.TextView;
/**
@@ -50,10 +47,6 @@
return mAlternateNameBuffer;
}
- public void setTextWithHighlightingFactory(TextWithHighlightingFactory factory) {
- mTextWithHighlightingFactory = factory;
- }
-
public void setUnknownNameText(CharSequence unknownNameText) {
mUnknownNameText = unknownNameText;
}
diff --git a/src/com/android/contacts/list/ContactListItemView.java b/src/com/android/contacts/list/ContactListItemView.java
index 7e81dcd..414c5be 100644
--- a/src/com/android/contacts/list/ContactListItemView.java
+++ b/src/com/android/contacts/list/ContactListItemView.java
@@ -21,7 +21,6 @@
import com.android.contacts.R;
import com.android.contacts.format.DisplayNameFormatter;
import com.android.contacts.format.PrefixHighlighter;
-import com.android.contacts.widget.TextWithHighlightingFactory;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -271,10 +270,6 @@
mCallButtonClickListener = callButtonClickListener;
}
- public void setTextWithHighlightingFactory(TextWithHighlightingFactory factory) {
- mDisplayNameFormatter.setTextWithHighlightingFactory(factory);
- }
-
public void setUnknownNameText(CharSequence unknownNameText) {
mDisplayNameFormatter.setUnknownNameText(unknownNameText);
}