Closed Bug 944288 Opened 11 years ago Closed 11 years ago

[UITest] add share Image activity

Categories

(Firefox OS Graveyard :: Gaia, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gasolin, Assigned: rishav_)

Details

(Whiteboard: [good first bug][mentor=gasolin][mentor-lang=zh][lang=js])

Attachments

(1 file, 2 obsolete files)

Expect:

extend test_apps/uitest by add 'share Image' activity in API tab


The activity could reference to http://robnyman.github.io/Firefox-OS-Boilerplate-App

var shareImage = document.querySelector("#share-image"),
        imgToShare = document.querySelector("#image-to-share");
    if (shareImage && imgToShare) {
        shareImage.onclick = function () {
            if(imgToShare.naturalWidth > 0) {
                // Create dummy canvas
                var blobCanvas = document.createElement("canvas");
                blobCanvas.width = imgToShare.width;
                blobCanvas.height = imgToShare.height;

                // Get context and draw image
                var blobCanvasContext = blobCanvas.getContext("2d");
                blobCanvasContext.drawImage(imgToShare, 0, 0);

                // Export to blob and share through a Web Activitiy
                blobCanvas.toBlob(function (blob) {
                    var sharingImage = new MozActivity({
                        name: "share",
                        data: {
                            type: "image/*",
                            number: 1,
                            blobs: [blob]
                        }
                    });
                });
            }
            else {
                alert("Image failed to load, can't be shared");
            }
        }
    }
Whiteboard: [good first bug][mentor=gasolin][mentor-lang=zh][lang=js]
Hi Fred,
Can I get assigned this bug? I am interested in this. It will be very helpful if you will provide more info about this bug :)
Thanks
If you have real device it will be a plus to test activity.
Or you could try on tools/web developer/App Manager.


Open it, start a simulator, use 'Add packaged App' to load gaia/test_apps/uitest into simulator

Open `uitest` in simulator, switch to API/photo, click `Pick Photo` any to see the result.

You could add `Share Image` in uitest/index.html, uitest/test_html/API and uitest/js/API with above code.
Assignee: nobody → rishav006
Hi Fred,
What you code provided above, is for  Firefox-Os-BoilerPlate App.
I can add the code (given above) in uitest/js/API. But what i have to add in uitest/test_html/API (For that i need to create a more page "shareimage.html" like others audio.html,contact.html, But what should be the content of it, because nothing like this is given in Firefox OS BoilerPlate App).
Please help.
Also what is your irc nickname (so that i can ask you there).

Thanks
Flags: needinfo?(gasolin)
add a line `share blob image` before button is fine for me. 
Or you can even include an image ex 'style/images/canardpc.jpg' and put shared button under it.


my irc nickname is `gasolin`, now its holiday so I may not on irc sometime.
Flags: needinfo?(gasolin)
Attached file Add share Image Activity (obsolete) —
Attachment #8351015 - Flags: review?(gasolin)
Hi Fred
I Added   " Share Image " Activity .
Modification in test_apps/uitest/index.html
Addition of  
test_apps/uitest/tests_html/API/shareimage.html  
and 
test_apps/uitest/js/API/shareimage.js 

Please have a look and tell if there any more stuff need to add.

Thanks
Hi kumar,

The overall looks perfectly, thanks for your contribution!

Please rebase your PR to not include other's commit.
Hi fred
Can you explain "Please rebase your PR to not include other's commit".
How to do this.
I didn't get it.(First time i am doing bug fixing,so ... please help).

Thanks
Sure. there are two commits in your Pull request, one is not related to this issue.
The root cause might be your previous commits is backout(make gaia test fail so the commit is reverted) from current gaia master.


The simple way to solve this issue is 
1. to save your changes to other place
2. create a new fresh branch
3. paste your changes there
4. create a new Pull request

The other way is (might be harder)

1. add remote git to your local gaia repository:

  $ git remote add upstream https://github.com/mozilla-b2g/gaia.git

2. update remote commits by command:

  $ remote update

3. rebase your current branch to newest commits

  $ git rebase upstream/master


I suggest you take the first approach if you not really familiar with git operation.
Hi fred,
What to do with previous branch(i created) and pull request.
Thanks
Hi Fred
Is this ok?
pull request 
https://github.com/mozilla-b2g/gaia/pull/14929
Thanks
Attached file Add share Image Activity (obsolete) —
Attachment #8351135 - Flags: review?(gasolin)
Attachment #8351015 - Flags: review?(gasolin)
Comment on attachment 8351135 [details] [review]
Add share Image Activity

still see 'alive''s commit in your Pull request
Attachment #8351135 - Flags: review?(gasolin)
Your current local git or forked repository is a bit outdate,

please create a new branch with following steps:

1. add remote git to your local gaia repository:

  $ git remote add upstream https://github.com/mozilla-b2g/gaia.git

2. update remote commits by command:

  $ remote update

3. create a new branch

$ git checkout -b issue-944288 upstream/master 

and do your modification here
step 2 command is 

$ git remote update
Hi Fred,
Are you online currently on irc. I need some help.
Thanks
Attachment #8351015 - Attachment is obsolete: true
Attachment #8351135 - Attachment is obsolete: true
Attachment #8351148 - Flags: review?(gasolin)
Comment on attachment 8351148 [details] [review]
Add share Image Activity

It works perfectly, thanks and congratulate your first contribution!
Attachment #8351148 - Flags: review?(gasolin) → review+
merged to gaia-master https://github.com/mozilla-b2g/gaia/commit/1d1f3156d9625981ed9d4e5322831c2b038ea70b
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: