Skip to content

Commit 492b276

Browse files
CodingDougSUPERCILEX
authored andcommitted
Fixed a bug and added another test that verifies it.
1 parent 6babf71 commit 492b276

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

database/src/androidTest/java/com/firebase/ui/database/FirebaseArrayTest.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public Boolean call() throws Exception {
112112
}
113113

114114
@Test
115-
public void testChangePriorities() throws Exception {
115+
public void testChangePriorityBackToFront() throws Exception {
116116
runAndWaitUntil(mArray, new Runnable() {
117117
public void run() {
118118
mArray.getItem(2).getRef().setPriority(0.5);
@@ -123,4 +123,17 @@ public Boolean call() throws Exception {
123123
}
124124
});
125125
}
126+
127+
@Test
128+
public void testChangePriorityFrontToBack() throws Exception {
129+
runAndWaitUntil(mArray, new Runnable() {
130+
public void run() {
131+
mArray.getItem(0).getRef().setPriority(4);
132+
}
133+
}, new Callable<Boolean>() {
134+
public Boolean call() throws Exception {
135+
return isValuesEqual(mArray, new int[]{2, 3, 1});
136+
}
137+
});
138+
}
126139
}

database/src/main/java/com/firebase/ui/database/FirebaseArray.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,17 @@ public void setOnChangedListener(OnChangedListener listener) {
120120
mListener = listener;
121121
}
122122

123-
protected void notifyChangedListeners(OnChangedListener.EventType type, int index) {
123+
void notifyChangedListeners(OnChangedListener.EventType type, int index) {
124124
notifyChangedListeners(type, index, -1);
125125
}
126126

127-
protected void notifyChangedListeners(OnChangedListener.EventType type, int index, int oldIndex) {
127+
void notifyChangedListeners(OnChangedListener.EventType type, int index, int oldIndex) {
128128
if (mListener != null) {
129129
mListener.onChildChanged(type, index, oldIndex);
130130
}
131131
}
132132

133-
protected void notifyCancelledListeners(DatabaseError databaseError) {
133+
void notifyCancelledListeners(DatabaseError databaseError) {
134134
if (mListener != null) {
135135
mListener.onCancelled(databaseError);
136136
}

0 commit comments

Comments
 (0)