1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package net.fckeditor.tool;
22
23 import org.junit.Test;
24 import static org.junit.Assert.*;
25
26
27
28
29
30
31
32 public class CompatibilityTest {
33
34 @Test
35 public void testIE4Win() throws Exception {
36 assertFalse(Compatibility.check("Mozilla/4.0 (compatible; MSIE 4.01; Windows NT 5.0)"));
37 }
38
39 @Test
40 public void testIE522Mac() throws Exception {
41 assertFalse(Compatibility.check("Mozilla/4.0 (compatible; MSIE 5.22; Mac_PowerPC)"));
42 }
43
44 @Test
45 public void testIE55Win98() throws Exception {
46 assertTrue(Compatibility.check("Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)"));
47 }
48
49 @Test
50 public void testIE60WinNT() throws Exception {
51 assertTrue(Compatibility.check("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1)"));
52 }
53
54 @Test
55 public void testIE70WinVista() throws Exception {
56 assertTrue(Compatibility.check("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0;)"));
57 }
58
59 @Test
60 public void testIE70bWinVista() throws Exception {
61 assertTrue(Compatibility.check("Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)"));
62 }
63
64 @Test
65 public void testSafari204OSX() throws Exception {
66 assertFalse(Compatibility.check("Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3"));
67 }
68
69 @Test
70 public void testSafari30WinXP() throws Exception {
71 assertTrue(Compatibility.check("Mozilla/5.0 (Windows; U; Windows NT 5.2; pt) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3"));
72 }
73
74 @Test
75 public void testSafari302OSX() throws Exception {
76 assertTrue(Compatibility.check("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/522+ (KHTML, like Gecko) Version/3.0.2 Safari/522.12"));
77 }
78
79 @Test
80 public void testSafari31OSX() throws Exception {
81 assertTrue(Compatibility.check("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; en-au) AppleWebKit/525.8+ (KHTML, like Gecko) Version/3.1 Safari/525.6"));
82 }
83
84 @Test
85 public void testFirefox200112OSX() throws Exception {
86 assertTrue(Compatibility.check("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12"));
87 }
88
89 @Test
90 public void testFirefox1509LinuxDebian() throws Exception {
91 assertTrue(Compatibility.check("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/1.5.0.9 (Debian-2.0.0.9-2)"));
92 }
93
94 @Test
95 public void testOper925Win2k() throws Exception {
96 assertFalse(Compatibility.check("Opera/9.25 (Windows NT 5.0; U; en)"));
97 }
98
99 @Test
100 public void testOpera854WinNT() throws Exception {
101 assertFalse(Compatibility.check("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; de) Opera 8.54"));
102 }
103
104 @Test
105 public void testOpera95OSX() throws Exception {
106 assertTrue(Compatibility.check("Opera/9.50 (Macintosh; Intel Mac OS X; U; en)"));
107 }
108
109 @Test
110 public void testOpera95WinVista() throws Exception {
111 assertTrue(Compatibility.check("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 6.0; en) Opera 9.50"));
112 }
113 }