root/HTTP-MobileAgent/trunk/t/05_display.t

Revision 890 (checked in by miyagawa, 17 years ago)

version 0.10

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 use strict;
2 use Test::More tests => 33;
3
4 use HTTP::MobileAgent;
5
6 my @Tests = (
7     [ { HTTP_X_JPHONE_DISPLAY => '120*117', HTTP_USER_AGENT => 'J-PHONE/2.0/J-DN02',
8         HTTP_X_JPHONE_COLOR => 'C256' },
9       { width => 120, height => 117, color => 1, depth => 256. } ],
10     [ { HTTP_X_UP_DEVCAP_SCREENPIXELS => '90,70',
11         HTTP_USER_AGENT => 'KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1',
12         HTTP_X_UP_DEVCAP_SCREENDEPTH => '16,RGB565',
13         HTTP_X_UP_DEVCAP_ISCOLOR => 1, },
14       { width => 90, height => 70, color => 1, depth => 2**16 }, ],
15     [ { HTTP_X_UP_DEVCAP_SCREENPIXELS => '90,70',
16         HTTP_USER_AGENT => 'KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1',
17         HTTP_X_UP_DEVCAP_SCREENDEPTH => '1',
18         HTTP_X_UP_DEVCAP_ISCOLOR => 0 },
19       { width => 90, height => 70, color => '', depth => 2 }, ],
20     [ { HTTP_USER_AGENT => 'DoCoMo/1.0/D501i' },
21       { width => 96, height => 72, color => '', depth => 2 } ],
22     [ { HTTP_USER_AGENT => 'DoCoMo/1.0/D502i' },
23       { width => 96, height => 90, color => 1, depth => 256 } ],
24     [ { HTTP_USER_AGENT => 'DoCoMo/1.0/N502i' },
25       { width => 118, height => 128, color => '', depth => 4 } ],
26     [ { HTTP_USER_AGENT => "DoCoMo/1.0/D505i/c20/TC/W20H10" },
27       { width_bytes => 20, height_bytes => 10 } ],
28 );
29
30 for (@Tests) {
31     my($env, $values) = @$_;
32     local *ENV = $env;
33     my $ua = HTTP::MobileAgent->new;
34     my $display = $ua->display;
35     isa_ok $display, 'HTTP::MobileAgent::Display';
36     for my $method (keys %$values) {
37         is $display->$method(), $values->{$method}, "$method = $values->{$method}";
38     }
39 }
40
41
42
Note: See TracBrowser for help on using the browser.