Skip to content

Commit 4d26de4

Browse files
authored
Merge pull request #46 from yeslogic/brendanzab/edid-fixtures
Add more fixtures for EDID files
2 parents c0a4780 + 23170fc commit 4d26de4

File tree

6 files changed

+39
-9
lines changed

6 files changed

+39
-9
lines changed

examples/formats/edid/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,3 @@ ddl-util = { path = "../../../ddl-util" }
99

1010
[build-dependencies]
1111
ddl = { path = "../../.." }
12-
13-
[dev-dependencies]
14-
hex = "0.3.1"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# EDID Fixtures
2+
3+
These were obtained on macOS using:
4+
5+
```bash
6+
ioreg -lr -w 0 -k IODisplayEDID | grep IODisplayEDID | sed 's/.*<\(.*\)>/\1/'
7+
```
8+
9+
The hex-dumps can then be output to fixtures using:
10+
11+
```bash
12+
echo 'HEXDUMP' | xxd -r -p > examples/formats/edid/tests/fixtures/FIXTURE_NAME.bin
13+
````
Binary file not shown.
Binary file not shown.
Binary file not shown.

examples/formats/edid/tests/parse.rs

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
extern crate ddl_edid;
2-
extern crate hex;
32

4-
use hex::FromHex;
53
use std::io::Cursor;
64
use ddl_edid::Edid;
75

86
const MAGIC: [u8; 8] = [0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00];
97

108
#[test]
11-
fn test_read_edid() {
12-
// Obtained on macOS using `ioreg -l | grep IODisplayEDID | awk '{print $7}'`
13-
let buf = Vec::from_hex("00FFFFFFFFFFFF00061019A00000000030160104A5211578026FB1A7554C9E250C505400000001010101010101010101010101010101EF8340A0B0083470302036004BCF1000001A000000FC00436F6C6F72204C43440A20202000000010000000000000000000000000000000000010000000000000000000000000000000BC").unwrap();
14-
9+
fn test_read_edid_mbp_2013_built_in_retina() {
10+
let buf = include_bytes!("fixtures/mbp_2013_built_in_retina.bin");
1511
let edid = Edid::read(&mut Cursor::new(&buf[..])).unwrap();
1612

1713
assert_eq!(edid.header.magic, MAGIC);
@@ -27,3 +23,27 @@ fn test_read_edid() {
2723

2824
// panic!("{:#?}", edid);
2925
}
26+
27+
#[test]
28+
fn test_read_edid_mbp_2017_built_in_retina() {
29+
let buf = include_bytes!("fixtures/mbp_2017_built_in_retina.bin");
30+
let edid = Edid::read(&mut Cursor::new(&buf[..])).unwrap();
31+
32+
assert_eq!(edid.header.magic, MAGIC);
33+
34+
// TODO: ...
35+
36+
// panic!("{:#?}", edid);
37+
}
38+
39+
#[test]
40+
fn test_read_edid_yamakasi_0270led() {
41+
let buf = include_bytes!("fixtures/yamakasi_0270led.bin");
42+
let edid = Edid::read(&mut Cursor::new(&buf[..])).unwrap();
43+
44+
assert_eq!(edid.header.magic, MAGIC);
45+
46+
// TODO: ...
47+
48+
// panic!("{:#?}", edid);
49+
}

0 commit comments

Comments
 (0)