Merge branch 'devel/master' into devel/new_mesh
[platform/core/uifw/dali-toolkit.git] / automated-tests / style / application.js
1 function getScrollTop() {
2         return f_scrollTop();
3 }
4
5 function f_scrollTop() {
6         return f_filterResults($(window) ? $(window).scrollTop() : 0,
7                         document.documentElement ? document.documentElement.scrollTop : 0,
8                         document.body ? document.body.scrollTop : 0);
9 }
10 function f_filterResults(n_win, n_docel, n_body) {
11         var n_result = n_win ? n_win : 0;
12         if (n_docel && (!n_result || (n_result > n_docel)))
13                 n_result = n_docel;
14         return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
15 }
16
17 function setScrollTop() {
18         $(window) ? $(window).scrollTop(0) : 0;
19         document.documentElement ? document.documentElement.scrollTop = 0 : 0;
20         document.body ? document.body.scrollTop = 0 : 0;
21 }
22
23 function goTopEx() {
24         $node = $('#goTopBtn');
25         if (getScrollTop() > 0) {
26                 $node.show();
27         } else {
28                 $node.hide();
29         }
30
31         $(window).scroll(function() {
32                 if (getScrollTop() > 0) {
33                         $node.show();
34                 } else {
35                         $node.hide();
36                 }
37         });
38
39         $node.click(function() {
40                 setScrollTop();
41         });
42 }
43
44 function drawRatio() {
45         $('.suite_item').each(function(i, node) {
46                 drawSuiteRatio(node)
47         });
48 }
49
50 $(".see_all").click(function(){
51         $("#see_all").show();
52     $("#see_fail").hide();
53     $("#see_block").hide();
54     $("#see_na").hide();
55     updateToggles();
56     return false;
57 });
58
59 $(".see_failed").click(function(){
60         $("#see_all").hide();
61     $("#see_fail").show();
62     $("#see_block").hide();
63     $("#see_na").hide();
64     updateToggles();
65     return false;
66 });
67
68 $(".see_blocked").click(function(){
69         $("#see_all").hide();
70     $("#see_fail").hide();
71     $("#see_block").show();
72     $("#see_na").hide();
73     updateToggles();
74     return false;
75 });
76
77 $(".see_na").click(function(){
78         $("#see_all").hide();
79     $("#see_fail").hide();
80     $("#see_block").hide();
81     $("#see_na").show();
82     updateToggles();
83     return false;
84 });
85
86 $("a.test_case_popup").click(function(){
87         var $this = $(this);
88         Popup.show($this.attr('id'));
89     return false;
90 });
91
92 $(".see_capabilities").click(function(){
93         if ($('#capability_table').css('display') == 'none') {
94                 $("#capability_table").show();
95         }else{
96                 $("#capability_table").hide();
97         }
98     return false;
99 });
100
101 function drawSuiteRatio(node) {
102         arrTitle = new Array("Passed", "Failed", "Blocked", "Not Executed");
103         var $node = $(node);
104         var $total = $node.find('.total');
105         var $pass = $node.find('.pass');
106         var $fail = $node.find('.fail');
107         var $block = $node.find('.block');
108         var $na = $node.find('.na');
109         var $div = $node.find('.RatioGraphic');
110
111         var total_int = parseInt($total.text());
112         var pass_int = parseInt($pass.text());
113         var fail_int = parseInt($fail.text());
114         var block_int = parseInt($block.text());
115         var na_int = parseInt($na.text());
116
117         var pass_rate = pass_int * 100 / total_int;
118         var fail_rate = fail_int * 100 / total_int;
119         var block_rate = block_int * 100 / total_int;
120         var na_rate = na_int * 100 / total_int;
121
122         var areaWidth = 380;
123
124         var pass_width = areaWidth * pass_rate / 100;
125         var fail_width = areaWidth * fail_rate / 100;
126         var block_width = areaWidth * block_rate / 100;
127         var na_width = areaWidth * na_rate / 100;
128         
129         pass_rate = pass_rate.toFixed(2);
130         fail_rate = fail_rate.toFixed(2);
131         block_rate = block_rate.toFixed(2);
132         na_rate = na_rate.toFixed(2);
133
134         var pass_style = "padding:3px 0px 0px 0px;font-size:9pt;height:17px;text-align:center;color:white;font-weight:bold;background:url("./style/blue.jpg");"
135         var fail_style = "padding:3px 0px 0px 0px;font-size:9pt;height:17px;text-align:center;color:white;font-weight:bold;background:url("./style/red.jpg");"
136         var block_style = "padding:3px 0px 0px 0px;font-size:9pt;height:17px;text-align:center;color:white;font-weight:bold;background:url("./style/orange.jpg");"
137         var na_style = "padding:3px 0px 0px 0px;font-size:9pt;height:17px;text-align:center;color:white;font-weight:bold;background:url("./style/gray.jpg");"
138
139         var html = "<table width=\"380.68\" align=\"center\"><tbody><tr>";
140         if (pass_width > 0){
141             html += "<td width=\""
142                         + pass_width
143                         + "\" style=\""
144                         + pass_style
145                         + "\" title=\"Passed :"
146                         + pass_rate
147                         + "%\">";
148             if (pass_width > 20){
149                 html += pass_rate + "%"
150             }
151             html +=  "</td>";
152         }
153         if (fail_width > 0){
154                 html += "<td width=\""
155                         + fail_width
156                         + "\" style=\""
157                         + fail_style
158                         + "\" title=\"Failed :"
159                         + fail_rate
160                         + "%\">";
161             if (fail_width > 20){
162                 html += fail_rate + "%"
163             }
164             html +=  "</td>";
165         }
166         if (block_width > 0){
167                 html += "<td width=\""
168                         + block_width
169                         + "\" style=\""
170                         + block_style
171                         + "\" title=\"Blocked :"
172                         + block_rate
173                         + "%\">";
174             if (block_width > 20){
175                 html += block_rate + "%"
176             }
177             html +=  "</td>";
178         }
179         if (na_width > 0){
180                 html += "<td width=\""
181                         + na_width
182                         + "\" style=\""
183                         + na_style
184                         + "\" title=\"Blocked :"
185                         + na_rate
186                         + "%\">";
187             if (na_width > 20){
188                 html += na_rate + "%"
189             }
190             html +=  "</td>";
191         }
192         html += "</tr></tbody></table>";
193         $div.html(html);
194 }