Skip to content

Commit

Permalink
test: do not rely on Card.clone().id == Card.id
Browse files Browse the repository at this point in the history
for some reason with the update from anki 24.06.2 to 24.06.3 Card.clone()
no longer generates a stable Card.id

Luckily, this is only ever used in test code, and this is the only
place the id is ever compared so avoiding it functions well enough
  • Loading branch information
mikehardy committed Aug 21, 2024
1 parent 548cd92 commit 040b71a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions AnkiDroid/src/test/java/com/ichi2/libanki/SchedulerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ open class SchedulerTest : JvmTest() {
note.setItem("Front", "one")
col.addNote(note)
var c = note.cards()[0]
val orig = c.clone()
val origId = c.id
val note2 = col.newNote()
note2.setItem("Front", "two")
col.addNote(note2)
Expand Down Expand Up @@ -878,7 +878,7 @@ open class SchedulerTest : JvmTest() {

// the other card should appear again
c = col.sched.card!!
Assert.assertEquals(orig.id, c.id)
Assert.assertEquals(origId, c.id)

// emptying the filtered deck should restore card
col.sched.emptyDyn(did)
Expand Down

0 comments on commit 040b71a

Please sign in to comment.