INNER CODE UNIT · Rust

test_qrcode

matiaskorhonen/paper-age · src/builder.rs:434

fn test_qrcode() {
    let result = Document::new(String::from("QR code"), PageSize::A4);
    let mut document = result.unwrap();
    let result = document.insert_qr_code(String::from("payload"));
    assert!(result.is_ok());
}

#[test]
fn test_qrcode_too_large() {
    let mut document = Document::new(String::from("QR code"), PageSize::A4).unwrap();
    let result = document.insert_qr_code(String::from(include_str!("../tests/data/too_large.txt")));

    assert!(result.is_err());
    assert!(result.unwrap_err().is::<qrcode::types::QrError>());
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…