How to use image.rotate method in Appium Android Driver

Best JavaScript code snippet using appium-android-driver

jquery.imBannerRotater.js

Source:jquery.imBannerRotater.js Github

copy

Full Screen

1/*2 * imBannerRotater - a JQuery Plugin3 * @author Les Green4 * Copyright (C) 2009 Intriguing Minds, Inc.5 * 6 * Version 2.0 - 20 May 20117 * 1. Added 'steps' option8 * 2. Created continuous effect, no longer scrolls back to beginning (portfolio, steps, carousel)9 * 3. Can create portfolio from existing image on page10 * 11 * Version 1.2 - 14 Jan 201112 * 1. Added quotes around "class" so will work in IE and Safari13 * 14 * Version 1.1 - 9 August 201015 * 1. Added portfolio option: 16 * 1. top and side navigation17 * 2. description - option: side, botttom18 * 3. Added easing - http://gsgd.co.uk/sandbox/jquery/easing/19 * 20 * 21 * Version 1.0 - 3 July 201022 * 1. Added interval option to have images fade in and out simultaneously when in 'rotate' mode23 * 2. Urls can be supplied for every mode, not just random24 * 3. Added title attribute to image data_map (image_title)25 * 4. Added Banner Carousel26 * 5. Added Global url_target. Default: '_blank'27 * 28 * This program is free software: you can redistribute it and/or modify29 * it under the terms of the GNU General Public License as published by30 * the Free Software Foundation, either version 3 of the License, or31 * (at your option) any later version.32 *33 * This program is distributed in the hope that it will be useful,34 * but WITHOUT ANY WARRANTY; without even the implied warranty of35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the36 * GNU General Public License for more details.37 *38 * You should have received a copy of the GNU General Public License39 * along with this program. If not, see <http://www.gnu.org/licenses/>.40 * Demo and Documentation can be found at: 41 * http://www.grasshopperpebbles.com42 * 43 */44 45;(function($) {46 $.fn.extend({47 imBannerRotater: function(options) { 48 opts = $.extend({}, $.bannerRotater.defaults, options);49 return this.each(function() {50 new $.bannerRotater(this, opts);51 });52 }53 }); 54$.bannerRotater = function(obj, opts) {55 var $this = $(obj);56 var cId, margTop;57 var imgCnt = 0, totalItems = 0, displayWidth, currentIndex = 0, selectedIndex = 0, nLeft = 0, ttlWidth = 0;58 var aImages = [];59 if (opts.easing) {60 jQuery.easing.def = opts.easing;61 }62 if (opts.image_url) {63 if (opts.image_url == 'self') {64 doCreate('self');65 } else {66 var d = getDataString();67 doAjax('GET', opts.image_url, d, '', doCreate);68 }69 } else if (opts.images) {70 doCreate(opts.images);71 } else {72 alert("No Images to load");73 }74 75 function getDataString() {76 var str = '';77 $.each(opts.data, function(i, itm) {78 str += itm.name + "=" + itm.value + "&"; 79 });80 //remove last "&"81 str = str.substr(0, (str.length-1));82 return str;83 };84 85 function doAjax(t, u, d, fnBefore, fnSuccess) {86 var dt = (opts.return_type == 'json') ? 'json' : 'text';87 $.ajax({88 type: t,89 url: u,90 data: d,91 dataType: dt,92 beforeSend: fnBefore, //function(){$("#loading").show("fast");}, //show loading just when link is clicked93 //complete: function(){ $("#loading").hide("fast");}, //stop showing loading when the process is complete94 success: fnSuccess,95 error: showError96 }); //close $.ajax(97 };98 99 function showError(XMLHttpRequest, textStatus, errorThrown) {100 console.log(textStatus);101 };102 103 function doCreate(data) {104 105 var img, tgt, url, ttl, desc, lnk, src, w, h, cId;106 var showVertNav = false;107 if (opts.return_type == 'list') {108 var daAR = data.split(',');109 } 110 if (data == 'self') {111 var id = $this.attr('id');112 var daAR = new Array();113 if ($('#'+id+ ' ul li').length <= 1) {114 cId = $this.attr('id');115 $('#'+cId).remove();116 return;117 } 118 $('#'+id+ ' ul li').each(function(i, itm) {119 lnk = $(this).children('a')[0];120 //console.log(lnk);121 if (lnk) {122 url = $(lnk).attr('href');123 tgt = $(lnk).attr('target');124 tgt = (tgt) ? tgt : '_blank';125 img = $(lnk).children('img')[0];126 } else {127 url = '';128 tgt = '';129 img = $(this).children('img')[0];130 }131 //console.log(img);132 if ($(img).attr('src') == '') return; 133 w = $(img).width();134 h = $(img).height();135 ttl = $(img).attr('alt');136 if (ttl == '') {137 ttl = $(img).attr('title');138 }139 src = $(img).attr('src');140 // console.log(src);141 desc = $(this).children('div')[0];142 desc = $(desc).html();143 daAR[i] = new Array(src, url, ttl, desc, tgt, w, h);144 });145 146 } else {147 var daAR = new Array();148 $.each(data, function(i, itm) {149 if (opts.data_map.url_name) {150 ttl = (opts.data_map.image_title) ? itm[opts.data_map.image_title] : itm[opts.data_map.image_name];151 desc = (opts.data_map.image_desc) ? itm[opts.data_map.image_desc] : '';152 tgt = (opts.data_map.url_target) ? itm[opts.data_map.url_target] : opts.url_target;153 daAR[i] = new Array(itm[opts.data_map.image_name], itm[opts.data_map.url_name], ttl, desc, tgt);154 } else {155 daAR[i] = itm[opts.data_map.image_name];156 } 157 });158 }159 totalItems = daAR.length;160 if (totalItems > 1) {161 switch (opts.mode) {162 case 'random':163 createRandom(daAR);164 break;165 case 'rotate':166 createRotate(daAR);167 break;168 case 'carousel':169 createCarousel(daAR);170 break;171 case 'portfolio':172 createPortfolio(daAR);173 break;174 case 'steps':175 margTop = opts.steps_large_height - opts.steps_small_height;176 //createSteps(daAR);177 createPortfolio(daAR);178 break; 179 }180 } else {181 if (data == 'self') {182 cId = $this.attr('id');183 $('#'+cId).remove();184 }185 }186 };187 188 function createRandom(daAR) {189 img = new Image();190 if (opts.data_map.url_name) {191 var obj = getImageObject(daAR[Math.floor(Math.random() * daAR.length)]);192 $this.append($('<a></a>').attr({193 'href': obj.url,194 'target': obj.tgt195 }).append($(img).attr({196 src: obj.pic,197 title: obj.title198 })));199 }200 else {201 var pic = opts.base_path + daAR[Math.floor(Math.random() * daAR.length)];202 $this.append($(img).attr({203 src: pic,204 title: pic205 }));206 }207 };208 209 function createRotate(daAR){210 var img, obj;211 for (var i = 0; i < totalItems; i++) {212 img = new Image();213 if (opts.data_map.url_name) {214 obj = getImageObject(daAR[i]);215 var a = $('<a></a>').attr({216 'href': obj.url,217 'target': obj.tgt,218 'id': 'imImageRotate' + i219 }).css({220 'display': 'none',221 'position': 'relative',222 'zIndex': 1000 - (totalItems + i)223 }).append($(img).attr({224 src: obj.pic,225 title: obj.title226 })).appendTo($this);227 aImages[i] = $(a).width();228 229 }230 else {231 var pic = opts.base_path + daAR[i];232 $this.append($(img).attr({233 src: pic,234 title: daAR[i],235 'id': 'imImageRotate' + i236 }).css({237 'display': 'none',238 'position': 'relative',239 'zIndex': 1000 - (totalItems + i)240 }));241 aImages[i] = $(img).width();242 }243 }244 if (opts.interval) {245 setFadeInterval();246 }247 else {248 imgFadeIn();249 }250 };251 252 function createCarousel(daAR) {253 var img, obj, pic;254 cId = $this.attr('id');255 256 $this.append($('<div></div>').attr({257 "id": cId + "-imImageRotate-SlideCntnr",258 "class": "imImageRotate-SlideCntnr"259 }).append($('<div></div>').attr({260 "id": cId + "-imImageRotate-Slider",261 "class": "imImageRotate-Slider"262 })));263 264 for (var i = 0; i < totalItems; i++) {265 createImage(i, cId, doAR);266 }267 nLeft = aImages[0];268 setCarouselInterval();269 };270 271 /*function createCarouselOld(daAR) {272 var li, pic, obj;273 var ul = $('<ul></ul>').appendTo($this);274 for (var i = 0; i < totalItems; i++) {275 img = new Image();276 if (opts.data_map.url_name) {277 obj = getImageObject(daAR[i]);278 li = $('<li></li>').attr('id', 'imImageRotate' + i).append($('<a></a>').attr({279 'href': obj.url,280 'target': obj.tgt281 }).append($(img).attr({282 src: obj.pic,283 title: obj.title284 }))).appendTo($(ul));285 aImages[i] = $(li).width() + parseInt($(li).css('marginLeft'));286 }287 else {288 pic = opts.base_path + daAR[i];289 $('<li></li>').attr('id', 'imImageRotate' + i).append($(img).attr({290 src: pic,291 title: daAR[i]292 })).appendTo($(ul));293 }294 }295 nLeft = aImages[0];296 setCarouselInterval();297 };*/298 299 function createPortfolio(daAR) {300 cId = $this.attr('id');301 if (opts.image_url == 'self') {302 //console.log(cId);303 //$('#'+cId).empty();304 $('#'+cId).html('');305 }306 createCntnr(cId);307 createVerticalNavCntnr(cId);308 createSideNav(cId);309 if (opts.mode == 'steps') {310 $("#" + cId + "-imImageRotate-Slider").css('visibility', 'hidden');311 }312 for (var i = 0; i < totalItems; i++) {313 createImage(i, cId, daAR);314 createVerticalNav(cId, i);315 }316 if (opts.mode == 'steps') {317 $("#" + cId + "-imImageRotate-Slider").css('visibility', 'visible');318 }319 createVerticalNavClickEvent(cId);320 setDescDisplayOption(cId);321 displayWidth = $('#' + cId + "-imImageRotate-DisplayCntnr0").width();322 if (opts.interval) {323 setInterval(portfolioChange, opts.interval);324 }325 };326 327 function setFadeInterval() {328 intervalFadeIn();329 setInterval(intervalFadeOut, opts.interval);330 };331 332 function intervalFadeIn() {333 $("#imImageRotate"+imgCnt).fadeIn(opts.speed, function(){334 $("#imImageRotate"+imgCnt).css('left', '0px');335 });336 };337 338 function intervalFadeOut() {339 $("#imImageRotate"+imgCnt).fadeOut(opts.speed);340 if (imgCnt == totalItems - 1) {341 $("#imImageRotate"+imgCnt).css('left', -aImages[imgCnt]);342 imgCnt = 0;343 } else {344 imgCnt++;345 }346 //imgCnt = (imgCnt == totalItems - 1) ? 0 : imgCnt + 1;347 if (imgCnt == 0) {348 $("#imImageRotate0").css('left', 0);349 }350 else {351 $("#imImageRotate" + imgCnt).css('left', -aImages[imgCnt]);352 }353 intervalFadeIn();354 };355 356 function imgFadeIn() {357 $("#imImageRotate"+imgCnt).fadeIn(opts.speed, function(){358 imgFadeOut();359 });360 };361 362 function imgFadeOut() {363 $("#imImageRotate"+imgCnt).fadeOut(opts.speed, function(){364 imgCnt = (imgCnt == totalItems - 1) ? 0 : imgCnt + 1;365 imgFadeIn();366 });367 };368 369 function setCarouselInterval() {370 setInterval(imgCarousel, opts.interval);371 };372 373 function imgCarousel() {374 $('ul', $this).animate({left: -nLeft+'px'}, opts.speed, function() {375 var lPos = $('ul li:last', $this).offset();376 var thisPos = $this.offset();377 if ((lPos.left + $('ul li:last', $this).width()) < (thisPos.left + $this.width())) {378 imgCnt = 0;379 nLeft = 0;380 } else {381 imgCnt++;382 nLeft += aImages[imgCnt-1];383 }384 385 var img0 = $("#" + cId + "-imImageRotateImage" + currentIndex);386 $(img0).parent().parent().appendTo($("#" + cId + "-imImageRotate-Slider"));387 $(img0).width($(img).data('size').sW).css({'margin-top': margTop + 'px', 'margin-left': '0px'});388 389 390 391 var ul = $('<ul></ul>').appendTo($this);392 for (var i = 0; i < totalItems; i++) {393 img = new Image();394 if (opts.data_map.url_name) {395 obj = getImageObject(daAR[i]);396 li = $('<li></li>').attr('id', 'imImageRotate' + i).append($('<a></a>').attr({397 'href': obj.url,398 'target': obj.tgt399 }).append($(img).attr({400 src: obj.pic,401 title: obj.title402 }))).appendTo($(ul));403 aImages[i] = $(li).width() + parseInt($(li).css('marginLeft'));404 }405 else {406 pic = opts.base_path + daAR[i];407 $('<li></li>').attr('id', 'imImageRotate' + i).append($(img).attr({408 src: pic,409 title: daAR[i]410 })).appendTo($(ul));411 }412 }413 });414 };415 416 function portfolioMoveNext() {417 if (selectedIndex < totalItems-1) {418 selectedIndex++;419 showPortfolio();420 }421 };422 423 function portfolioMovePrev() {424 if (selectedIndex > 0) {425 selectedIndex--;426 showPortfolio();427 }428 };429 430 function portfolioChange() {431 selectedIndex = (selectedIndex < totalItems-1) ? selectedIndex + 1 : 0;432 showPortfolio();433 };434 435 function showPortfolio() {436 //setVertNav();437 //if (opts.mode == 'portfolio') {438 doPortfolioMove(); 439 //} else {440 441 //}442 443 };444 445 function setVertNav() {446 $("#"+cId + "-imImageRotate-Vert-Nav ul li").removeClass('selected');447 var nav = $("#"+cId + "-imImageRotate-Vert-Nav ul li")[selectedIndex];448 $(nav).addClass('selected');449 };450 451 function doPortfolioMove() {452 var nextIndex = (selectedIndex < totalItems-1) ? selectedIndex + 1 : 0;453 var fin = -(selectedIndex * displayWidth);454 if (opts.mode == 'portfolio') {455 $("#" + cId + "-imImageRotate-Slider").animate({456 left: fin + 'px'457 }, opts.speed, function(){458 setVertNav();459 });460 } else {461 /* $("#" + cId + "-imImageRotate-Slider").animate({462 left: fin + 'px', 463 }, opts.speed, function(){464 setVertNav();465 });*/466 var img0 = $("#" + cId + "-imImageRotateImage" + currentIndex);467 var img = $("#" + cId + "-imImageRotateImage" + selectedIndex);468 var img2 = $("#" + cId + "-imImageRotateImage" + nextIndex);469 var w = $(img0).css('width');470 //var img = $('#imImageRotateCntnr-imImageRotate-SlideCntnr #imImageRotateCntnr-imImageRotate-DisplayCntnr3 a img');471 $(img0).animate({472 'margin-left': '-'+w473 }, opts.speed, function() {474 setVertNav();475 $(img0).parent().parent().appendTo($("#" + cId + "-imImageRotate-Slider"));476 $(img0).width($(img).data('size').sW).css({'margin-top': margTop + 'px', 'margin-left': '0px'});477 });478 $(img).animate({479 width: $(img).data('size').sW,480 height: $(img).data('size').sH,481 'margin-top': margTop + 'px' 482 }, opts.speed );483 $(img2).animate({484 width: $(img2).data('size').lW,485 height: $(img2).data('size').lH,486 'margin-top': 0487 }, opts.speed);488 }489 currentIndex = selectedIndex;490 };491 492 function createCntnr(cId) {493 $this.append($('<div></div>').attr({494 "id": cId + "-imImageRotate-Side-Nav-Left",495 "class": "imImageRotate-Side-Nav"496 }).append($('<div></div>').attr({497 "id": cId + "-imImageRotate-PrevBtn",498 "class": "imImageRotate-PrevBtn"499 })), $('<div></div>').attr({500 "id": cId + "-imImageRotate-SlideCntnr",501 "class": "imImageRotate-SlideCntnr"502 }).append($('<div></div>').attr({503 "id": cId + "-imImageRotate-Slider",504 "class": "imImageRotate-Slider"505 })), $('<div></div>').attr({506 "id": cId + "-imImageRotate-Side-Nav-Right",507 "class": "imImageRotate-Side-Nav"508 }).append($('<div></div>').attr({509 "id": cId + "-imImageRotate-NextBtn",510 "class": "imImageRotate-NextBtn"511 })));512 };513 514 function createVerticalNavCntnr(cId) {515 if ((opts.show_vert_nav != '') || (opts.show_vert_nav != 'no')) {516 showVertNav = true;517 var vertNav = $('<div></div>').attr({518 "id": cId + "-imImageRotate-Vert-Nav",519 "class": "imImageRotate-Vert-Nav"520 }).append($('<ul></ul>'));521 if (opts.show_vert_nav == 'top') {522 $this.prepend($(vertNav));523 } else if (opts.show_vert_nav == 'bottom') {524 $this.append($(vertNav));525 }526 $(vertNav).show();527 }528 };529 530 function createVerticalNav(cId, i) {531 if (showVertNav) {532 $("#"+cId + "-imImageRotate-Vert-Nav ul").append($('<li></li>').data('liIndex', i));533 if (i == 0) {534 $("#"+cId + "-imImageRotate-Vert-Nav ul li").attr('class', 'selected');535 }536 }537 };538 539 function createVerticalNavClickEvent(cId) {540 if (showVertNav) {541 $("#"+cId + "-imImageRotate-Vert-Nav ul li").click(function() {542 selectedIndex = $(this).data('liIndex');543 showPortfolio();544 });545 }546 };547 548 function createSideNav(cId) {549 if (opts.show_side_nav) {550 $('#'+cId+" .imImageRotate-Side-Nav").show();551 $('#'+cId+"-imImageRotate-NextBtn").click(function() {552 portfolioMoveNext();553 });554 $('#'+cId+"-imImageRotate-PrevBtn").click(function() {555 portfolioMovePrev();556 });557 }558 };559 560 function createImage(i, cId, daAR) {561 var img = new Image();562 if ((opts.data_map.url_name) || (opts.image_url == 'self')) {563 var obj = getImageObject(daAR[i]);564 $('<div></div>').attr({565 id: cId + "-imImageRotate-DisplayCntnr" + i,566 "class": "imImageRotate-DisplayCntnr"567 }).append($('<a></a>').attr({568 'href': obj.url,569 'target': obj.tgt570 }).append($(img).attr({571 src: obj.pic,572 title: obj.title,573 id: cId + "-imImageRotateImage" + i574 })),575 $('<div></div>').attr({576 id: cId + "-imImageRotate-TextCntnr" + i,577 "class": "imImageRotate-TextCntnr"578 }).append($('<h2></h2>').html(obj.title),579 $('<p></p>').html(obj.desc))580 ).appendTo("#" + cId + "-imImageRotate-Slider");581 if (opts.mode == 'steps') {582 tf = initImageSize(img, i);583 }584 if (opts.image_url == 'self') {585 if ((opts.max_height) || (opts.max_width)) {586 tf = setMaxSize(img, daAR[i]);587 }588 }589 //if (i != 1) {590 //$(div).css('margin-top', margTop + 'px');591 //}592 }593 else {594 var pic = opts.base_path + daAR[i];595 $('<div></div>').attr('id', cId + "-imImageRotate-DisplayCntnr" + i).append($(img).attr({596 src: pic,597 title: daAR[i]598 })).appendTo("#" + cId + "-imImageRotate-Slider");599 }600 };601 602 function getImageObject(ar) {603 var obj = new Object();604 obj.pic = opts.base_path + ar[0]; 605 obj.url = ar[1];606 obj.title = ar[2];607 obj.desc = ar[3],608 obj.tgt = ar[4];609 return obj;610 };611 612 function setDescDisplayOption(cId) {613 if (opts.show_desc == 'onhover') {614 $('#'+cId+' .imImageRotate-DisplayCntnr a').hover(615 function () {616 $(this).siblings('.imImageRotate-TextCntnr').show();617 }, 618 function () {619 $(this).siblings('.imImageRotate-TextCntnr').hide();620 }621 );622 } else if (opts.show_desc == 'onload') {623 $('#'+cId+' .imImageRotate-TextCntnr').show();624 }625 };626 627 function setMaxSize(img, ar) {628 var imgH, imgSize;629 var w = ar[5];630 var h = ar[6];631 632 if (opts.max_height) {633 imgSize = getNewSize(w, h, opts.max_height, 'height'); 634 } else if (opts.max_width) {635 imgSize = getNewSize(w, h, opts.max_width, 'width');636 }637 $(img).css({638 'width': imgSize[0],639 'height': imgSize[1]640 });641 return true;642 };643 644 function initImageSize(img, cnt) {645 var imgH, imgSize;646 var w = $(img).width();647 var h = $(img).height();648 imgSize = getNewSize(w, h, opts.steps_small_height, 'height');649 lrgSize = getNewSize(w, h, opts.steps_large_height, 'height');650 //imgH = (cnt == 1) ? opts.steps_large_height: opts.steps_small_height;651 //imgSize = getNewSize(w, h, imgH);652 if (cnt == 1) {653 $(img).css({654 'width': lrgSize[0],655 'height': lrgSize[1]656 });657 } else {658 $(img).css({659 'width': imgSize[0],660 'height': imgSize[1],661 'margin-top': margTop + 'px'662 });663 }664 665 //var el = $('#' +cId + "-imImageRotateImage" + cnt);666 $(img).data('size', { sW: imgSize[0], sH: imgSize[1], lW: lrgSize[0], lH: lrgSize[1] });667 //$.data(el, "size", { sW: imgSize[0], sH: imgSize[1], lW: lrgSize[0], lH: lrgSize[1] });668 //console.log($.data(img, "size").sW); 669 return true;670 671 };672 673 function adjustImageSize(nCurSize, nMaxSize) {674 var nPerc = (nCurSize > nMaxSize) ? nMaxSize/nCurSize : 1; 675 return nPerc;676 };677 function getNewSize(nW, nH, nMaxSize, sizeType) {678 var imgSize = new Array();679 var s = (sizeType == 'height') ? nH : nW;680 var nPerc = adjustImageSize(s, nMaxSize);681 var newH = nH*nPerc;682 var newW = nW*nPerc;683 imgSize.push(newW, newH);684 return imgSize;685 };686};687$.bannerRotater.defaults = {688 mode: 'random',//rotate, carousel, portfolio, steps689 //portfolio_cols: '1', // the number of columns. 1 is the default690 steps_large_height: '',691 steps_small_height: '',692 interval: '',//5000693 image_url: '',694 data: '',695 images: '',//can be used instead of image_url. contains comma delimited list of images696 return_type: 'list', //list, json697 base_path: '',698 url_target: '_blank',699 data_map: '', //{image_name: '', image_title: '', url_name: '', url_target: '_blank', image_desc: ''}700 speed: 1500,701 easing: 'easeOutElastic',702 show_side_nav: true,703 show_vert_nav: 'top', // bottom, 704 show_desc: 'onhover',// onload, never705 max_height: '',706 max_width: ''707};...

Full Screen

Full Screen

104.rotate.js

Source:104.rotate.js Github

copy

Full Screen

...27 });28 describe('90 degs', function() {29 it('should succeed', function(done) {30 current.push(90, 'degs');31 image.rotate(90, done);32 });33 });34 describe('180 degs', function() {35 it('should succeed', function(done) {36 current.push(180, 'degs');37 image.rotate(180, done);38 });39 });40 describe('270 degs', function() {41 it('should succeed', function(done) {42 current.push(270, 'degs');43 image.rotate(270, done);44 });45 });46 describe('360 degs', function() {47 it('should succeed', function(done) {48 current.push(360, 'degs');49 image.rotate(360, done);50 });51 });52 describe('450 degs', function() {53 it('should succeed', function(done) {54 current.push(450, 'degs');55 image.rotate(450, done);56 });57 });58 describe('-90 degs', function() {59 it('should succeed', function(done) {60 current.push(-90, 'degs');61 image.rotate(-90, done);62 });63 });64 describe('-180 degs', function() {65 it('should succeed', function(done) {66 current.push(-180, 'degs');67 image.rotate(-180, done);68 });69 });70 });71 describe('arbitrary angles and fills', function() {72 beforeEach(function() {73 current = [basename];74 });75 describe('33 degs, unspecified fill', function() {76 it('should succeed', function(done) {77 current.push(33, 'degs', 'unspecifiedFill');78 image.rotate(33, done);79 });80 });81 describe('-33 degs, "yellow" fill', function() {82 it('should succeed', function(done) {83 current.push(-33, 'degs', 'yellow');84 image.rotate(-33, 'yellow', done);85 });86 });87 describe('45 degs, [50,100,300,75] fill', function() {88 it('should succeed', function(done) {89 current.push(45, 'degs', [50, 100, 250,75]);90 image.rotate(45, [50, 100, 250, 75], done);91 });92 });93 describe('-5 degs, {r:200,g:110,b:220} fill', function() {94 it('should succeed', function(done) {95 current.push(-5, 'degs', 'r-200,g-110,b-220');96 image.rotate(-5, {97 r: 200,98 g: 110,99 b: 220100 }, done);101 });102 });103 describe('-5 degs, {r:200,g:110,b:220,a:50} fill', function() {104 it('should succeed', function(done) {105 current.push(-5, 'degs', 'r-200,g-110,b-220,a-50');106 image.rotate(-5, {107 r: 200,108 g: 110,109 b: 220,110 a: 50111 }, done);112 });113 });114 });...

Full Screen

Full Screen

case_5_image_rotate.js

Source:case_5_image_rotate.js Github

copy

Full Screen

1// Copyright (C) 2020-2021 Intel Corporation2//3// SPDX-License-Identifier: MIT4/// <reference types="cypress" />5import { taskName } from '../../support/const';6context('Check if the image is rotated', () => {7 const caseId = '5';8 function imageRotate(direction = 'anticlockwise') {9 cy.interactControlButton('rotate-canvas');10 if (direction === 'clockwise') {11 cy.get('.cvat-rotate-canvas-controls-right').click();12 } else {13 cy.get('.cvat-rotate-canvas-controls-left').click();14 }15 cy.get('.cvat-canvas-container').click(); // Hide popover16 cy.get('.cvat-rotate-canvas-popover').should('be.hidden');17 }18 function scaleFitImage() {19 let scaleBefore, scaleAfter;20 cy.get('#cvat_canvas_background')21 .should('have.attr', 'style')22 .then(($styles) => {23 scaleBefore = Number($styles.match(/scale\((\d\.\d+)\)/m)[1]);24 });25 cy.get('.cvat-canvas-container').trigger('wheel', { deltaY: 5 });26 cy.get('#cvat_canvas_background')27 .should('have.attr', 'style')28 .then(($styles) => {29 scaleAfter = Number($styles.match(/scale\((\d\.\d+)\)/m)[1]);30 cy.expect(scaleBefore).to.be.greaterThan(scaleAfter);31 cy.get('#cvat_canvas_content').dblclick();32 cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', scaleBefore);33 });34 cy.get('.cvat-rotate-canvas-popover-visible').should('not.exist');35 }36 before(() => {37 cy.openTaskJob(taskName);38 });39 describe(`Testing case "${caseId}"`, () => {40 it('Rotate image clockwise 90deg', () => {41 imageRotate('clockwise');42 cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(90deg);');43 scaleFitImage();44 });45 it('Rotate image clockwise 180deg', () => {46 imageRotate('clockwise');47 cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(180deg);');48 scaleFitImage();49 });50 it('Rotate image clockwise 270deg', () => {51 imageRotate('clockwise');52 cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(270deg);');53 scaleFitImage();54 });55 it('Rotate image clockwise 360deg', () => {56 imageRotate('clockwise');57 cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(0deg);');58 scaleFitImage();59 });60 it('Rotate image anticlockwise 90deg', () => {61 imageRotate();62 cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(270deg);');63 scaleFitImage();64 });65 it('Rotate image anticlockwise 180deg', () => {66 imageRotate();67 cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(180deg);');68 scaleFitImage();69 });70 it('Rotate image anticlockwise 270deg', () => {71 imageRotate();72 cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(90deg);');73 scaleFitImage();74 });75 it('Rotate image anticlockwise 360deg', () => {76 imageRotate();77 cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(0deg);');78 scaleFitImage();79 });80 });...

Full Screen

Full Screen

multi-image-rotate.1561124404.js

Source:multi-image-rotate.1561124404.js Github

copy

Full Screen

1; (function ($, window, document, undefined) {2 let pluginName = 'VashiMultiImageRotate',3 defaults = {4 slideContainer: '.widget__image-rotate',5 slideClass: '.image-rotate__image',6 headClass: '.widget__head',7 actionsClass: '.widget__actions',8 transitionSpeed: 4000,9 };10 function VashiMultiImageRotate(element, options) {11 this.$element = $(element);12 this.options = $.extend({}, defaults, options);13 this.$container = this.$element.find(this.options.slideContainer);14 this.$head = this.$element.find(this.options.headClass);15 this.$actions = this.$element.find(this.options.actionsClass);16 //array of slides17 this.$slides = this.$element.find(this.options.slideClass);18 this.slideCount = this.$slides.length;19 this.prevSlide = 0;20 this.activeSlide = 0;21 this.bindButtons();22 this.init();23 }24 VashiMultiImageRotate.prototype.init = function () {25 this.addImageClasses();26 this.initialAnimation();27 this.startRotating = this.startRotating.bind(this);28 var _this = this;29 setTimeout(function () {30 this.interval = setInterval(_this.startRotating, _this.options.transitionSpeed); 31 }, 500)32 }33 VashiMultiImageRotate.prototype.addImageClasses = function () {34 var that = this;35 _.each(this.$slides, function (el, i) {36 if (i === that.activeSlide) {37 that.setActiveSlide(el);38 } else {39 that.setInactiveSlide(el);40 }41 });42 }43 VashiMultiImageRotate.prototype.setActiveSlide = function (el) {44 $(el).removeClass('slide-inactive');45 $(el).addClass('slide-active');46 }47 VashiMultiImageRotate.prototype.setInactiveSlide = function (el) {48 $(el).removeClass('slide-active');49 $(el).addClass('slide-inactive');50 }51 VashiMultiImageRotate.prototype.initialAnimation = function () {52 _.each([this.$head, this.$actions, this.$container], function ($el, i) {53 setTimeout(function () {54 $el.addClass('active');55 }, i * 300);56 });57 }58 VashiMultiImageRotate.prototype.startRotating = function () {59 var prevSlide = this.activeSlide;60 var nextSlide = this.activeSlide === this.slideCount - 1 ? 0 : this.activeSlide + 1;61 this.setInactiveSlide(this.$slides[prevSlide]);62 this.setActiveSlide(this.$slides[nextSlide]);63 this.toggleContainerClass();64 this.prevSlide = prevSlide;65 this.activeSlide = nextSlide;66 }67 VashiMultiImageRotate.prototype.toggleContainerClass = function () {68 this.$element.removeClass('widget--slide-' + this.prevSlide);69 this.$element.addClass('widget--slide-' + this.activeSlide);70 }71 VashiMultiImageRotate.prototype.bindButtons = function () {72 if (this.$element.hasClass('book-viewing')) {73 this.$actions.find('.button').addClass('book-a-viewing-drawer-trigger');74 }75 }76 $.fn[pluginName] = function (options) {77 return this.each(function () {78 if (!$.data(this, 'plugin_' + pluginName)) {79 $.data(80 this, 'plugin_' + pluginName,81 new VashiMultiImageRotate(this, options)82 );83 }84 });85 }...

Full Screen

Full Screen

103.image.rotate.js

Source:103.image.rotate.js Github

copy

Full Screen

1// methods should throw errors when arguments are invalid2var should = require("should"),3 lwip = require('../../'),4 imgs = require('../imgs');5describe('image.rotate arguments validation', function() {6 var image;7 before(function(done) {8 lwip.open(imgs.jpg.rgb, function(err, img) {9 image = img;10 done(err);11 });12 });13 describe('invalid color object (1)', function() {14 it('should throw an error', function() {15 image.rotate.bind(image, 5, {16 foo: 'bar',17 bar: 'foo'18 }, function() {}).should.throwError();19 });20 });21 describe('invalid color object (2)', function() {22 it('should throw an error', function() {23 image.rotate.bind(image, 5, {24 r: -5,25 g: -8,26 b: -100027 }, function() {}).should.throwError();28 });29 });30 describe('invalid color array (1)', function() {31 it('should throw an error', function() {32 image.rotate.bind(image, 5, ['a', 'b'], function() {}).should.throwError();33 });34 });35 describe('invalid color array (2)', function() {36 it('should throw an error', function() {37 image.rotate.bind(image, 5, ['a', 'b', 'c'], function() {}).should.throwError();38 });39 });40 describe('invalid color array (3)', function() {41 it('should throw an error', function() {42 image.rotate.bind(image, 5, [100, -100, 100], function() {}).should.throwError();43 });44 });45 describe('invalid color array (4)', function() {46 it('should throw an error', function() {47 image.rotate.bind(image, 5, [100, 100, -100], function() {}).should.throwError();48 });49 });50 describe('invalid color array (5)', function() {51 it('should throw an error', function() {52 image.rotate.bind(image, 5, [1000, 100, 100], function() {}).should.throwError();53 });54 });55 describe('invalid color array (6)', function() {56 it('should throw an error', function() {57 image.rotate.bind(image, 5, [100, 1000, 100], function() {}).should.throwError();58 });59 });60 describe('invalid color array (7)', function() {61 it('should throw an error', function() {62 image.rotate.bind(image, 5, [100, 100, 1000], function() {}).should.throwError();63 });64 });65 describe('invalid color string', function() {66 it('should throw an error', function() {67 image.rotate.bind(image, 5, 'foo', function() {}).should.throwError();68 });69 });...

Full Screen

Full Screen

rotate-right.js

Source:rotate-right.js Github

copy

Full Screen

1import React from 'react';2import pure from 'recompose/pure';3import SvgIcon from '../../SvgIcon';4let ImageRotateRight = (props) => (5 <SvgIcon {...props}>6 <path d="M15.55 5.55L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45zM19.93 11c-.17-1.39-.72-2.73-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47h2.02zM13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03zm3.89-2.42l1.42 1.41c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.48z"/>7 </SvgIcon>8);9ImageRotateRight = pure(ImageRotateRight);10ImageRotateRight.displayName = 'ImageRotateRight';...

Full Screen

Full Screen

rotate-left.js

Source:rotate-left.js Github

copy

Full Screen

1import React from 'react';2import pure from 'recompose/pure';3import SvgIcon from '../../SvgIcon';4let ImageRotateLeft = (props) => (5 <SvgIcon {...props}>6 <path d="M7.11 8.53L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47zM6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47zm1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93z"/>7 </SvgIcon>8);9ImageRotateLeft = pure(ImageRotateLeft);10ImageRotateLeft.displayName = 'ImageRotateLeft';...

Full Screen

Full Screen

rotate.js

Source:rotate.js Github

copy

Full Screen

1$(function () {2 'use strict';3 var $image = $(window.createCropperImage());4 $image.cropper({5 built: function () {6 var image = $image.data('cropper').image;7 QUnit.test('methods.rotate', function (assert) {8 assert.ok(image.rotate === 0);9 $image.cropper('rotate', 360);10 assert.ok(image.rotate === 0);11 $image.cropper('rotate', 30);12 assert.ok(image.rotate === 30);13 $image.cropper('rotate', -15);14 assert.ok(image.rotate === 15);15 $image.cropper('rotate', -15);16 assert.ok(image.rotate === 0);17 });18 }19 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.rotate('LANDSCAPE');2driver.rotate('PORTRAIT');3driver.rotate('LANDSCAPE');4driver.rotate('PORTRAIT');5driver.rotate('LANDSCAPE');6driver.rotate('PORTRAIT');7driver.rotate('LANDSCAPE');8driver.rotate('PORTRAIT');9driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var desiredCaps = {4};5var driver = wd.promiseChainRemote('localhost', 4723);6 .init(desiredCaps)7 .elementByClassName('android.widget.EditText').sendKeys('test')8 .elementByClassName('android.widget.Button').click()9 .elementByClassName('android.widget.ImageView').click()10 .elementByClassName('android.widget.ImageView').rotate(90)11 .sleep(10000)12 .quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var caps = {4};5var driver = wd.promiseChainRemote('localhost', 4723);6 .init(caps)7 .sleep(10000)8 .elementByAccessibilityId('Graphics').click()9 .elementByAccessibilityId('Rotate').click()10 .sleep(5000)11 .rotate('LANDSCAPE')12 .sleep(5000)13 .rotate('PORTRAIT')14 .sleep(5000)15 .quit();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Android Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful