use of com.ichi2.libanki.Sound in project AnkiChinaAndroid by ankichinateam.
the class CollectionTest method test_furigana.
@Test
@Ignore("Pending port of media search from Rust code")
public void test_furigana() {
Collection col = getCol();
Models mm = col.getModels();
Model m = mm.current();
// filter should work
m.getJSONArray("tmpls").getJSONObject(0).put("qfmt", "{{kana:Front}}");
mm.save(m);
Note n = col.newNote();
n.setItem("Front", "foo[abc]");
col.addNote(n);
Card c = n.cards().get(0);
assertTrue(c.q().endsWith("abc"));
// and should avoid sound
n.setItem("Front", "foo[sound:abc.mp3]");
n.flush();
String question = c.q(true);
assertThat("Question «" + question + "» does not contains «anki:play».", question, containsString("anki:play"));
// it shouldn't throw an error while people are editing
m.getJSONArray("tmpls").getJSONObject(0).put("qfmt", "{{kana:}}");
mm.save(m);
c.q(true);
}
use of com.ichi2.libanki.Sound in project Anki-Android by ankidroid.
the class ReviewerTest method noErrorShouldOccurIfSoundFileNotPresent.
@Test
public void noErrorShouldOccurIfSoundFileNotPresent() {
Note firstNote = addNoteUsingBasicModel("[[sound:not_on_file_system.mp3]]", "World");
moveToReviewQueue(firstNote.firstCard());
Reviewer reviewer = startReviewer();
reviewer.generateQuestionSoundList();
reviewer.displayCardQuestion();
assertThat("If the sound file with given name is not present, then no error occurs", true);
}
Aggregations