diff options
author | Guillaume Rousse <guillomovitch@mageia.org> | 2012-05-24 16:44:19 +0000 |
---|---|---|
committer | Guillaume Rousse <guillomovitch@mageia.org> | 2012-05-24 16:44:19 +0000 |
commit | 22ca463cdd9f6d3402defe15348bbb5dd1f4668b (patch) | |
tree | ad0ebb0954b532cbafefd2ce50d685ed912fb71f | |
parent | 10e6638085690c403705e71a4f13f74eda0ae97e (diff) | |
download | perl-Parse-EDID-22ca463cdd9f6d3402defe15348bbb5dd1f4668b.tar perl-Parse-EDID-22ca463cdd9f6d3402defe15348bbb5dd1f4668b.tar.gz perl-Parse-EDID-22ca463cdd9f6d3402defe15348bbb5dd1f4668b.tar.bz2 perl-Parse-EDID-22ca463cdd9f6d3402defe15348bbb5dd1f4668b.tar.xz perl-Parse-EDID-22ca463cdd9f6d3402defe15348bbb5dd1f4668b.zip |
adapt tests to multiple edid in each output sample, and add second sample case
-rw-r--r-- | t/test.t | 503 |
1 files changed, 394 insertions, 109 deletions
@@ -6,111 +6,394 @@ use warnings; use English qw(-no_match_vars); use Test::More; -# each value is an arrayref with 3 elements, indexed by file name: +# each value is an arrayref with 2 elements, indexed by file name: # - expected output from find_edid_in_string function -# - expected output from parse_edid function -# - expected output from check_parsed_edid function +# - list of tuples foreach edid fragement: +# - expected output from parse_edid function +# - expected output from check_parsed_edid function my %tests = ( sample1 => [ - [ binary('00ffffffffffff0006af14a10000000001120103901a10780a50c59858528e2725505400000001010101010101010101010101010101ea1a007e502010303020360005a31000001aea1a007e502010303020360005a31000001a000000fe00593734374480423132314557300000000000000000000000000001010a202000a5') ], - { - 'serial_number' => 0, - 'ratio_precision' => 'mm', - 'feature_support' => { - 'GTF_compliance' => 0, - 'sRGB_compliance' => 0, - 'rgb' => 0, - 'DPMS_suspend' => 0, - 'has_preferred_timing' => 1, - 'DPMS_active_off' => 0, - 'DPMS_standby' => 0 - }, - 'checksum' => 165, - 'video_input_definition' => { - 'voltage_level' => 0, - 'digital' => 1, - 'composite_sync' => 0, - 'separate_sync' => 0, - 'sync_on_green' => 1 - }, - 'established_timings' => [], - 'max_size_precision' => 'mm', - 'product_code' => 41236, - 'ratio' => '1.60122699386503', - 'standard_timings' => [], - 'monitor_details' => '', - 'week' => 1, - 'monitor_text' => [ - "Y747D\x80B121EW0" - ], - 'detailed_timings' => [ + [ + binary('00ffffffffffff0006af14a10000000001120103901a10780a50c59858528e2725505400000001010101010101010101010101010101ea1a007e502010303020360005a31000001aea1a007e502010303020360005a31000001a000000fe00593734374480423132314557300000000000000000000000000001010a202000a5') + ], + [ + [ { - 'vertical_dpi' => '124.662576687117', - 'vertical_sync_offset' => 3, - 'pixel_clock' => '68.9', - 'horizontal_border' => 0, - 'stereo' => 0, - 'interlaced' => 0, - 'horizontal_blanking' => 126, - 'digital_composite' => 3, - 'vertical_sync_pulse_width' => 6, - 'horizontal_active' => 1280, - 'vertical_sync_positive' => 1, - 'horizontal_sync_pulse_width' => 32, - 'horizontal_dpi' => '124.567049808429', - 'horizontal_sync_positive' => 0, - 'vertical_border' => 0, - 'preferred' => 1, - 'horizontal_sync_offset' => 48, - 'ModeLine' => '"1280x800" 68.9 1280 1328 1360 1406 800 803 809 816 -hsync +vsync', - 'vertical_image_size' => 163, - 'horizontal_image_size' => 261, - 'ModeLine_comment' => '# Monitor preferred modeline (60.1 Hz vsync, 49.0 kHz hsync, ratio 16/10, 124 dpi)', - 'vertical_blanking' => 16, - 'vertical_active' => 800 + 'serial_number' => 0, + 'ratio_precision' => 'mm', + 'feature_support' => { + 'GTF_compliance' => 0, + 'sRGB_compliance' => 0, + 'rgb' => 0, + 'DPMS_suspend' => 0, + 'has_preferred_timing' => 1, + 'DPMS_active_off' => 0, + 'DPMS_standby' => 0 + }, + 'checksum' => 165, + 'video_input_definition' => { + 'voltage_level' => 0, + 'digital' => 1, + 'composite_sync' => 0, + 'separate_sync' => 0, + 'sync_on_green' => 1 + }, + 'established_timings' => [], + 'max_size_precision' => 'mm', + 'product_code' => 41236, + 'ratio' => '1.60122699386503', + 'standard_timings' => [], + 'monitor_details' => '', + 'week' => 1, + 'monitor_text' => [ + "Y747D\x80B121EW0" + ], + 'detailed_timings' => [ + { + 'vertical_dpi' => '124.662576687117', + 'vertical_sync_offset' => 3, + 'pixel_clock' => '68.9', + 'horizontal_border' => 0, + 'stereo' => 0, + 'interlaced' => 0, + 'horizontal_blanking' => 126, + 'digital_composite' => 3, + 'vertical_sync_pulse_width' => 6, + 'horizontal_active' => 1280, + 'vertical_sync_positive' => 1, + 'horizontal_sync_pulse_width' => 32, + 'horizontal_dpi' => '124.567049808429', + 'horizontal_sync_positive' => 0, + 'vertical_border' => 0, + 'preferred' => 1, + 'horizontal_sync_offset' => 48, + 'ModeLine' => '"1280x800" 68.9 1280 1328 1360 1406 800 803 809 816 -hsync +vsync', + 'vertical_image_size' => 163, + 'horizontal_image_size' => 261, + 'ModeLine_comment' => '# Monitor preferred modeline (60.1 Hz vsync, 49.0 kHz hsync, ratio 16/10, 124 dpi)', + 'vertical_blanking' => 16, + 'vertical_active' => 800 + }, + { + 'vertical_dpi' => '124.662576687117', + 'vertical_sync_offset' => 3, + 'pixel_clock' => '68.9', + 'horizontal_border' => 0, + 'stereo' => 0, + 'interlaced' => 0, + 'horizontal_blanking' => 126, + 'digital_composite' => 3, + 'vertical_sync_pulse_width' => 6, + 'horizontal_active' => 1280, + 'vertical_sync_positive' => 1, + 'horizontal_sync_pulse_width' => 32, + 'horizontal_dpi' => '124.567049808429', + 'horizontal_sync_positive' => 0, + 'vertical_border' => 0, + 'horizontal_sync_offset' => 48, + 'ModeLine' => '"1280x800" 68.9 1280 1328 1360 1406 800 803 809 816 -hsync +vsync', + 'vertical_image_size' => 163, + 'horizontal_image_size' => 261, + 'ModeLine_comment' => '# Monitor supported modeline (60.1 Hz vsync, 49.0 kHz hsync, ratio 16/10, 124 dpi)', + 'vertical_blanking' => 16, + 'vertical_active' => 800 + } + ], + 'extension_flag' => 0, + 'gamma' => 120, + 'diagonal_size' => '12.1148583788498', + 'ratio_name' => '16/10', + 'edid_revision' => 3, + 'EISA_ID' => 'AUOa114', + 'max_size_horizontal' => '26.1', + 'max_size_vertical' => '16.3', + 'edid_version' => 1, + 'year' => 2008, + 'manufacturer_name' => 'AUO' }, + '' + ] + ] + ], + sample2 => [ + [ + binary('00ffffffffffff0006af14a10000000001120103901a10780a50c59858528e2725505400000001010101010101010101010101010101ea1a007e502010303020360005a31000001aea1a007e502010303020360005a31000001a000000fe00593734374480423132314557300000000000000000000000000001010a202000a5'), + binary('00ffffffffffff0022f0f62601010101181401036e362378eece50a3544c99260f5054a56b8081408180a900a940b300d10001010101283c80a070b023403020360022602100001a000000fc004850204c5032343735770a2020000000fd0030551e5e15000a202020202020000000ff00434e43303234303343500a20200085') + ], + [ + [ { - 'vertical_dpi' => '124.662576687117', - 'vertical_sync_offset' => 3, - 'pixel_clock' => '68.9', - 'horizontal_border' => 0, - 'stereo' => 0, - 'interlaced' => 0, - 'horizontal_blanking' => 126, - 'digital_composite' => 3, - 'vertical_sync_pulse_width' => 6, - 'horizontal_active' => 1280, - 'vertical_sync_positive' => 1, - 'horizontal_sync_pulse_width' => 32, - 'horizontal_dpi' => '124.567049808429', - 'horizontal_sync_positive' => 0, - 'vertical_border' => 0, - 'horizontal_sync_offset' => 48, - 'ModeLine' => '"1280x800" 68.9 1280 1328 1360 1406 800 803 809 816 -hsync +vsync', - 'vertical_image_size' => 163, - 'horizontal_image_size' => 261, - 'ModeLine_comment' => '# Monitor supported modeline (60.1 Hz vsync, 49.0 kHz hsync, ratio 16/10, 124 dpi)', - 'vertical_blanking' => 16, - 'vertical_active' => 800 - } + 'serial_number' => 0, + 'ratio_precision' => 'mm', + 'feature_support' => { + 'GTF_compliance' => 0, + 'sRGB_compliance' => 0, + 'rgb' => 0, + 'DPMS_suspend' => 0, + 'has_preferred_timing' => 1, + 'DPMS_active_off' => 0, + 'DPMS_standby' => 0 + }, + 'checksum' => 165, + 'video_input_definition' => { + 'voltage_level' => 0, + 'digital' => 1, + 'composite_sync' => 0, + 'separate_sync' => 0, + 'sync_on_green' => 1 + }, + 'established_timings' => [], + 'max_size_precision' => 'mm', + 'product_code' => 41236, + 'ratio' => '1.60122699386503', + 'standard_timings' => [], + 'monitor_details' => '', + 'week' => 1, + 'monitor_text' => [ + "Y747D\x80B121EW0" + ], + 'detailed_timings' => [ + { + 'vertical_dpi' => '124.662576687117', + 'vertical_sync_offset' => 3, + 'pixel_clock' => '68.9', + 'horizontal_border' => 0, + 'stereo' => 0, + 'interlaced' => 0, + 'horizontal_blanking' => 126, + 'digital_composite' => 3, + 'vertical_sync_pulse_width' => 6, + 'horizontal_active' => 1280, + 'vertical_sync_positive' => 1, + 'horizontal_sync_pulse_width' => 32, + 'horizontal_dpi' => '124.567049808429', + 'horizontal_sync_positive' => 0, + 'vertical_border' => 0, + 'preferred' => 1, + 'horizontal_sync_offset' => 48, + 'ModeLine' => '"1280x800" 68.9 1280 1328 1360 1406 800 803 809 816 -hsync +vsync', + 'vertical_image_size' => 163, + 'horizontal_image_size' => 261, + 'ModeLine_comment' => '# Monitor preferred modeline (60.1 Hz vsync, 49.0 kHz hsync, ratio 16/10, 124 dpi)', + 'vertical_blanking' => 16, + 'vertical_active' => 800 + }, + { + 'vertical_dpi' => '124.662576687117', + 'vertical_sync_offset' => 3, + 'pixel_clock' => '68.9', + 'horizontal_border' => 0, + 'stereo' => 0, + 'interlaced' => 0, + 'horizontal_blanking' => 126, + 'digital_composite' => 3, + 'vertical_sync_pulse_width' => 6, + 'horizontal_active' => 1280, + 'vertical_sync_positive' => 1, + 'horizontal_sync_pulse_width' => 32, + 'horizontal_dpi' => '124.567049808429', + 'horizontal_sync_positive' => 0, + 'vertical_border' => 0, + 'horizontal_sync_offset' => 48, + 'ModeLine' => '"1280x800" 68.9 1280 1328 1360 1406 800 803 809 816 -hsync +vsync', + 'vertical_image_size' => 163, + 'horizontal_image_size' => 261, + 'ModeLine_comment' => '# Monitor supported modeline (60.1 Hz vsync, 49.0 kHz hsync, ratio 16/10, 124 dpi)', + 'vertical_blanking' => 16, + 'vertical_active' => 800 + } + ], + 'extension_flag' => 0, + 'gamma' => 120, + 'diagonal_size' => '12.1148583788498', + 'ratio_name' => '16/10', + 'edid_revision' => 3, + 'EISA_ID' => 'AUOa114', + 'max_size_horizontal' => '26.1', + 'max_size_vertical' => '16.3', + 'edid_version' => 1, + 'year' => 2008, + 'manufacturer_name' => 'AUO' + }, + '' ], - 'extension_flag' => 0, - 'gamma' => 120, - 'diagonal_size' => '12.1148583788498', - 'ratio_name' => '16/10', - 'edid_revision' => 3, - 'EISA_ID' => 'AUOa114', - 'max_size_horizontal' => '26.1', - 'max_size_vertical' => '16.3', - 'edid_version' => 1, - 'year' => 2008, - 'manufacturer_name' => 'AUO' - }, - '' - ] + [ + { + 'serial_number' => 16843009, + 'ratio_precision' => 'mm', + 'feature_support' => { + 'GTF_compliance' => 0, + 'sRGB_compliance' => 1, + 'rgb' => 0, + 'DPMS_suspend' => 1, + 'has_preferred_timing' => 1, + 'DPMS_active_off' => 1, + 'DPMS_standby' => 1 + }, + 'checksum' => 133, + 'serial_number2' => [ + 'CNC02403CP' + ], + 'video_input_definition' => { + 'voltage_level' => 2, + 'digital' => 0, + 'composite_sync' => 1, + 'separate_sync' => 1, + 'sync_on_green' => 0 + }, + 'VertRefresh' => '48-85', + 'monitor_name' => 'HP LP2475w', + 'established_timings' => [ + { + 'vfreq' => 60, + 'X' => 640, + 'Y' => '480' + }, + { + 'vfreq' => 75, + 'X' => 640, + 'Y' => '480' + }, + { + 'vfreq' => '70', + 'X' => 720, + 'Y' => '400' + }, + { + 'vfreq' => 60, + 'X' => 800, + 'Y' => '600' + }, + { + 'vfreq' => 75, + 'X' => 800, + 'Y' => '600' + }, + { + 'vfreq' => '75', + 'X' => 832, + 'Y' => '624' + }, + { + 'vfreq' => 60, + 'X' => 1024, + 'Y' => '768' + }, + { + 'vfreq' => 75, + 'X' => 1024, + 'Y' => '768' + }, + { + 'vfreq' => '75', + 'X' => 1280, + 'Y' => '1024' + } + ], + 'max_size_precision' => 'cm', + 'monitor_range' => { + 'horizontal_min' => 30, + 'vertical_max' => 85, + 'pixel_clock_max' => 210, + 'horizontal_max' => 94, + 'vertical_min' => 48 + }, + 'product_code' => 9974, + 'ratio' => '1.55113636363636', + 'HorizSync' => '30-94', + 'monitor_details' => '', + 'standard_timings' => [ + { + 'ratio' => '4/3', + 'vfreq' => 60, + 'X' => 1280, + 'Y' => '960' + }, + { + 'ratio' => '5/4', + 'vfreq' => 60, + 'X' => 1280, + 'Y' => '1024' + }, + { + 'ratio' => '16/10', + 'vfreq' => 60, + 'X' => 1600, + 'Y' => '1000' + }, + { + 'ratio' => '4/3', + 'vfreq' => 60, + 'X' => 1600, + 'Y' => '1200' + }, + { + 'ratio' => '16/10', + 'vfreq' => 60, + 'X' => 1680, + 'Y' => '1050' + }, + { + 'ratio' => '16/10', + 'vfreq' => 60, + 'X' => 1920, + 'Y' => '1200' + } + ], + 'week' => 24, + 'detailed_timings' => [ + { + 'vertical_dpi' => '87.0857142857143', + 'vertical_sync_offset' => 3, + 'bad_ratio' => 1, + 'pixel_clock' => 154, + 'horizontal_border' => 0, + 'stereo' => 0, + 'interlaced' => 0, + 'horizontal_blanking' => 160, + 'digital_composite' => 3, + 'vertical_sync_pulse_width' => 6, + 'horizontal_active' => 1920, + 'vertical_sync_positive' => 1, + 'horizontal_sync_pulse_width' => 32, + 'horizontal_dpi' => '90.3111111111111', + 'horizontal_sync_positive' => 0, + 'vertical_border' => 0, + 'preferred' => 1, + 'horizontal_sync_offset' => 48, + 'ModeLine' => '"1920x1200" 154 1920 1968 2000 2080 1200 1203 1209 1235 -hsync +vsync', + 'vertical_image_size' => 352, + 'horizontal_image_size' => 546, + 'ModeLine_comment' => '# Monitor preferred modeline (60.0 Hz vsync, 74.0 kHz hsync, ratio 16/10, 90 dpi)', + 'vertical_blanking' => 35, + 'vertical_active' => 1200 + } + ], + 'extension_flag' => 0, + 'gamma' => 120, + 'diagonal_size' => '25.3348827451908', + 'ratio_name' => '16/10', + 'edid_revision' => 3, + 'EISA_ID' => 'HWP26f6', + 'max_size_horizontal' => 54, + 'max_size_vertical' => 35, + 'edid_version' => 1, + 'year' => 2010, + 'manufacturer_name' => 'HWP' + }, + '' + ] + ] + ] ); -plan tests => 1 + (3 * scalar keys %tests); +# use test +my $count = 1; +foreach my $test (keys %tests) { + # one find_edid test, plus two tests foreach fragment + $count += 1 + (2 * scalar @{$tests{$test}->[1]}); +} +plan tests => $count; use_ok('Parse::EDID'); @@ -121,22 +404,24 @@ foreach my $test (keys %tests) { is_deeply( \@edids, $tests{$test}->[0], - "$test: edid extraction" + "file $test: edids extraction" ); - my $edid = parse_edid($edids[0]); - is_deeply( - $edid, - $tests{$test}->[1], - "$test: edid parsing" - ); + for my $i (0 .. $#edids) { + my $parsed_edid = parse_edid($edids[$i]); + is_deeply( + $parsed_edid, + $tests{$test}->[1]->[$i]->[0], + "file $test, edid $i: parsing" + ); - my $message = check_parsed_edid($edid); - is( - $message, - $tests{$test}->[2], - "$test: edid checking" - ); + my $message = check_parsed_edid($parsed_edid); + is( + $message, + $tests{$test}->[1]->[$i]->[1], + "file $test, edit $i: checking" + ); + } } sub read_file { |