File: change_memory_format.rs

package info (click to toggle)
glycin 2.0.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 13,216 kB
  • sloc: python: 432; ansic: 215; xml: 70; makefile: 30; sh: 27; javascript: 10
file content (31 lines) | stat: -rw-r--r-- 816 bytes parent folder | download | duplicates (2)
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
use glycin_utils::MemoryFormatSelection;
use utils::*;

mod utils;

#[test]
fn change_memory_format() {
    block_on(change_memory_format_internal());
}

async fn change_memory_format_internal() {
    for path in [
        "test-images/images/color/color.png",
        "test-images/images/gray-iccp/gray-iccp-GA16.png",
    ] {
        let file = gio::File::for_path(path);

        for memory_format_selection in [
            MemoryFormatSelection::A8b8g8r8,
            MemoryFormatSelection::R8g8b8,
            MemoryFormatSelection::R16g16b16,
        ] {
            let mut loader = glycin::Loader::new(file.clone());
            loader.accepted_memory_formats(memory_format_selection);

            let image = loader.load().await.unwrap();

            image.next_frame().await.unwrap();
        }
    }
}