Skip to content

Commit

Permalink
Fixed a bug in how RealmResults are created on the C++ level. See #453
Browse files Browse the repository at this point in the history
  • Loading branch information
kneth committed Oct 6, 2014
1 parent b16fb57 commit 885ded0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.70.3 ()
* Upgrading to core 0.84.0
* Fixed bug in RealmResults: https://github.com/realm/realm-java/issues/453

0.70.2 (03 Oct 2014)
* Adding RealmQuery.count() method
Expand Down
2 changes: 1 addition & 1 deletion realm-jni/src/io_realm_internal_tableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ JNIEXPORT jlong JNICALL Java_io_realm_internal_TableView_nativeWhere

try {
TableView* tv = TV(nativeViewPtr);
Query query = tv->get_parent().where().tableview(*tv);
Query query = tv->get_parent().where(tv);
TableQuery* queryPtr = new TableQuery(query);
return reinterpret_cast<jlong>(queryPtr);
} CATCH_STD()
Expand Down
7 changes: 7 additions & 0 deletions realm/src/androidTest/java/io/realm/RealmResultsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,14 @@ public void testSort() {
RealmResults<AllTypes> resultList = testRealm.where(AllTypes.class).findAll();
RealmResults<AllTypes> sortedList = resultList.sort("columnLong", RealmResults.SORT_ORDER_DECENDING);
assertEquals("Should have same size", resultList.size(), sortedList.size());
assertEquals(TEST_DATA_SIZE, sortedList.size());
assertEquals("First excepted to be last", resultList.first().getColumnString(), sortedList.last().getColumnString());

RealmResults<AllTypes> reverseList = sortedList.sort("columnLong", RealmResults.SORT_ORDER_ASCENDING);
assertEquals(TEST_DATA_SIZE, reverseList.size());

RealmResults<AllTypes> reserveSortedList = reverseList.sort("columnLong", RealmResults.SORT_ORDER_DECENDING);
assertEquals(TEST_DATA_SIZE, reserveSortedList.size());
}

public void testCount() {
Expand Down

0 comments on commit 885ded0

Please sign in to comment.