Warning, /pim/kube/framework/qml/tests/tst_mailviewer.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * Copyright 2017 Christian Mollekopf <mollekopf@kolabsystems.com> 0003 * 0004 * This program is free software; you can redistribute it and/or modify 0005 * it under the terms of the GNU Library General Public License as 0006 * published by the Free Software Foundation; either version 2, or 0007 * (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU Library General Public License for more details 0013 * 0014 * You should have received a copy of the GNU Library General Public 0015 * License along with this program; if not, write to the 0016 * Free Software Foundation, Inc., 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0018 */ 0019 0020 import QtQuick 2.7 0021 import QtTest 1.0 0022 import org.kube.framework 1.0 as Kube 0023 import "../mailpartview" as MPV 0024 0025 0026 TestCase { 0027 id: testCase 0028 width: 400 0029 height: 400 0030 name: "MailViewer" 0031 when: windowShown 0032 visible: true 0033 0034 Kube.File { 0035 id: file 0036 path: "/src/kube/framework/qml/tests/kraken.eml" 0037 } 0038 0039 Component { 0040 id: viewerComponent 0041 Kube.MailViewer { 0042 anchors.fill: parent 0043 visible: true 0044 unread: false 0045 trash: false 0046 draft: false 0047 sent: false 0048 busy: false 0049 current: true 0050 autoLoadImages: true 0051 } 0052 } 0053 0054 function test_1htmlMail() { 0055 var viewer = createTemporaryObject(viewerComponent, testCase, {message: file.data}) 0056 0057 var htmlButton = findChild(viewer, "htmlButton"); 0058 verify(htmlButton) 0059 tryVerify(function(){ return htmlButton.visible }) 0060 htmlButton.clicked() 0061 0062 var htmlView = findChild(viewer, "htmlView"); 0063 verify(htmlView) 0064 var htmlPart = findChild(viewer, "htmlPart"); 0065 verify(htmlPart) 0066 0067 tryVerify(function(){ return htmlView.loadProgress == 100}) 0068 tryVerify(function(){ return htmlPart.loaded}) 0069 0070 // What it used to return... 0071 // tryVerify(function(){ return (1300 > htmlPart.contentWidth && htmlPart.contentWidth > 1200)}) 0072 // tryVerify(function(){ return (2700 > htmlPart.contentHeight && htmlPart.contentHeight > 2600)}) 0073 tryVerify(function(){ return (400 > htmlPart.contentWidth && htmlPart.contentWidth > 300)}) 0074 // Because of the 4000 limit that we have implemented 0075 tryVerify(function(){ return (4100 > htmlPart.contentHeight && htmlPart.contentHeight > 3900)}) 0076 } 0077 0078 Component { 0079 id: htmlComponent 0080 MPV.HtmlPart { 0081 anchors.fill: parent 0082 } 0083 } 0084 0085 Component { 0086 id: textComponent 0087 MPV.TextPart { 0088 anchors.fill: parent 0089 } 0090 } 0091 0092 function test_2htmlMail() { 0093 var data = 0094 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> 0095 <html><head><title></title><style> 0096 body { 0097 overflow:hidden; 0098 font-family: \"Noto Sans\" ! important; 0099 color: #31363b ! important; 0100 background-color: #fcfcfc ! important 0101 } 0102 blockquote { 0103 border-left: 2px solid #bdc3c7 ! important; 0104 } 0105 </style></head> 0106 <body> 0107 <table><tr><td style=\"\">john added a comment. 0108 </td></tr></table><br /><div><div><blockquote style=\"border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;\"><blockquote style=\"border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;\"><p>This is some text that is quoted.</p></blockquote></blockquote> 0109 0110 <p>I'm afraid due to technical limitations of how connections from us are done that's not trivial.</p> 0111 0112 <p>I would still suggest scheduling a meeting</p></div></div><br /><div><strong>TASK DETAIL</strong><div><a href=\"https://test.com/T336176\">https://test.com/T336176</a></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href=\"https://test.com/settings/panel/emailpreferences/\">https://test.com/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>mollekopf, john<br /><strong>Cc: </strong>john, test, Support<br /></div></body></html>" 0113 0114 var htmlPart = createTemporaryObject(htmlComponent, testCase, {content: data}) 0115 var htmlView = findChild(htmlPart, "htmlView"); 0116 verify(htmlView) 0117 0118 tryVerify(function(){ return htmlView.loadProgress == 100}) 0119 0120 tryVerify(function(){ return (450 > htmlPart.contentWidth && htmlPart.contentWidth > 350)}) 0121 tryVerify(function(){ return (500 > htmlPart.contentHeight && htmlPart.contentHeight > 400)}) 0122 0123 var textPart = createTemporaryObject(textComponent, testCase, {content: data}) 0124 var textView = findChild(textPart, "textView"); 0125 verify(textView) 0126 tryVerify(function(){ return (500 > textView.width && textView.width > 300)}) 0127 tryVerify(function(){ return (500 > textView.height && textView.height > 400)}) 0128 } 0129 0130 0131 function test_3htmlMail() { 0132 var data = 0133 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" 0134 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> 0135 <html xmlns=\"http://www.w3.org/1999/xhtml\"> 0136 <head> 0137 <style type=\"text/css\"> 0138 body { 0139 width: 100% !important; 0140 -webkit-text-size-adjust: 100%; 0141 -ms-text-size-adjust: 100%; 0142 margin: 0; 0143 padding: 0; 0144 line-height: 100% !important; 0145 } 0146 0147 @media screen and (max-width: 600px) { 0148 table[class=\"container-table\"] { 0149 width: 100% !important; 0150 } 0151 0152 .h21 { 0153 height: 21px !important; 0154 } 0155 0156 .w25 { 0157 width: 25px !important; 0158 } 0159 0160 .f13 { 0161 font-size: 13px !important; 0162 } 0163 0164 .f19 { 0165 font-size: 19px !important; 0166 } 0167 0168 .f28 { 0169 font-size: 28px !important; 0170 } 0171 0172 .l20 { 0173 line-height: 20px !important; 0174 } 0175 0176 .l21 { 0177 line-height: 21px !important; 0178 } 0179 0180 .l31 { 0181 line-height: 31px !important; 0182 } 0183 0184 .pr0 { 0185 padding-right: 0px !important; 0186 } 0187 0188 .pl0 { 0189 padding-left: 0px !important; 0190 } 0191 0192 .pr10 { 0193 padding-right: 10px !important; 0194 } 0195 0196 .pl10 { 0197 padding-left: 10px !important; 0198 } 0199 0200 .pt25 { 0201 padding-top: 25px !important; 0202 } 0203 0204 .pb25 { 0205 padding-bottom: 25px !important; 0206 } 0207 0208 .hide { 0209 display: none !important; 0210 } 0211 0212 .h15 { 0213 height: 15px !important; 0214 } 0215 0216 .full { 0217 width: 100% !important; 0218 } 0219 0220 .mcenter { 0221 text-align: center !important; 0222 margin: 0 auto !important; 0223 } 0224 } 0225 </style> 0226 </head> 0227 <body style=\"\"> 0228 <table style=\"padding: 40px 30px 20px 30px;\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600px\" align=\"center\" class=\"container-table\"> 0229 0230 <tr style=\"\"> 0231 <td style=\"\" class=\"header\"> 0232 <table style=\"\"> 0233 <tr style=\"\"> 0234 <td style=\"padding-top: 0px; padding-right: 40px; padding-bottom: 15px; padding-left: 40px;\" class=\"pr0 pl0\"> 0235 <a href=\"https://www.kraken.com/?kec=9WmzuIaQF-wV1c\"><img style=\"display: block; border: none;\" src=\"https://img.kraken.com/e/kraken-site-2019.png\" alt=\"Kraken\"></a> 0236 </td> 0237 </tr> 0238 </table> 0239 </td> 0240 </tr> 0241 <tr style=\"\"> 0242 <td style=\"\" class=\"body\"> 0243 <table style=\"\"> 0244 <tr style=\"\"> 0245 <td style=\"\"> 0246 <table style=\"padding-top: 0px; padding-right: 40px; padding-bottom: 15px; padding-left: 40px; \" 0247 class=\"pr0 pl0\"> 0248 <tr style=\"\"> 0249 <td style=\"\" class=\"f19\"> 0250 <p style=\"margin-top: 1em; padding-bottom: 10px;color: #484848; font-family:Helvetica, Arial, sans-serif; font-size: 21px; line-height: 30px; font-weight: 200;\"> 0251 Greetings, 0252 </p> 0253 0254 <p style=\"padding-bottom: 10px;color: #484848; font-family:Helvetica, Arial, sans-serif; font-size: 21px; line-height: 30px; font-weight: 200;\"> 0255 You know Kraken. We have a genuine passion for crypto and we=E2=80=99re not afraid to speak our mind or have a unique point of view -- even if it gets us into trouble sometimes ;) We don=E2=80=99t blindly conform, even when it=E2=80=99s popular or safe to do so. Like crypto, we=E2=80=99re not afraid to be different.=20 0256 </p> 0257 0258 <p style=\"padding-bottom: 10px;color: #484848; font-family:Helvetica, Arial, sans-serif; font-size: 21px; line-height: 30px; font-weight: 200;\"> 0259 Our branding should strongly reflect our values and personality. 0260 </p> 0261 0262 <p style=\"padding-bottom: 10px;color: #484848; font-family:Helvetica, Arial, sans-serif; font-size: 21px; line-height: 30px; font-weight: 200;\"> 0263 We reveal today (to our more than 4,000,000 clients across nearly 200 countries) new branding, including a website redesign.=20 0264 </p> 0265 0266 <p style=\"padding-bottom: 10px;color: #484848; font-family:Helvetica, Arial, sans-serif; font-size: 21px; line-height: 30px; font-weight: 400;\"> 0267 Your Guide to Experiencing the New Look of Kraken 0268 </p> 0269 0270 <ul style=\"padding-bottom: 10px;color: #484848; font-family:Helvetica, Arial, sans-serif; font-size: 21px; line-height: 30px; font-weight: 200;\"> 0271 <li><span style=\"font-weight:400;\"\">We are Kraken.</span> Don=E2=80=99t worry -- we=E2=80=99re not changing our name. Kraken is two syllables, fun to say, memorable, resonates with you emotionally, conjures strong mental imagery, doesn=E2=80=99t restrict our future offerings (e.g., no =E2=80=9Cbit=E2=80=9D, =E2=80=9Ccoin=E2=80=9D, =E2=80=9Cblock=E2=80=9D, =E2=80=9Cchain=E2=80=9D, =E2=80=9Ccrypto=E2=80=9D, etc.), contains an inherent sense of suspense and excitement, and plays on trading themes like liquidity, depth, dark pools, etc.</li> 0272 <li><span style=\"font-weight:400;\">Kraken stands out in a sea of boring blue.</span> A lot of companies, especially tech and financial services, like to use the color blue. It=E2=80=99s a safe and popular color, as well as associated with trust, honesty and dependability. The problem is that too many companies and brands use this color. As a result, blue then may as well be a boring beige. Bye-bye blue! Today we welcome a bolder color that is more unique, better represents our personality and is guaranteed to grab your attention. This new main color evokes feelings of richness and prestige, which is fitting considering Kraken has handled over $140,000,000,000 in trades and is one of the oldest and most respected crypto exchanges. </li> 0273 <li><span style=\"font-weight:400;\">A colorful industry deserves a colorful palette.</span> Something we really like about the crypto industry is its people. There=E2=80=99s something about this space that attracts the outspoken, devoted, opinionated, and eccentric. Our clients and team members are no different -- they are the most bright, colorful and interesting minds. In addition to the bold crypto community, the industry itself is constantly evolving -- it is alive, vibrant, fresh, and impactful. We have chosen to drape Kraken in a deliciously fitting and bold color scheme. </li> 0274 <li><span style=\"font-weight:400;\">Crypto is a rabbit hole, and we are all Alice.</span> Since learning about and experiencing crypto you may feel that you=E2=80=99ve been living a much more exhilarating, suspenseful, dramatic, and purposeful life. I guess that=E2=80=99s what happens when you join a global revolution. Crypto is a grand adventure that keeps you on the edge of your seat. It beckons the creative, rebellious and determined dreamers to rise and take action. This provocative spirit of crypto is brought to life in our new, adventure-themed illustrations. As you move around our site, allow your eyes to linger and get lost in the beautiful and quirky illustrations. </li> 0275 <li><span style=\"font-weight:400;\">Are you ready for us, consumer market?</span> Since 2013, we=E2=80=99ve been one of the most popular places to buy, sell, or trade crypto. A popular segment for us has always been pro traders who wield our advanced trading features and charts to turn profits. Our plan has been and will be to always keep our traders top of mind while expanding our appeal to all other segments and markets. In particular, we have known that our brand, personality and company mission have great potential in resonating with the consumer market. We haven=E2=80=99t been shy about <a href=\"https://www.kraken.com/why-kraken\">stating our purpose.</a> Kraken is here to pave the way for mass adoption of crypto and digital assets so that everyone can have financial freedom and inclusion. You will see our tone of voice, look and feel, products, UX, and interactions become more approachable, streamlined, easy-to-consume, and more cool and fun. Crypto is really freakin=E2=80=99 cool after all. It=E2=80=99s about time that the world knows this, too :)</li> 0276 <li><span style=\"font-weight:400;\">Kraken will continue to evolve.</span> Expect more improvements made and illustrations added to the website, as well as advancements in trading interfaces and products, like [insert trade.kraken.com link]. <a href=\"https://blog.kraken.com/post/2035/\">Go to our blog</a> to learn more about our rebranding efforts.</li> 0277 </ul> 0278 0279 <p style=\"padding-bottom: 10px;color: #484848; font-family:Helvetica, Arial, sans-serif; font-size: 21px; line-height: 30px; font-weight: 200;\"> 0280 Now you=E2=80=99re prepared for your crypto journey. Go to <a href=\"https://www.kraken.com/\">Kraken</a> and get pulled into the intoxicating adventure that awaits you.=20 0281 </p> 0282 0283 <p style=\"padding-bottom: 10px; color: #484848; font-family:Helvetica, Arial, sans-serif; font-size: 21px; line-height: 30px; font-weight: 200;\"> 0284 Thank you for choosing Kraken, the trusted and secure digital assets exchange. 0285 </p> 0286 0287 <p style=\"padding-bottom: 10px;color: #484848; font-family:Helvetica, Arial, sans-serif; font-size: 21px; line-height: 30px; font-weight: 200;\"> 0288 The Kraken Team 0289 </p> 0290 <!-- android spacer --> 0291 <table style=\"height: 4px;\" class=\"h15\"> 0292 <tr style=\"\"> 0293 <td height=\"1\" class=\"hide\" style=\"min-width:640px; font-size:0px;line-height:0px;\"> 0294 <img height=\"1\" src=\"https://www.kraken.com/img/kraken_dot.png?kec=9WmzuIaQF-wV1c\" style=\"min-width: 640px; text-decoration: none; border: none; -ms-interpolation-mode: bicubic;\" alt=\"\"> 0295 </td> 0296 </tr> 0297 </table> 0298 <!-- Close spacer Gmail Android --> 0299 <table style=\"height: 14px;\" class=\"h15\"> 0300 <tr style=\"\"> 0301 <td height=\"1\" class=\"hide\" style=\"min-width:640px; font-size:0px;line-height:0px;\"> 0302 <img height=\"1\" src=\"https://www.kraken.com/img/kraken_dot.png\" style=\"min-width: 640px; text-decoration: none; border: none; -ms-interpolation-mode: bicubic;\" alt=\"\"> 0303 </td> 0304 </tr> 0305 </table> 0306 </td> 0307 </tr> 0308 </table> 0309 </td> 0310 </tr> 0311 </table> 0312 </td> 0313 </tr> 0314 <tr style=\"\"> 0315 <td> 0316 <hr style=\"padding:0; border:none; margin-bottom:25px; background-color:#dbdbdb; height:1px;\"> 0317 </td> 0318 </tr> 0319 <tr> 0320 <td style=\"\" class=\"footer\"> 0321 <table style=\"\"> 0322 <tr style=\"\"> 0323 <td style=\"\" class=\"smedia\"> 0324 <table style=\"\"> 0325 <tr style=\"\"> 0326 <td style=\"font-family:Helvetica, Arial, sans-serif; font-size: 16px; line-height: 17px; color: #9B9B9B;\" class=\"f19 l21\"> 0327 spread the word 0328 </td> 0329 <td style=\"padding: 0 5px;\" class=\"pr10 pl10\"> 0330 <a style=\"\" href=\"https://twitter.com/krakenfx\" target=\"_blank\"> 0331 <img src=\"https://img.kraken.com/e/twitter.png\" width=\"14\" height=\"13\" style=\"display: block; border: none;\" alt=\"Twitter\" class=\"h21 w25\"> 0332 </a> 0333 </td> 0334 <td style=\"padding: 0 5px;\" class=\"pl10\"> 0335 <a style=\"\" href=\"https://www.facebook.com/KrakenFX/\" target=\"_blank\"> 0336 <img src=\"https://img.kraken.com/e/facebook.png\" width=\"14\" height=\"13\" style=\"display: block; border: none;\" alt=\"Facebook\" class=\"h21 w25\"> 0337 </a> 0338 </td> 0339 </tr> 0340 </table> 0341 </td> 0342 </tr> 0343 <tr style=\"\"> 0344 <td style=\"padding: 20px 0; font-family:Helvetica, Arial, sans-serif; font-size: 11px; line-height: 17px; font-weight: 200;\" class=\"f13 l20\"> 0345 This communication is a commercial message and its contents are intended for the recipient only and 0346 may contain confidential, non-public and/or privileged information. If you have received this 0347 communication in error, do not read, duplicate or distribute. Kraken does not make recommendations 0348 on the suitability of a particular asset class, strategy, or course of action. Any investment 0349 decision you make is solely your responsibility. Please consider your individual position and 0350 financial goals before making an independent investment decision. <br> 0351 Distributed by: Kraken.com, 237 Kearny St #102, San Francisco, CA 94108. 0352 </td> 0353 </tr> 0354 <tr style=\"\"> 0355 <td style=\"font-family:Helvetica, Arial, sans-serif; font-size: 13px; line-height: 17px; color: #9B9B9B;\"> 0356 This email contains important updates from Kraken. <a target=\"_blank\" href=\"https://www.kraken.com/unsubscribe?kec=9WmzuIaQF-wV1c\" style=\"color: #506D88; text-decoration: underline;\">Unsubscribe</a> 0357 </td> 0358 </tr> 0359 </table> 0360 </td> 0361 </tr> 0362 </table> 0363 </body> 0364 </html>" 0365 0366 var htmlPart = createTemporaryObject(htmlComponent, testCase, {content: data, autoLoadImages: true}) 0367 var htmlView = findChild(htmlPart, "htmlView"); 0368 verify(htmlView) 0369 tryVerify(function(){ return htmlView.loadProgress == 100}) 0370 tryVerify(function(){ return htmlPart.loaded}) 0371 0372 // tryVerify(function(){ return (1300 > htmlPart.contentWidth && htmlPart.contentWidth > 1200)}) 0373 // tryVerify(function(){ return (2800 > htmlPart.contentHeight && htmlPart.contentHeight > 2700)}) 0374 tryVerify(function(){ return (500 > htmlPart.contentWidth && htmlPart.contentWidth > 400)}) 0375 tryVerify(function(){ return (4100 > htmlPart.contentHeight && htmlPart.contentHeight > 3900)}) 0376 } 0377 0378 0379 }