Merge "Add case sensitive sort to AccessPoint compareTo." into oc-dr1-dev
am: 6a62328517
Change-Id: I01cd4dcc90090d82d93d9b92d446d4a2d97e7aa0
This commit is contained in:
@@ -322,8 +322,15 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
|||||||
if (difference != 0) {
|
if (difference != 0) {
|
||||||
return difference;
|
return difference;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort by ssid.
|
// Sort by ssid.
|
||||||
return getSsidStr().compareToIgnoreCase(other.getSsidStr());
|
difference = getSsidStr().compareToIgnoreCase(other.getSsidStr());
|
||||||
|
if (difference != 0) {
|
||||||
|
return difference;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do a case sensitive comparison to distinguish SSIDs that differ in case only
|
||||||
|
return getSsidStr().compareTo(other.getSsidStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -168,6 +168,21 @@ public class AccessPointTest {
|
|||||||
assertSortingWorks(firstAp, secondAp);
|
assertSortingWorks(firstAp, secondAp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCompareTo_GivesSsidCasePrecendenceAfterAlphabetical() {
|
||||||
|
|
||||||
|
final String firstName = "aaAaaa";
|
||||||
|
final String secondName = "aaaaaa";
|
||||||
|
final String thirdName = "BBBBBB";
|
||||||
|
|
||||||
|
AccessPoint firstAp = new TestAccessPointBuilder(mContext).setSsid(firstName).build();
|
||||||
|
AccessPoint secondAp = new TestAccessPointBuilder(mContext).setSsid(secondName).build();
|
||||||
|
AccessPoint thirdAp = new TestAccessPointBuilder(mContext).setSsid(thirdName).build();
|
||||||
|
|
||||||
|
assertSortingWorks(firstAp, secondAp);
|
||||||
|
assertSortingWorks(secondAp, thirdAp);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCompareTo_AllSortingRulesCombined() {
|
public void testCompareTo_AllSortingRulesCombined() {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user