summaryrefslogtreecommitdiff
path: root/rsvg_convert/tests/internal_predicates/file.rs
blob: a7af5acf95f3f5852961b8fc9ccf7c066b01ee06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use predicates::prelude::*;
use predicates::str::StartsWithPredicate;

use super::pdf::PdfPredicate;
use super::png::PngPredicate;
use super::svg::SvgPredicate;

/// Predicates to check that some output ([u8]) is of a certain file type

pub fn is_png() -> PngPredicate {
    PngPredicate {}
}

pub fn is_ps() -> StartsWithPredicate {
    predicate::str::starts_with("%!PS-Adobe-3.0\n")
}

pub fn is_eps() -> StartsWithPredicate {
    predicate::str::starts_with("%!PS-Adobe-3.0 EPSF-3.0\n")
}

pub fn is_pdf() -> PdfPredicate {
    PdfPredicate {}
}

pub fn is_svg() -> SvgPredicate {
    SvgPredicate {}
}