Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BD4B9E339 for ; Tue, 12 Mar 2013 18:28:06 +0000 (UTC) Received: (qmail 17147 invoked by uid 500); 12 Mar 2013 18:28:06 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 17024 invoked by uid 500); 12 Mar 2013 18:28:06 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 17016 invoked by uid 99); 12 Mar 2013 18:28:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Mar 2013 18:28:06 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mmocny@google.com designates 209.85.214.48 as permitted sender) Received: from [209.85.214.48] (HELO mail-bk0-f48.google.com) (209.85.214.48) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Mar 2013 18:28:02 +0000 Received: by mail-bk0-f48.google.com with SMTP id jf20so72137bkc.7 for ; Tue, 12 Mar 2013 11:27:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=yuxDmzsjS16NXdpBN9JQhHI5X8fAuVUNoPZA/aOjY2A=; b=NfWM5K9yzoQEdYiL5y7+QG6dEYrEwviidl0CAIwpVsES9OfFbbyrtTd4oIdHVZtdwy FZMFmxDTaaUUNkPQG/D7gpbR2u8pAnj8AuVT43ieubAjt5ILkLgU2LjA66z1J15wzhhM WmzrEvqDCCa7Cv5TeejrcLem6PjXmF5pERL20kqo9ZZBkpe6xsjW1cl8QQsNPhBA0mAD l9CbUEqymxh0FGUiHKhOlzCq1bUZ2U/mcoFBKW9G3P/NR6pesiTvZJFA/jAaHf5aYaxv NuXjDAZsaVRPEMaKTSlihVptUtbhDb9z1KPujedqU2rJJVsZdqOSj0AHv0FhbCCQwitF tgLQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=yuxDmzsjS16NXdpBN9JQhHI5X8fAuVUNoPZA/aOjY2A=; b=ICgViZyLDd+4T3XMUAMHbefjKLC4oEqxIdQ7AO92Fo4SISFGzAyt2JGdRzQvMPzSXO j8CWQYxMs1CnhgDZKLLMyZSgIi7DJBYYX9kKyVb4HccmT3vkCIO87c1fTTu5tRZTo/gL vgRd1SjsL9Ug1uxxjcvYcnQjkI70PBVBLogEE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :x-gm-message-state; bh=yuxDmzsjS16NXdpBN9JQhHI5X8fAuVUNoPZA/aOjY2A=; b=piFl3oN2QE6dxA0kOtiPCurE6AhunRBwWGazlAeO0I+RkxfLbMQCyw7avfjKYoibid 26QehV+unJ7cTosyvw4ll/J3wewFWY+Ncrb00JM/IbOgQ4RRVq1e29BBWL57eWUFX8RC agh5a93GGyJNAWCVrSvBuYBcKjLHSqtbfomvg3uUCtvecbZnbGqvVK6byjsxuz9ajWZq g0z1oDXVieoLUQ2RNQD7+PsxIM91JC+Xvv+3NriDv3Qpjlc1zygCdTlO8dS9GINzgq2N Dw4FnDZYxa0Cc9k0UtaI14RZ+69+SAGydQyod2sKk35QYROhPrDy+EY5Yh3arKf4NWF3 pIdw== MIME-Version: 1.0 X-Received: by 10.204.197.66 with SMTP id ej2mr6568260bkb.66.1363112860860; Tue, 12 Mar 2013 11:27:40 -0700 (PDT) Sender: mmocny@google.com Received: by 10.204.24.20 with HTTP; Tue, 12 Mar 2013 11:27:40 -0700 (PDT) In-Reply-To: References: Date: Tue, 12 Mar 2013 14:27:40 -0400 X-Google-Sender-Auth: 3f0DsWVHHLQtWLwXsEYWXgl3Qfo Message-ID: Subject: Re: Cordova Screen Capture Plugin for Android From: Michal Mocny To: dev Content-Type: multipart/alternative; boundary=485b3970d570dc85c204d7be71eb X-Gm-Message-State: ALoCoQlnXtPBGdtAoP1ssNwRzD4HRde+le4khY8YUGXHGAAbcE3Mvbge3Xra9I9P3hdajCB8GeavCLievhEtRAVg+miWBhVPKxEiOuzWw26G3nAYaOtYrOsDeEgnzTKkbLc9zswPQf5dWCLqp8X1EFopQa9KnQQSUwwHygjFzjVhegbgx6dr0oKRnsZLBwKsQtyQ3Ce4HY1T X-Virus-Checked: Checked by ClamAV on apache.org --485b3970d570dc85c204d7be71eb Content-Type: text/plain; charset=ISO-8859-1 Aaron, I haven't even begun looking at your implementation, but I'm just going to say it: this is awesome! First question: When Capturing a DOM element, can you capture 'body' to grab it&children for a "full content screenshot", or does it have to be a specific single element? -Michal On Tue, Mar 12, 2013 at 1:58 PM, Aaron Charbonneau wrote: > Greetings! My name is Aaron Charbonneau, happy to be a new member of the > mailing list! > > I have been developing a sceenshot plugin for Cordova to help facilitate > automation testing and debugging of Cordova apps, and I would love some > feedback on it. Currently Cordova provides a bunch of native functions > that allow you to do some cool stuff, but not much functionality to test > the apps that make use of them. Being able to take a capture of the screen > from within you app is a great way to automate testing or get additional > information for debugging an issue. Since there is no > Javascript mechanism for taking screen captures the solution would have to > be native, which fits nicely into the "gap" that Cordova/Phonegap bridges. > Any medium to large scale app can benefit greatly from automation testing > and any app can benefit from an extra debugging tool, and that is what I > hope this screenshot plugin can help achieve. > > Currently the plugin offers 2 functions: > > Capture(): > * Take a capture of the current view, write that capture to a .png file > with the specified file name and sub directory of the sdcard (fallback to > emulated sdcard in the case there isn't an sdcard mounted) > * Able to create a sub-screenshot with a specified rectangle in order to > block out ui elements that may be variable, and also save space. > * Can take captures of images/dom elements (including canvas) that are > lager than the actual screen size > > CaptureAndCompare(): > * All the functionality of Capture() > * Perform a comparison between the captured image and a baseline image > located at the specified location in either the assets folder or the > sdcard. > * User can specify per color channel tolerances as well as total pixel > tolerances to avoid false positives for the inevitable rendering > differences across devices. > * Optionally output a png file that contains the differences between the > actual and the baseline for debugging/triage purposes, two modes: binary > diff (all failing pixels appear as solid white) or the true differences > between pixels. > > If you can spare some time, I would love it if you could take a look at the > api and parameters I have defined to make sure they adhere to Cordova > plugin best practices. The most crucial part would be in the plugin itself > at ScreenCapture.java: > > https://github.com/Charbs09/Cordova-Mobile-Spec-ScreenCapture/blob/master/src/org/apache/cordova/plugin/ScreenCapture.java(capture() > and captureAndCompare() are the two exposed functions) > > I'm also interested to know you thoughts on it's usage. I started with the > mobile-spec testing framework and put some quick rendering tests into the > Autotest section as a viable use case. In order to get the WebView into > the state I wanted to capture, I had to implement a wait timer to allow the > view to update before taking the capture. Once the wait function > completes, the capture can be taken and everything from there is callback > based. I use the Jasmine waitsFor()/runs() blocks to make the tests run > synchronously. For some validation testing I made a compare function in > Javascript to run against the native compare. Turns out Java runs alot > faster than Javascript (surprise!) thus the native compare is about 2-5x > faster. All in all the process is fairly quick, the full captureAndCompare > with 3 file io's takes about 233ms on a Nexus One, and ~100ms on a Nexus 10 > (256x256 image size). > > Anyways here is the usage: > > https://github.com/Charbs09/Cordova-Mobile-Spec-ScreenCapture/blob/master/assets/www/autotest/tests/rendering.tests.js > > And here's the JS wrapper for the plugin calls: > > https://github.com/Charbs09/Cordova-Mobile-Spec-ScreenCapture/blob/master/assets/www/screencapture.js > > Thanks for your time, and I look forward to ANY feedback positive or > negative. > > Thanks, > Aaron > --485b3970d570dc85c204d7be71eb--