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
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Helpers the unit tests share, compiled only for a test build.
//!
//! What belongs here is a fixture whose definition several modules would otherwise each
//! write out: what a plain PNG is, and how a test names a path of its own under the
//! temporary directory. What does not belong here is a helper one module uses, or one whose
//! shape is part of what a module is testing; those stay beside their tests.
//!
//! This is not `tests/common`. That module is shared by the integration tests, which are
//! separate binaries linking the crate from outside; this one is inside the crate and is
//! only ever built with `cfg(test)`.
use PngEncoder;
use ;
use PathBuf;
use ;
/// A PNG of one flat colour, encoded the way an encoder that is not this crate's would.
///
/// The colour is arbitrary and opaque. A test that cares about the pixels should build its
/// own image; this is for the tests that need a file that is unmistakably a PNG.
pub
/// A path under the temporary directory that no other test holds.
///
/// The nanosecond clock is what makes it unique, so two tests running at once do not collide
/// and a leftover from an earlier run is never picked up. Nothing is created here; the caller
/// decides whether it wants a file or a directory.
pub