From bb7d11394cdfaebdfef3ff72385fe3382bcf69be Mon Sep 17 00:00:00 2001 From: "wanmingx.lin" Date: Tue, 4 Jun 2013 19:15:18 +0800 Subject: [PATCH] Improve Camera into two TCs in behavior --- index.html | 1 + tests/Camera/Camera.html | 24 ++--- tests/Camera/index.html | 2 +- tests/Camera/js/main.js | 193 ++++++++++++++++++----------------------- tests/UserMedia/UserMedia.html | 71 +++++++++++++++ tests/UserMedia/icon.png | Bin 0 -> 2229 bytes tests/UserMedia/index.html | 39 +++++++++ tests/UserMedia/js/main.js | 49 +++++++++++ 8 files changed, 255 insertions(+), 124 deletions(-) create mode 100755 tests/UserMedia/UserMedia.html create mode 100644 tests/UserMedia/icon.png create mode 100755 tests/UserMedia/index.html create mode 100755 tests/UserMedia/js/main.js diff --git a/index.html b/index.html index 240cd03..140acf3 100755 --- a/index.html +++ b/index.html @@ -55,6 +55,7 @@ Authors:
  • Hardware and Sensor
  • +
  • diff --git a/tests/Camera/Camera.html b/tests/Camera/Camera.html index 923ea8d..8f11e65 100755 --- a/tests/Camera/Camera.html +++ b/tests/Camera/Camera.html @@ -33,9 +33,7 @@ Authors: - Camera - @@ -48,14 +46,12 @@ Authors:
    - - +
    + +

    -
    - -
    Pass @@ -65,15 +61,13 @@ Authors:
    diff --git a/tests/Camera/index.html b/tests/Camera/index.html index 0f568c9..abdf428 100755 --- a/tests/Camera/index.html +++ b/tests/Camera/index.html @@ -26,7 +26,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Authors: - Lin, Wanming + Xin, Liu --> diff --git a/tests/Camera/js/main.js b/tests/Camera/js/main.js index d1e5dad..754332b 100755 --- a/tests/Camera/js/main.js +++ b/tests/Camera/js/main.js @@ -1,108 +1,85 @@ -/* -Copyright (c) 2013 Intel Corporation. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of works must retain the original copyright notice, this list - of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the original copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. -* Neither the name of Intel Corporation nor the names of its contributors - may be used to endorse or promote products derived from this work without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Authors: - Xin, liu - -*/ -$(document).ready(function(){ - $("#files")[0].onchange = function(evt) { - try { - // loading - $.mobile.loading('show', { - text: 'loading...', - textVisible: false, - theme: 'a', - textonly: false, - html: "" - }); - - var files = evt.target.files; // FileList object -// // Loop through the FileList and render image files as thumbnails. -// for (var i = 0, f; f = files[i]; i++) { -// var reader = new FileReader(); -// // Closure to capture the file information. -// reader.onload = (function(theFile) { -// return function(e) { -// $.mobile.loading('hide'); -// // Render thumbnail. -// $("#filename").html(theFile.name); -// var span = document.createElement('span'); -// span.innerHTML = [''].join(''); -// span.style.align = "center"; -// $("#list")[0].insertBefore(span, null); -// }; -// })(f); -// // Read in the image file as a data URL. -// reader.readAsDataURL(f); -// } - - $("#filename").html(files[0].name); - $("#photoShow").html('' ); - $("#filename").show(); - $("#photoShow").show(); - $.mobile.loading('hide'); - } catch(err) { - $.mobile.loading('hide'); - $("#filename").html(err); - } - } - - $("#button")[0].onclick = function() { - $("#localView").hide(); - $("#filename").hide(); - var ie = navigator.appName == "Microsoft Internet Explorer" ? true : false; - if(ie){ - $("#files")[0].click(); - $("#button")[0].value = $("#files")[0].value; - }else{ - var evt = document.createEvent("MouseEvents"); - evt.initEvent("click", true, true); - $("#files")[0].dispatchEvent(evt); - } - } - - //getUserMedia - $("#getUserMeida")[0].onclick = function() { - $("#localView").show(); - $("#filename").hide(); - $("#photoShow").hide(); - try { - navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia; - navigator.getUserMedia({video: true}, function(s){ - var url = webkitURL.createObjectURL(s); - $("#localView")[0].src = url; - }, function(error){ - $("#filename").show(); - $("#filename").html("Get user media occur error:PERMISSION DENIED"); - }); - } catch (e) { - $("#localView").hide(); - $("#filename").html("Get usr media occur error,with error message:"+e.message+""); - } - } -}); +/* +Copyright (c) 2013 Intel Corporation. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of works must retain the original copyright notice, this list + of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the original copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this work without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Authors: + Xin, liu + +*/ +$(document).ready(function(){ + $("#files")[0].onchange = function(evt) { + try { + // loading + $.mobile.loading('show', { + text: 'loading...', + textVisible: false, + theme: 'a', + textonly: false, + html: "" + }); + + var files = evt.target.files; // FileList object +// // Loop through the FileList and render image files as thumbnails. +// for (var i = 0, f; f = files[i]; i++) { +// var reader = new FileReader(); +// // Closure to capture the file information. +// reader.onload = (function(theFile) { +// return function(e) { +// $.mobile.loading('hide'); +// // Render thumbnail. +// $("#filename").html(theFile.name); +// var span = document.createElement('span'); +// span.innerHTML = [''].join(''); +// span.style.align = "center"; +// $("#list")[0].insertBefore(span, null); +// }; +// })(f); +// // Read in the image file as a data URL. +// reader.readAsDataURL(f); +// } + + $("#filename").html(files[0].name); + $("#photoShow").html('' ); + $.mobile.loading('hide'); + } catch(err) { + $.mobile.loading('hide'); + $("#filename").html(err); + } + } + + $("#button")[0].onclick = function() { + var ie = navigator.appName == "Microsoft Internet Explorer" ? true : false; + if(ie){ + $("#files")[0].click(); + $("#button")[0].value = $("#files")[0].value; + }else{ + var evt = document.createEvent("MouseEvents"); + evt.initEvent("click", true, true); + $("#files")[0].dispatchEvent(evt); + } + } + +}); diff --git a/tests/UserMedia/UserMedia.html b/tests/UserMedia/UserMedia.html new file mode 100755 index 0000000..61a2537 --- /dev/null +++ b/tests/UserMedia/UserMedia.html @@ -0,0 +1,71 @@ + + + + + + + UserMedia + + + + + + + +
    +

    UserMedia

    +
    +
    +
    + +
    +

    +
    +
    + +
    +
    +
    + Pass + Fail + Info + Exit +
    +
    + + + diff --git a/tests/UserMedia/icon.png b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~o8ebzeV{iz#Afeew3*D{70lWzTD4GDDR$6#AbKIZzIrC`K=HJxYDgjFpLBLT6a(q zbOXRI?Q9Yi`(sH@e0ldD_*c8X;aBw1#=k<@E#T`0fp@j*Z-Ig+^coYYFekZ3=RwGx zc-Oi@8K6_czcC8&rJX?`8;CFMDBAiM#9!$w=3gIz_$ysIVt0Zu6@9=f>2w7OqVO=Z zc!Rt8$)0$nAq)_Au}#C%4MW`J_Mq@82go&(vJkw>?UlUiBRk@P!7J;*wRM=X6TC~U zpTuF4aU~r)Vz=O3ABNaV?RyUpUDTq9EANNc;+CMqUF(CGBL7*+Lc|m`m&a8M(8khI z`Z+`wwRTW;BCe?AFW4N!UTCF{N8-xK{QeLIIM<|!z1j;gg-yY^+y&8vje4Tc&E51g zo`|{Fjzcxm$8YDnA7UyI{!C<1>*jkp4@sUEB8%IBo8vYS zd7V+DFEY382sh97ugG&v^d5?+OI^Up^@K8jTf;5x0B*KtckmQBXB_QYjSv}b5i8qc z;TARnH@^X!ta}w4nu|BY&UQCNp7SLIJVqmjlkK_@@Z`|c*v^Fx;ADp|06Wv6;hb;9 z=3KjT)`KVF-QZ+7U;c@kxU7!jSz9#j95Y= z-3}2MPGD*+&CFBgaA- zg~RO35sWlDFi+M#$ARCay4*!tKZ}uKC}3pZ#Hn^*U;>8L96G11z({v)lIGZC>p9g% z?+FUlCiCIYjFg%x;?E^J{_Uif))-6tLw}k$X}U{bBH~2N>w&EOnehuE#h62AEqtoG zedx2BDne_2lhB%86IlE2revy{u)+!}tgyoRmI&g%4O4$*3odqg00000NkvXXu0mjf DFNQa+ literal 0 HcmV?d00001 diff --git a/tests/UserMedia/index.html b/tests/UserMedia/index.html new file mode 100755 index 0000000..d4327de --- /dev/null +++ b/tests/UserMedia/index.html @@ -0,0 +1,39 @@ + + + + + UserMedia + + + + + diff --git a/tests/UserMedia/js/main.js b/tests/UserMedia/js/main.js new file mode 100755 index 0000000..9eceead --- /dev/null +++ b/tests/UserMedia/js/main.js @@ -0,0 +1,49 @@ +/* +Copyright (c) 2013 Intel Corporation. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of works must retain the original copyright notice, this list + of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the original copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this work without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Authors: + Xin, liu + +*/ +$(document).ready(function(){ + //getUserMedia + $("#getUserMeida")[0].onclick = function() { + try { + navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia; + navigator.getUserMedia({video: true}, function(s){ + var url = webkitURL.createObjectURL(s); + $("#localView")[0].src = url; + $("#errormassage").hide(); + }, function(error){ + $("#errormassage").show(); + $("#errormassage").html("Get user media occur error:PERMISSION DENIED"); + }); + } catch (e) { + $("#localView").hide(); + $("#errormassage").html("Get usr media occur error,with error message:"+e.message+""); + } + } +}); -- 2.7.4