-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
137 lines (120 loc) · 4.3 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!DOCTYPE html>
<html>
<head>
<title>TVIP JS API test page</title>
<script type="text/javascript" src="test.js"></script>
<link rel="stylesheet" type="text/css" href="test.css">
</head>
<body>
<div class="container">
<h1> TVIP JavaScript API tests </h1>
<button disabled id="browser" onclick="onBrowser()">Browser</button>
<button disabled id="home" onclick="onHome()">Home</button>
<button disabled id="prefs" onclick="onPrefs()">Preferences</button>
<button disabled id="keyboard" onclick="onKeyboard()">Virtual Keyboard</button>
<button disabled id="standby" onclick="onStandby()">Stand By</button>
<button disabled id="reboot" onclick="onReboot()">System Reboot</button>
<button disabled id="player" onclick="onPlayer()">Player</button>
<button disabled id="window" onclick="onWindow()">Window</button>
<button disabled id="launchuri" onclick="onLaunchUri()">Youtube</button>
<button disabled id="langru" onclick="onLangRu()">Set RU lang</button>
<button disabled id="langen" onclick="onLangEn()">Set EN lang</button>
<table>
<tbody id="stb"><tr class="table_header"><td>Name</td><td>Status</td><td>Input</td><td>Output</td><td>Expected</td></tr></tbody>
</table>
</div>
<script>
function onBrowser() {
window.TvipStb.launchBrowser("test.html", "test.html")
}
function onHome() {
window.TvipStb.launchHomeScreen()
}
function onPrefs() {
window.TvipStb.launchPreferences()
}
function onKeyboard() {
window.TvipStb.showVirtualKeyboard(true)
setTimeout(window.TvipStb.showVirtualKeyboard, 1500, false)
}
function onStandby() {
window.TvipStb.setStandBy(true)
setTimeout(window.TvipStb.setStandBy, 3000, false)
}
function onReboot() {
window.TvipStb.rebootSystem()
}
function onPlayer() {
window.location = "test_player.html"
}
function onWindow() {
// var w = window.TvipStb.windowOpenNew("test_player.html")
// setTimeout(window.TvipStb.windowClose, 5000, w)
setTimeout(window.TvipStb.windowSetScrollPosition, 1000, 1, 0)
setTimeout(window.TvipStb.windowResize, 2000, 1, 0, 0, 720, 576)
setTimeout(window.TvipStb.windowResize, 3000, 1, 0, 0, 1280, 720)
}
function onLaunchUri() {
window.TvipStb.execSystemUri("youtube");
}
function onLangRu() {
TvipStb.setCurrentLanguageCode("ru");
location.reload();
}
function onLangEn() {
TvipStb.setCurrentLanguageCode("en");
location.reload();
}
function started(result) {
if(!(result instanceof TestResult)) return
}
function passed(result) {
if(!(result instanceof TestResult)) return
document.getElementById("stb").insertAdjacentHTML("beforeend", "<tr class='row_passed'><td>"+result.name+"</td><td>"+result.status+"</td><td>"+result.input+"</td><td>"+result.populated+"</td><td>"+result.expected+"</td></tr>")
}
function failed(result) {
if(!(result instanceof TestResult)) return
document.getElementById("stb").insertAdjacentHTML("beforeend","<tr class='row_failed'><td>"+result.name+"</td><td>"+result.status+"</td><td>"+result.input+"</td><td>"+result.populated+"</td><td>"+result.expected+"</td></tr>")
}
function dotest() {
var test = new TvipApiTest(started, passed, failed)
test.run()
if(test.spatial) {
window.TvipStb.enableSpatialNavigation(true)
if(typeof window.TvipPlayer !== "undefined") {
document.getElementById("player").disabled = false
}
}
if(test.prefs) {
document.getElementById("prefs").disabled = false
}
if(test.browser) {
document.getElementById("browser").disabled = false
}
if(test.homeScreen) {
document.getElementById("home").disabled = false
}
if(test.reboot) {
document.getElementById("reboot").disabled = false
}
if(test.standby) {
document.getElementById("standby").disabled = false
}
if(test.keyboard) {
document.getElementById("keyboard").disabled = false
}
if(test.windowResize && test.windowScroll) {
document.getElementById("window").disabled = false
}
if(test.uri) {
document.getElementById("launchuri").disabled = false
}
if(test.setlang) {
document.getElementById("langru").disabled = false
document.getElementById("langen").disabled = false
}
}
window.onload = dotest
</script>
</body>
</html>