From 96cf146513afbaf6f2842c8c373c0c562fa937f1 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Tue, 22 May 2012 21:26:57 +0000 Subject: Initial import NB: SVN to Git Migration corrected initial import issues by squashing all commits relating to that into this initial commit. --- t/compile.t | 10 +++ t/kwalite.t | 10 +++ t/parse_edid.t | 257 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ t/pod-coverage.t | 14 +++ t/pod.t | 14 +++ t/sample2 | 56 ++++++++++++ 6 files changed, 361 insertions(+) create mode 100644 t/compile.t create mode 100644 t/kwalite.t create mode 100644 t/parse_edid.t create mode 100755 t/pod-coverage.t create mode 100755 t/pod.t create mode 100644 t/sample2 (limited to 't') diff --git a/t/compile.t b/t/compile.t new file mode 100644 index 0000000..649002e --- /dev/null +++ b/t/compile.t @@ -0,0 +1,10 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +plan tests => 1; + +use_ok('Parse::EDID'); diff --git a/t/kwalite.t b/t/kwalite.t new file mode 100644 index 0000000..41c2ce7 --- /dev/null +++ b/t/kwalite.t @@ -0,0 +1,10 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +eval { require Test::Kwalitee; Test::Kwalitee->import() }; + +plan( skip_all => 'Test::Kwalitee not installed; skipping' ) if $@; diff --git a/t/parse_edid.t b/t/parse_edid.t new file mode 100644 index 0000000..0c99543 --- /dev/null +++ b/t/parse_edid.t @@ -0,0 +1,257 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use English qw(-no_match_vars); +use Test::More; +use Parse::EDID; + +my %tests = ( + 'crt.13' => { + 'manufacturer_name' => 'LTN', + 'monitor_name' => 'A1554NEL', + 'EISA_ID' => 'LTNa543' + }, + 'crt.dell-d1626ht' => { + 'manufacturer_name' => 'DEL', + 'monitor_name' => 'DELL D1626HT', + 'EISA_ID' => 'DEL515b', + }, + 'crt.dell-p1110' => { + 'manufacturer_name' => 'DEL', + 'monitor_name' => 'DELL P1110', + 'EISA_ID' => 'DEL50ab' + }, + 'crt.dell-p790' => { + 'manufacturer_name' => 'DEL', + 'monitor_name' => 'DELL P790', + 'EISA_ID' => 'DEL62f5' + }, + 'crt.E55' => { + 'manufacturer_name' => 'MEI', + 'monitor_name' => undef, + 'EISA_ID' => 'MEI264a' + }, + 'crt.emc0313' => { + 'manufacturer_name' => 'EMC', + 'monitor_name' => undef, + 'EISA_ID' => 'EMC0313' + }, + 'crt.hyundai-ImageQuest-L70S+' => { + 'manufacturer_name' => 'IQT', + 'monitor_name' => 'L70S+', + 'EISA_ID' => 'IQT0704' + }, + 'crt.iiyama-1451' => { + 'manufacturer_name' => 'IVM', + 'monitor_name' => 'LS902U', + 'EISA_ID' => 'IVM1938' + }, + 'crt.iiyama-404' => { + 'manufacturer_name' => 'IVM', + 'monitor_name' => undef, + 'EISA_ID' => 'IVM1744' + }, + 'crt.iiyama-410pro' => { + 'manufacturer_name' => 'IVM', + 'monitor_name' => undef, + 'EISA_ID' => 'IVM1740' + }, + 'crt.leia' => { + 'manufacturer_name' => 'CPQ', + 'monitor_name' => 'COMPAQ P710', + 'EISA_ID' => 'CPQ1384' + }, + 'crt.LG-Studioworks-N2200P' => { + 'manufacturer_name' => 'GSM', + 'monitor_name' => 'Studioworks N 2200P', + 'EISA_ID' => 'GSM55f3', + }, + 'crt.med2914' => { + 'manufacturer_name' => 'MED', + 'monitor_name' => undef, + 'EISA_ID' => 'MED2914' + }, + 'crt.nokia-valuegraph-447w' => { + 'manufacturer_name' => 'NOK', + 'monitor_name' => undef, + 'EISA_ID' => 'NOK00b7' + }, + 'crt.SM550S' => { + 'manufacturer_name' => 'SAM', + 'monitor_name' => undef, + 'EISA_ID' => 'SAM1035' + }, + 'crt.SM550V' => { + 'manufacturer_name' => 'SAM', + 'monitor_name' => 'S/M 550v', + 'EISA_ID' => 'SAM12b6' + }, + 'crt.sony-gdm400ps' => { + 'manufacturer_name' => 'SNY', + 'monitor_name' => 'GDM-400PST9', + 'EISA_ID' => 'SNY0090' + }, + 'crt.sony-gdm420' => { + 'manufacturer_name' => 'SNY', + 'monitor_name' => 'CPD-G420', + 'EISA_ID' => 'SNY0490' + }, + 'crt.test_box_lmontel' => { + 'manufacturer_name' => 'CPQ', + 'monitor_name' => 'COMPAQ MV920', + 'EISA_ID' => 'CPQ3027' + }, + 'lcd.20inches' => { + 'manufacturer_name' => 'MAX', + 'monitor_name' => 'B102005', + 'EISA_ID' => 'MAX07d3' + }, + 'lcd.acer-al1921' => { + 'manufacturer_name' => 'ACR', + 'monitor_name' => 'Acer AL1921', + 'EISA_ID' => 'ACRad25' + }, + 'lcd.acer-asp1680' => { + 'manufacturer_name' => 'QDS', + 'monitor_name' => undef, + 'EISA_ID' => 'QDS0014' + }, + 'lcd.b-101750' => { + 'manufacturer_name' => 'MAX', + 'monitor_name' => 'B_101750', + 'EISA_ID' => 'MAX06ac' + }, + 'lcd.benq-t904' => { + 'manufacturer_name' => 'BNQ', + 'monitor_name' => 'BenQ T904', + 'EISA_ID' => 'BNQ7681' + }, + 'lcd.blino' => { + 'manufacturer_name' => 'AUO', + 'monitor_name' => undef, + 'EISA_ID' => 'AUO0f03' + }, + 'lcd.cmc-17-AD' => { + 'manufacturer_name' => 'CMO', + 'monitor_name' => 'CMC 17" AD', + 'EISA_ID' => 'CMO7801' + }, + 'lcd.compaq-evo-n1020v' => { + 'manufacturer_name' => 'LGP', + 'monitor_name' => undef, + 'EISA_ID' => 'LGP6e54' + }, + 'lcd.dell-2001fp' => { + 'manufacturer_name' => 'DEL', + 'monitor_name' => 'DELL 2001FP', + 'EISA_ID' => 'DELa007' + }, + 'lcd.dell-inspiron-6400' => { + 'manufacturer_name' => 'LPL', + 'monitor_name' => undef, + 'EISA_ID' => undef + }, + 'lcd.Elonex-PR600' => { + 'manufacturer_name' => 'CMO', + 'monitor_name' => undef, + 'EISA_ID' => 'CMO1526', + }, + 'lcd.gericom-cy-96' => { + 'manufacturer_name' => 'PTS', + 'monitor_name' => 'CY965', + 'EISA_ID' => 'PTS03c5' + }, + 'lcd.hp-nx-7000' => { + 'manufacturer_name' => 'LGP', + 'monitor_name' => undef, + 'EISA_ID' => undef + }, + 'lcd.hp-nx-7010' => { + 'manufacturer_name' => 'LGP', + 'monitor_name' => undef, + 'EISA_ID' => undef + }, + 'lcd.HP-Pavilion-ZV6000' => { + 'manufacturer_name' => 'QDS', + 'monitor_name' => undef, + 'EISA_ID' => 'QDS0014' + }, + 'lcd.lenovo-3000-v100' => { + 'manufacturer_name' => 'AUO', + 'monitor_name' => undef, + 'EISA_ID' => 'AUO3214' + }, + 'lcd.lenovo-w500' => { + 'manufacturer_name' => 'LEN', + 'monitor_name' => undef, + 'EISA_ID' => 'LEN4055' + }, + 'lcd.philips-150s' => { + 'manufacturer_name' => 'PHL', + 'monitor_name' => 'PHILIPS 150S', + 'EISA_ID' => 'PHL0805' + }, + 'lcd.philips-180b2' => { + 'manufacturer_name' => 'PHL', + 'monitor_name' => 'Philips 180B2', + 'EISA_ID' => 'PHL0810' + }, + 'lcd.presario-R4000' => { + 'manufacturer_name' => 'LPL', + 'monitor_name' => undef, + 'EISA_ID' => undef, + }, + 'lcd.rafael' => { + 'manufacturer_name' => 'MAX', + 'monitor_name' => 'B101715', + 'EISA_ID' => 'MAX06b5' + }, + 'lcd.regis' => { + 'manufacturer_name' => 'ENC', + 'monitor_name' => 'L557', + 'EISA_ID' => 'ENC1689' + }, + 'lcd.samsung-191n' => { + 'manufacturer_name' => 'SAM', + 'monitor_name' => 'SyncMaster', + 'EISA_ID' => 'SAM0080' + }, + 'lcd.tv.VQ32-1T' => { + 'manufacturer_name' => 'FUS', + 'monitor_name' => 'VQ32-1T', + 'EISA_ID' => 'FUS065b' + }, +); + +plan tests => 2 * scalar keys %tests; + +foreach my $test (sort keys %tests) { + my $edid = read_file("t/edid/$test"); + my $parsed_edid = parse_edid($edid); + my $message = check_parsed_edid($parsed_edid); + is($message, "", "$test: parsing succesful"); + + subtest "$test: expected results" => sub { + check_result($parsed_edid, $tests{$test}); + }; + +} + +sub read_file { + my ($file) = @_; + local $RS; + open (my $handle, '<', $file) or die "Can't open $file: $ERRNO"; + my $content = <$handle>; + close $handle; + return $content; +} + +sub check_result { + my ($got, $expected) = @_; + + foreach my $field (qw/manufacturer_name monitor_name EISA_ID/) { + is($got->{$field}, $expected->{$field}, $field); + } +} diff --git a/t/pod-coverage.t b/t/pod-coverage.t new file mode 100755 index 0000000..f135c3e --- /dev/null +++ b/t/pod-coverage.t @@ -0,0 +1,14 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; +use English qw(-no_match_vars); + +eval { require Test::Pod::Coverage; }; +plan(skip_all => 'Test::Pod::Coverage required') if $EVAL_ERROR; + + +Test::Pod::Coverage->import(); +all_pod_coverage_ok(); diff --git a/t/pod.t b/t/pod.t new file mode 100755 index 0000000..9a60e73 --- /dev/null +++ b/t/pod.t @@ -0,0 +1,14 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; +use English qw(-no_match_vars); + +eval { require Test::Pod; }; +plan(skip_all => 'Test::Pod required') if $EVAL_ERROR; + +Test::Pod->import(); + +all_pod_files_ok(); diff --git a/t/sample2 b/t/sample2 new file mode 100644 index 0000000..e6f821f --- /dev/null +++ b/t/sample2 @@ -0,0 +1,56 @@ +Screen 0: minimum 320 x 200, current 3200 x 1200, maximum 8192 x 8192 +LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 261mm x 163mm + EDID: + 00ffffffffffff0006af14a100000000 + 01120103901a10780a50c59858528e27 + 25505400000001010101010101010101 + 010101010101ea1a007e502010303020 + 360005a31000001aea1a007e50201030 + 3020360005a31000001a000000fe0059 + 37343744804231323145573000000000 + 00000000000000000001010a202000a5 + BACKLIGHT: 4 (0x00000004) range: (0,15) + Backlight: 4 (0x00000004) range: (0,15) + scaling mode: Full aspect + supported: None Full Center Full aspect + 1280x800 60.1*+ + 1024x768 60.0 + 800x600 60.3 56.2 + 640x480 59.9 +VGA1 connected 1920x1200+1280+0 (normal left inverted right x axis y axis) 546mm x 352mm + EDID: + 00ffffffffffff0022f0f62601010101 + 181401036e362378eece50a3544c9926 + 0f5054a56b8081408180a900a940b300 + d10001010101283c80a070b023403020 + 360022602100001a000000fc00485020 + 4c5032343735770a2020000000fd0030 + 551e5e15000a202020202020000000ff + 00434e43303234303343500a20200085 + 1920x1200 60.0*+ + 1600x1200 60.0 + 1680x1050 60.0 + 1600x1000 60.0 + 1280x1024 75.0 60.0 + 1280x960 60.0 + 1152x864 75.0 + 1024x768 75.1 60.0 + 832x624 74.6 + 800x600 75.0 60.3 + 640x480 75.0 60.0 + 720x400 70.1 +HDMI1 disconnected (normal left inverted right x axis y axis) + Broadcast RGB: Full + supported: Full Limited 16:2 + audio: auto + supported: off auto on +DP1 disconnected (normal left inverted right x axis y axis) + Broadcast RGB: Full + supported: Full Limited 16:2 + audio: auto + supported: off auto on +DP2 disconnected (normal left inverted right x axis y axis) + Broadcast RGB: Full + supported: Full Limited 16:2 + audio: auto + supported: off auto on -- cgit v1.2.1