camera-app-2.9.1+14.04.20140331/ 0000755 0000152 0177776 00000000000 12316315300 016115 5 ustar pbuser nogroup 0000000 0000000 camera-app-2.9.1+14.04.20140331/constants.js 0000644 0000152 0177776 00000001237 12316315040 020473 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright 2012 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
.pragma library
var iconFadeDuration = 300;
camera-app-2.9.1+14.04.20140331/ViewFinderGeometry.qml 0000644 0000152 0177776 00000002606 12316315040 022413 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright 2013 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
import QtQuick 2.0
Item {
property size cameraResolution;
property int viewFinderHeight;
property int viewFinderWidth;
property int viewFinderOrientation;
property int __cameraWidth: Math.abs(viewFinderOrientation) == 90 ?
cameraResolution.height : cameraResolution.width
property int __cameraHeight: Math.abs(viewFinderOrientation) == 90 ?
cameraResolution.width : cameraResolution.height
property real widthScale: viewFinderWidth / __cameraWidth
property real heightScale: viewFinderHeight / __cameraHeight
width: (widthScale <= heightScale) ? viewFinderWidth : __cameraWidth * heightScale
height: (widthScale <= heightScale) ? __cameraHeight * widthScale : viewFinderHeight
}
camera-app-2.9.1+14.04.20140331/ShootButton.qml 0000644 0000152 0177776 00000004472 12316315040 021130 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright (C) 2012 Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
import QtQuick 2.0
import Ubuntu.Components 0.1
CameraToolbarButton {
id: button
states: [
State { name: "camera"
PropertyChanges { target: button; iconSource: "assets/shoot.png" }
PropertyChanges { target: recordOn; opacity: 0.0 }
PropertyChanges { target: pulseAnimation; running: false }
},
State { name: "record_off"
PropertyChanges { target: button; iconSource: "assets/record_off.png" }
PropertyChanges { target: recordOn; opacity: 0.0 }
PropertyChanges { target: pulseAnimation; running: false }
},
State { name: "record_on"
PropertyChanges { target: button; iconSource: "assets/record_off.png" }
PropertyChanges { target: recordOn; opacity: 1.0 }
PropertyChanges { target: pulseAnimation; running: true }
}
]
property int pulsePeriod: 750
Image {
id: recordOn
anchors.fill: parent
source: "assets/record_on.png"
Behavior on opacity { NumberAnimation { duration: pulsePeriod } }
}
Image {
id: pulse
anchors.fill: parent
source: "assets/record_on_pulse.png"
opacity: 1.0
visible: button.state != "camera"
SequentialAnimation on opacity {
id: pulseAnimation
loops: Animation.Infinite
alwaysRunToEnd: true
running: false
PropertyAnimation {
from: 1.0
to: 0.0
duration: pulsePeriod
}
PropertyAnimation {
from: 0.0
to: 1.0
duration: pulsePeriod
}
}
}
}
camera-app-2.9.1+14.04.20140331/ThinSliderStyle.qml 0000644 0000152 0177776 00000004763 12316315040 021731 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright 2012 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
import QtQuick 2.0
import Ubuntu.Components 0.1
/*
This delegate is styled using the following properties:
- backgroundImage: image source for the bar
- backgroundImageHeight: specifies the height of the image to be used;
if not specified, the images source height will be used
- thumbImage: image source for the thumb
- thumbWidth, thumbHeight: width and height of the thumb; source measurements
will be used if not specified
- thumbSpacing: spacing between the thumb and the bar; 0 if not specified
*/
Item {
id: main
anchors.fill: parent
property Item bar: backgroundShape
property Item thumb: thumbShape
property real normalizedValue: SliderUtils.normalizedValue(styledItem)
property real thumbSpacing: 0.0
property real thumbSpace: backgroundShape.width - (2.0 * thumbSpacing + thumbWidth)
property real thumbWidth: units.gu(1.5)
property real thumbHeight: units.gu(1.5)
property string backgroundImage: "assets/zoom_bar@18.png"
property string thumbImage: "assets/zoom_point@18.png"
Image {
id: backgroundShape
anchors {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
}
source: backgroundImage
height: sourceSize.height
}
Image {
id: thumbShape
objectName: "sliderThumb"
x: backgroundShape.x + thumbSpacing + normalizedValue * thumbSpace
y: backgroundShape.y + thumbSpacing
width: thumbWidth
height: thumbHeight
anchors.verticalCenter: backgroundShape.verticalCenter
source: thumbImage
}
// set styledItem's implicitHeight to the thumbShape's height
// this can also control the default sensing area
Binding {
target: styledItem
property: "implicitHeight"
value: thumbShape.height + 2.0 * thumbSpacing
}
}
camera-app-2.9.1+14.04.20140331/tests/ 0000755 0000152 0177776 00000000000 12316315300 017257 5 ustar pbuser nogroup 0000000 0000000 camera-app-2.9.1+14.04.20140331/tests/autopilot/ 0000755 0000152 0177776 00000000000 12316315300 021277 5 ustar pbuser nogroup 0000000 0000000 camera-app-2.9.1+14.04.20140331/tests/autopilot/CMakeLists.txt 0000644 0000152 0177776 00000000512 12316315040 024036 0 ustar pbuser nogroup 0000000 0000000 set(AUTOPILOT_DIR camera_app)
execute_process(COMMAND python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
OUTPUT_VARIABLE PYTHON_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
if(INSTALL_TESTS)
install(DIRECTORY ${AUTOPILOT_DIR}
DESTINATION ${PYTHON_PACKAGE_DIR}
)
endif(INSTALL_TESTS)
camera-app-2.9.1+14.04.20140331/tests/autopilot/camera_app/ 0000755 0000152 0177776 00000000000 12316315300 023367 5 ustar pbuser nogroup 0000000 0000000 camera-app-2.9.1+14.04.20140331/tests/autopilot/camera_app/__init__.py 0000644 0000152 0177776 00000000560 12316315040 025502 0 ustar pbuser nogroup 0000000 0000000 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
"""proof of concept Qt5 autopilot tests and emulators - top level package."""
camera-app-2.9.1+14.04.20140331/tests/autopilot/camera_app/tests/ 0000755 0000152 0177776 00000000000 12316315300 024531 5 ustar pbuser nogroup 0000000 0000000 camera-app-2.9.1+14.04.20140331/tests/autopilot/camera_app/tests/__init__.py 0000644 0000152 0177776 00000004340 12316315040 026644 0 ustar pbuser nogroup 0000000 0000000 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
"""Camera-app autopilot tests."""
from os import remove
import os.path
from autopilot.input import Mouse, Touch, Pointer
from autopilot.matchers import Eventually
from autopilot.platform import model
from autopilot.testcase import AutopilotTestCase
from testtools.matchers import Equals
from camera_app.emulators.main_window import MainWindow
class CameraAppTestCase(AutopilotTestCase):
"""A common test case class that provides several useful methods
for camera-app tests.
"""
if model() == 'Desktop':
scenarios = [
('with mouse', dict(input_device_class=Mouse))]
else:
scenarios = [
('with touch', dict(input_device_class=Touch))]
local_location = "../../camera-app"
deb_location = '/usr/bin/camera-app'
def setUp(self):
self.pointing_device = Pointer(self.input_device_class.create())
super(CameraAppTestCase, self).setUp()
if os.path.exists(self.local_location):
self.launch_test_local()
elif os.path.exists(self.deb_location):
self.launch_test_installed()
else:
self.launch_click_installed()
def launch_test_local(self):
self.app = self.launch_test_application(
self.local_location)
def launch_test_installed(self):
if model() == 'Desktop':
self.app = self.launch_test_application(
"camera-app")
else:
self.app = self.launch_test_application(
"camera-app",
"--fullscreen",
"--desktop_file_hint=/usr/share/applications/camera-app.desktop",
app_type='qt')
def launch_click_installed(self):
self.app = self.launch_click_package(
"com.ubuntu.camera")
def get_center(self, object_proxy):
x, y, w, h = object_proxy.globalRect
return [x + (w / 2), y + (h / 2)]
@property
def main_window(self):
return MainWindow(self.app)
camera-app-2.9.1+14.04.20140331/tests/autopilot/camera_app/tests/test_capture.py 0000644 0000152 0177776 00000015064 12316315040 027614 0 ustar pbuser nogroup 0000000 0000000 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
"""Tests for the Camera App"""
from autopilot.matchers import Eventually
from autopilot.platform import model
from testtools.matchers import Equals, NotEquals, GreaterThan
from camera_app.tests import CameraAppTestCase
import unittest
import time
import os
from os import path
class TestCapture(CameraAppTestCase):
"""Tests the main camera features"""
""" This is needed to wait for the application to start.
In the testfarm, the application may take some time to show up."""
def setUp(self):
super(TestCapture, self).setUp()
self.assertThat(
self.main_window.get_qml_view().visible, Eventually(Equals(True)))
def tearDown(self):
super(TestCapture, self).tearDown()
"""Test taking a picture"""
@unittest.skipIf(model() == 'Galaxy Nexus', 'Unusable with Mir enabled on maguro')
def test_take_picture(self):
toolbar = self.main_window.get_toolbar()
exposure_button = self.main_window.get_exposure_button()
pictures_dir = path.expanduser("~/Pictures")
# Remove all pictures from ~/Pictures that match our pattern
files = [f for f in os.listdir(pictures_dir) if f[0:5] == "image" and path.isfile(path.join(pictures_dir, f))]
for f in files:
os.remove(path.join(pictures_dir, f))
# Wait for the camera to have finished focusing
# (the exposure button gets enabled when ready)
self.assertThat(exposure_button.enabled, Eventually(Equals(True)))
# Now take the picture! (Give it a little time to animate)
self.pointing_device.move_to_object(exposure_button)
self.pointing_device.click()
# Check that only one picture with the right name pattern
# is actually there
one_picture_on_disk = False
for i in range(0, 10):
files = [f for f in os.listdir(pictures_dir) if f[0:5] == "image" and path.isfile(path.join(pictures_dir, f))]
if len(files) == 1:
one_picture_on_disk = True
break
time.sleep(1)
self.assertEquals(one_picture_on_disk, True)
# check that the camera is able to capture another photo
self.assertThat(exposure_button.enabled, Eventually(Equals(True)))
"""Tests clicking on the record control and checks if the flash changes
to torch off mode and the recording time appears"""
@unittest.skip('Video recording not working for V1.0')
def test_record_video(self):
# Get all the elements
camera_window = self.main_window.get_camera()
toolbar = self.main_window.get_toolbar()
record_control = self.main_window.get_record_control()
flash_button = self.main_window.get_flash_button()
stop_watch = self.main_window.get_stop_watch()
exposure_button = self.main_window.get_exposure_button()
# Store the torch mode and the flash state
flashlight_old_state = flash_button.flashState
torchmode_old_state = flash_button.torchMode
# Click the record button to toggle photo/video mode
self.pointing_device.move_to_object(record_control)
self.pointing_device.click()
# Has the flash changed to be a torch ?
self.assertThat(flash_button.flashState, Eventually(Equals("off")))
self.assertThat(flash_button.torchMode, Eventually(Equals(True)))
# Before recording the stop watch should read zero recording time
# and not be visible anyway.
self.assertThat(stop_watch.opacity, Equals(0.0))
self.assertEquals(stop_watch.elapsed, "00:00")
# Click the exposure button to start recording
self.pointing_device.move_to_object(exposure_button)
self.pointing_device.click()
# Record video for 2 seconds and check if the stop watch actually
# runs and is visible.
# Since the timer is not precise we don't check the actual time,
# just that it is not counting zero anymore.
self.assertThat(stop_watch.opacity, Eventually(Equals(1.0)))
self.assertThat(stop_watch.elapsed, Eventually(NotEquals("00:00")))
# Now stop the video and check if everything resets itself to
# previous states.
self.pointing_device.click()
self.assertThat(stop_watch.opacity, Eventually(Equals(0.0)))
# Now start recording a second video and check if everything
# still works
self.pointing_device.click()
# Has the flash changed to be a torch, is the stop watch visible
# and set to 00:00?
self.assertThat(flash_button.flashState, Eventually(Equals("off")))
self.assertThat(flash_button.torchMode, Eventually(Equals(True)))
self.assertThat(stop_watch.opacity, Eventually(Equals(1.0)))
self.assertEquals(stop_watch.elapsed, "00:00")
# Record video for 2 seconds and check if the stop watch actually works
self.assertThat(stop_watch.elapsed, Eventually(NotEquals("00:00")))
# Now stop the video and go back to picture mode and check if
# everything resets itself to previous states
self.pointing_device.click()
self.pointing_device.move_to_object(record_control)
self.pointing_device.click()
self.assertThat(stop_watch.opacity, Eventually(Equals(0.0)))
self.assertThat(
flash_button.flashState, Eventually(Equals(flashlight_old_state)))
self.assertThat(
flash_button.torchMode, Eventually(Equals(torchmode_old_state)))
"""Test that the shoot button gets disabled for a while then re-enabled
after shooting"""
@unittest.skip("Disabled this test due race condition see bug 1227373")
def test_shoot_button_disable(self):
exposure_button = self.main_window.get_exposure_button()
# The focus ring should be invisible in the beginning
self.assertThat(exposure_button.enabled, Eventually(Equals(True)))
# Now take the picture! (Give it a little time to animate)
self.pointing_device.move_to_object(exposure_button)
self.pointing_device.click()
# autopilot might check this too late, so the exposure_button.enabled
# is True again already before the first check
self.assertThat(exposure_button.enabled, Eventually(Equals(False)))
self.assertThat(exposure_button.enabled, Eventually(Equals(True)))
camera-app-2.9.1+14.04.20140331/tests/autopilot/camera_app/tests/test_focus.py 0000644 0000152 0177776 00000016320 12316315040 027264 0 ustar pbuser nogroup 0000000 0000000 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
"""Tests for the Camera App"""
from autopilot.matchers import Eventually
from autopilot.platform import model
from testtools.matchers import Equals, NotEquals, GreaterThan
from camera_app.tests import CameraAppTestCase
import unittest
import time
class TestFocus(CameraAppTestCase):
"""Tests the focus"""
""" This is needed to wait for the application to start.
In the testfarm, the application may take some time to show up."""
def setUp(self):
super(TestFocus, self).setUp()
self.assertThat(
self.main_window.get_qml_view().visible, Eventually(Equals(True)))
def tearDown(self):
super(TestFocus, self).tearDown()
"""Test focusing in an area where we know the picture is"""
@unittest.skipIf(model() == 'Galaxy Nexus', 'Unusable with Mir enabled on maguro')
def test_focus_valid_and_disappear(self):
focus_ring = self.main_window.get_focus_ring()
toolbar = self.main_window.get_toolbar()
feed = self.main_window.get_viewfinder_geometry()
switch_cameras = self.main_window.get_swap_camera_button()
exposure_button = self.main_window.get_exposure_button()
# The focus ring should be invisible in the beginning
self.assertThat(focus_ring.opacity, Eventually(Equals(0.0)))
self.pointing_device.move_to_object(feed)
self.pointing_device.click()
click_coords = list(self.pointing_device.position())
# The focus ring sould be visible and centered to the mouse click
# coords now
focus_ring_center = self.get_center(focus_ring)
self.assertThat(focus_ring.opacity, Eventually(Equals(1.0)))
self.assertEquals(focus_ring_center, click_coords)
# After some seconds the focus ring should fade out
self.assertThat(focus_ring.opacity, Eventually(Equals(0.0)))
# Switch cameras, wait for camera to settle, and try again
self.pointing_device.move_to_object(switch_cameras)
self.pointing_device.click()
self.assertThat(exposure_button.enabled, Eventually(Equals(True)))
# Click in the center of the viewfinder area
click_coords =[feed.globalRect[2] // 2 + feed.globalRect[0], feed.globalRect[3] // 2 + feed.globalRect[1]]
self.pointing_device.move(click_coords[0], click_coords[1])
self.pointing_device.click()
# The focus ring sould be visible and centered to the mouse
# click coords now
focus_ring_center = self.get_center(focus_ring)
self.assertThat(focus_ring.opacity, Eventually(Equals(1.0)))
self.assertEquals(focus_ring_center, click_coords)
# After some seconds the focus ring should fade out
self.assertThat(focus_ring.opacity, Eventually(Equals(0.0)))
@unittest.skipIf(model() == 'Galaxy Nexus', 'Unusable with Mir enabled on maguro')
def test_focus_invalid(self):
"""Tests clicking outside of the viewfinder image area, where it should
not focus."""
toolbar = self.main_window.get_toolbar()
zoom = self.main_window.get_zoom_control()
feed = self.main_window.get_viewfinder_geometry()
focus_ring = self.main_window.get_focus_ring()
switch_cameras = self.main_window.get_swap_camera_button()
exposure_button = self.main_window.get_exposure_button()
# The focus ring should be invisible in the beginning
self.assertThat(focus_ring.opacity, Eventually(Equals(0.0)))
x, y, h, w = toolbar.globalRect
tx = x + (h / 2)
ty = y + (w + 2)
# Click at the bottom of the window below the toolbar. It should never
# focus there.
self.pointing_device.move(tx, ty)
self.pointing_device.click()
self.assertThat(focus_ring.opacity, Eventually(Equals(0.0)))
# Check if there's a gap between the viewfinder feed and the zoom
# control. If there is, test that focusing there won't show the focus
#ring.
if zoom.y > feed.height: # Feed is aligned to the top of the window
x, y, h, w = zoom.globalRect
click_coords = [x + (h / 2), y - 2]
self.pointing_device.move(click_coords[0], click_coords[1])
self.pointing_device.click()
self.assertThat(focus_ring.opacity, Eventually(Equals(0.0)))
# Switch cameras, wait for camera to settle, and try again
self.pointing_device.move_to_object(switch_cameras)
self.pointing_device.click()
self.assertThat(exposure_button.enabled, Eventually(Equals(True)))
# Maybe we will have the gap when we switch the camera, test it again
if zoom.y > feed.height:
x, y, h, w = zoom.globalRect
click_coords = [x + (h / 2), y - 2]
self.pointing_device.move(click_coords[0], click_coords[1])
self.pointing_device.click()
self.assertThat(focus_ring.opacity, Eventually(Equals(0.0)))
"""Tests dragging the focus ring"""
@unittest.skipIf(model() == 'Galaxy Nexus', 'Unusable with Mir enabled on maguro')
def test_move_focus_ring(self):
focus_ring = self.main_window.get_focus_ring()
feed = self.main_window.get_viewfinder_geometry()
switch_cameras = self.main_window.get_swap_camera_button()
exposure_button = self.main_window.get_exposure_button()
# The focus ring should be invisible in the beginning
self.assertThat(focus_ring.opacity, Eventually(Equals(0.0)))
# Focus to the center of the viewfinder feed
self.pointing_device.move_to_object(feed)
self.pointing_device.click()
center_click_coords = list(self.pointing_device.position())
focus_ring_center = self.get_center(focus_ring)
self.assertThat(focus_ring.opacity, Eventually(Equals(1.0)))
self.assertEquals(focus_ring_center, center_click_coords)
# Now drag it halfway across the feed, verify that it has moved there
tx = focus_ring_center[0]
ty = focus_ring_center[1]
self.pointing_device.drag(tx, ty, tx / 2, ty / 2)
focus_ring_center = self.get_center(focus_ring)
self.assertThat(focus_ring_center[1], GreaterThan(ty / 2 - 2))
# Switch cameras, wait for camera to settle, and try again
self.pointing_device.move_to_object(switch_cameras)
self.pointing_device.click()
self.assertThat(exposure_button.enabled, Eventually(Equals(True)))
self.pointing_device.move_to_object(feed)
self.pointing_device.click()
center_click_coords = list(self.pointing_device.position())
focus_ring_center = self.get_center(focus_ring)
self.assertThat(focus_ring.opacity, Eventually(Equals(1.0)))
self.assertEquals(focus_ring_center, center_click_coords)
tx = focus_ring_center[0]
ty = focus_ring_center[1]
self.pointing_device.drag(tx, ty, tx / 2, ty / 2)
focus_ring_center = self.get_center(focus_ring)
self.assertThat(focus_ring_center[1], GreaterThan(ty / 2 - 2))
camera-app-2.9.1+14.04.20140331/tests/autopilot/camera_app/tests/test_zoom.py 0000644 0000152 0177776 00000011074 12316315040 027132 0 ustar pbuser nogroup 0000000 0000000 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
"""Tests for the Camera App zoom"""
from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan
from autopilot.matchers import Eventually
from camera_app.tests import CameraAppTestCase
import time
import unittest
class TestCameraZoom(CameraAppTestCase):
"""Tests the main camera features"""
""" This is needed to wait for the application to start.
In the testfarm, the application may take some time to show up."""
def setUp(self):
super(TestCameraZoom, self).setUp()
self.assertThat(
self.main_window.get_qml_view().visible, Eventually(Equals(True)))
def tearDown(self):
super(TestCameraZoom, self).tearDown()
"""Tests the zoom slider"""
def test_slider(self):
zoom_control = self.main_window.get_zoom_control()
zoom_button = self.main_window.get_zoom_slider_button()
x, y, w, h = zoom_button.globalRect
tx = x + (w / 2)
ty = y + (h / 2)
if self.main_window.get_orientation() == "portrait":
self.pointing_device.drag(tx, ty, (tx + zoom_control.width), ty)
else:
self.pointing_device.drag(tx, ty, tx, (ty - zoom_control.width))
self.assertThat(
zoom_control.value, Eventually(Equals(zoom_control.maximumValue)))
tx = x + (w / 2)
ty = y + (h / 2)
if self.main_window.get_orientation() == "portrait":
self.pointing_device.drag(tx, ty, (tx - zoom_control.width), ty)
else:
self.pointing_device.drag(tx, ty, tx, (ty + zoom_control.width))
self.assertThat(zoom_control.value, Eventually(Equals(1.0)))
@unittest.skip("Disabled this failing test due to bug 1179592")
def test_plus_minus(self):
"""Tests the plus and minus buttons"""
zoom_control = self.main_window.get_zoom_control()
plus = self.main_window.get_zoom_plus()
minus = self.main_window.get_zoom_minus()
# Test that minus when at minimum zoom does nothing
self.assertThat(zoom_control.value, Eventually(Equals(1.0)))
self.pointing_device.move_to_object(minus)
self.pointing_device.click()
self.assertThat(zoom_control.value, Eventually(Equals(1.0)))
# Test that plus moves to some non-minimum value
# and that minus goes back to the minimum
self.assertEqual(zoom_control.value, 1.0)
self.pointing_device.move_to_object(plus)
self.pointing_device.click()
self.assertThat(zoom_control.value, Eventually(GreaterThan(1.0)))
value_before_minus = zoom_control.value
self.pointing_device.move_to_object(minus)
self.pointing_device.click()
self.assertThat(
zoom_control.value, Eventually(LessThan(value_before_minus)))
# Test that keeping the plus button pressed eventually reaches max zoom
self.pointing_device.move_to_object(plus)
self.pointing_device.press()
self.assertThat(
zoom_control.value, Eventually(Equals(zoom_control.maximumValue)))
self.pointing_device.release()
# Test that plus when at maximum zoom does nothing
self.assertThat(
zoom_control.value, Eventually(Equals(zoom_control.maximumValue)))
self.pointing_device.move_to_object(plus)
self.pointing_device.click()
self.assertThat(
zoom_control.value, Eventually(Equals(zoom_control.maximumValue)))
# Test that minus moves to some non-maximum value
# and that plus goes back up
self.assertThat(
zoom_control.value, Eventually(Equals(zoom_control.maximumValue)))
self.pointing_device.move_to_object(minus)
self.pointing_device.click()
self.assertThat(
zoom_control.value, Eventually(NotEquals(zoom_control.maximumValue)))
value_before_plus = zoom_control.value
self.pointing_device.move_to_object(plus)
self.pointing_device.click()
self.assertThat(
zoom_control.value, Eventually(GreaterThan(value_before_plus)))
# Test that keeping the minus button pressed eventually reaches min zoom
self.pointing_device.move_to_object(minus)
self.pointing_device.press()
self.assertThat(zoom_control.value, Eventually(Equals(1.0)))
self.pointing_device.release()
camera-app-2.9.1+14.04.20140331/tests/autopilot/camera_app/tests/test_gallery_integration.py 0000644 0000152 0177776 00000003247 12316315040 032213 0 ustar pbuser nogroup 0000000 0000000 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2013 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
from __future__ import absolute_import
from autopilot.introspection import get_proxy_object_for_existing_process
from autopilot.matchers import Eventually
from testtools import skip
from testtools.matchers import Equals
from camera_app.tests import CameraAppTestCase
from unity8 import process_helpers as helpers
from unittest import skip
import os
@skip("Waiting on transition to click")
class TestGalleryIntegration(CameraAppTestCase):
def setUp(self):
super(TestGalleryIntegration, self).setUp()
self.assertThat(
self.main_window.get_qml_view().visible, Eventually(Equals(True)))
def tearDown(self):
os.system("pkill gallery-app")
super(TestGalleryIntegration, self).tearDown()
def get_unity8_proxy_object(self):
pid = helpers._get_unity_pid()
return get_proxy_object_for_existing_process(pid)
def get_current_focused_appid(self, unity8):
return unity8.select_single("Shell").currentFocusedAppId
@skip("Temporarily skip as test is unreliable")
def test_gallery_button_opens_gallery(self):
gallery_button = self.main_window.get_gallery_button()
unity8 = self.get_unity8_proxy_object()
current_focused_app = self.get_current_focused_appid(unity8)
self.pointing_device.click_object(gallery_button)
self.assertThat(current_focused_app, Eventually(Equals("gallery-app")))
camera-app-2.9.1+14.04.20140331/tests/autopilot/camera_app/tests/test_flash.py 0000644 0000152 0177776 00000011562 12316315040 027245 0 ustar pbuser nogroup 0000000 0000000 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
"""Tests for the Camera App flash"""
from testtools.matchers import Equals, NotEquals
from autopilot.matchers import Eventually
from camera_app.tests import CameraAppTestCase
import time
import unittest
class TestCameraFlash(CameraAppTestCase):
"""Tests the flash"""
""" This is needed to wait for the application to start.
In the testfarm, the application may take some time to show up."""
def setUp(self):
super(TestCameraFlash, self).setUp()
self.assertThat(
self.main_window.get_qml_view().visible, Eventually(Equals(True)))
def tearDown(self):
super(TestCameraFlash, self).tearDown()
"""Test that flash modes cycle properly"""
def test_cycle_flash(self):
flash_button = self.main_window.get_flash_button()
#ensure initial state
self.assertThat(flash_button.flashState, Equals("off"))
self.assertThat(flash_button.torchMode, Equals(False))
self.pointing_device.move_to_object(flash_button)
self.pointing_device.click()
self.assertThat(flash_button.flashState, Eventually(Equals("on")))
self.assertThat(flash_button.torchMode, Equals(False))
self.pointing_device.click()
self.assertThat(flash_button.flashState, Eventually(Equals("auto")))
self.assertThat(flash_button.torchMode, Equals(False))
self.pointing_device.click()
self.assertThat(flash_button.flashState, Eventually(Equals("off")))
self.assertThat(flash_button.torchMode, Equals(False))
"""Test that torch modes cycles properly"""
@unittest.skip('Video recording not working for V1.0')
def test_cycle_torch(self):
flash_button = self.main_window.get_flash_button()
record_button = self.main_window.get_record_control()
self.pointing_device.click_object(record_button)
#ensure initial state
self.assertThat(flash_button.flashState, Equals("off"))
self.assertThat(flash_button.torchMode, Equals(True))
self.pointing_device.move_to_object(flash_button)
self.pointing_device.click()
self.assertThat(flash_button.flashState, Eventually(Equals("on")))
self.assertThat(flash_button.torchMode, Equals(True))
self.pointing_device.click()
self.assertThat(flash_button.flashState, Eventually(Equals("off")))
self.assertThat(flash_button.torchMode, Equals(True))
"""When switching between video and picture the previous flash state
should be preserved"""
@unittest.skip('Video recording not working for V1.0')
def test_remember_state(self):
flash_button = self.main_window.get_flash_button()
record_button = self.main_window.get_record_control()
initial_flash_state = flash_button.flashState
# Change flash mode, then switch to camera, then back to flash
# and verify that previous state is preserved
self.pointing_device.move_to_object(flash_button)
self.pointing_device.click()
self.assertThat(
flash_button.flashState, Eventually(NotEquals(initial_flash_state)))
second_flash_state = flash_button.flashState
self.pointing_device.click()
self.assertThat(
flash_button.flashState, Eventually(NotEquals(second_flash_state)))
old_flash_state = flash_button.flashState
self.pointing_device.move_to_object(record_button)
self.pointing_device.click()
self.assertThat(flash_button.flashState, Eventually(Equals("off")))
self.assertThat(flash_button.torchMode, Equals(True))
self.pointing_device.click()
self.assertThat(
flash_button.flashState, Eventually(Equals(old_flash_state)))
self.assertThat(flash_button.torchMode, Equals(False))
# Now test the same thing in the opposite way, seeing if torch state
# is preserved
self.pointing_device.click()
self.assertThat(flash_button.flashState, Eventually(Equals("off")))
self.assertThat(flash_button.torchMode, Equals(True))
self.pointing_device.move_to_object(flash_button)
self.pointing_device.click()
old_torch_state = flash_button.flashState
self.pointing_device.move_to_object(record_button)
self.pointing_device.click()
self.assertThat(
flash_button.flashState, Eventually(Equals(old_flash_state)))
self.assertThat(flash_button.torchMode, Equals(False))
self.pointing_device.click()
self.assertThat(
flash_button.flashState, Eventually(Equals(old_torch_state)))
self.assertThat(flash_button.torchMode, Equals(True))
camera-app-2.9.1+14.04.20140331/tests/autopilot/camera_app/emulators/ 0000755 0000152 0177776 00000000000 12316315300 025402 5 ustar pbuser nogroup 0000000 0000000 camera-app-2.9.1+14.04.20140331/tests/autopilot/camera_app/emulators/__init__.py 0000644 0000152 0177776 00000000441 12316315040 027513 0 ustar pbuser nogroup 0000000 0000000 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
camera-app-2.9.1+14.04.20140331/tests/autopilot/camera_app/emulators/main_window.py 0000644 0000152 0177776 00000005635 12316315040 030301 0 ustar pbuser nogroup 0000000 0000000 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2013 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
import math
class MainWindow(object):
"""An emulator class that makes it easy to interact with the camera-app."""
def __init__(self, app):
self.app = app
def get_qml_view(self):
"""Get the main QML view"""
return self.app.wait_select_single("QQuickView")
def get_focus_ring(self):
"""Returns the focus ring of the camera"""
return self.app.wait_select_single("FocusRing")
def get_exposure_button(self):
"""Returns the button that takes pictures"""
return self.app.wait_select_single("ShootButton")
def get_record_control(self):
"""Returns the button that switches between photo and video recording"""
return self.app.wait_select_single("FadingButton", objectName="recordModeButton")
def get_flash_button(self):
"""Returns the flash control button of the camera"""
return self.app.wait_select_single("FlashButton")
def get_stop_watch(self):
"""Returns the stop watch when using the record button of the camera"""
return self.app.wait_select_single("StopWatch")
def get_toolbar(self):
"""Returns the toolbar that holds the flash and record button"""
return self.app.wait_select_single("Toolbar")
def get_zoom_control(self):
"""Returns the whole left control"""
return self.app.wait_select_single("ZoomControl")
def get_zoom_slider_button(self):
"""Returns the zoom slider button"""
return self.app.wait_select_single("QQuickImage", objectName="sliderThumb")
def get_zoom_plus(self):
"""Returns the zoom plus button"""
return self.app.wait_select_single("AbstractButton", objectName="zoomPlus")
def get_zoom_minus(self):
"""Returns the zoom minus button"""
return self.app.wait_select_single("AbstractButton", objectName="zoomMinus")
def get_viewfinder_geometry(self):
"""Returns the viewfinder geometry tracker"""
return self.app.wait_select_single("ViewFinderGeometry")
def get_swap_camera_button(self):
"""Returns the button that switches between front and back cameras"""
return self.app.wait_select_single("CameraToolbarButton", objectName="swapButton")
def get_orientation(self):
orientation = self.app.wait_select_single("DeviceOrientation")
if orientation.isLandscape == True:
return 'landscape'
else:
return 'portrait'
def get_gallery_button(self):
"""Returns the gallery button on the camera toolbar."""
return self.app.select_single(
"CameraToolbarButton", objectName="galleryButton")
camera-app-2.9.1+14.04.20140331/tests/CMakeLists.txt 0000644 0000152 0177776 00000000070 12316315040 022015 0 ustar pbuser nogroup 0000000 0000000 add_subdirectory(autopilot)
add_subdirectory(unittests)
camera-app-2.9.1+14.04.20140331/tests/unittests/ 0000755 0000152 0177776 00000000000 12316315300 021321 5 ustar pbuser nogroup 0000000 0000000 camera-app-2.9.1+14.04.20140331/tests/unittests/tst_ViewFinderGeometry.qml 0000644 0000152 0177776 00000006231 12316315040 026507 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright 2013 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
*/
import QtQuick 2.0
import QtTest 1.0
import "../../"
import "../../.." //Needed for out of source build
TestCase {
name: "ViewFinderGeometry"
function test_16_9_camera_portrait_in_16_9_screen_portrait() {
geometry.cameraResolution = Qt.size(720, 1280)
geometry.viewFinderOrientation = 0
geometry.viewFinderWidth = 720
geometry.viewFinderHeight = 1280
compare(geometry.width, 720, "Width not calculated correctly")
compare(geometry.height, 1280, "Height not calculated correctly")
}
function test_16_9_camera_landscape_in_16_9_screen_landscape() {
geometry.cameraResolution = Qt.size(1280, 720)
geometry.viewFinderOrientation = 0
geometry.viewFinderWidth = 1280
geometry.viewFinderHeight = 720
compare(geometry.width, 1280, "Width not calculated correctly")
compare(geometry.height, 720, "Height not calculated correctly")
}
function test_16_9_camera_landscape_in_16_9_screen_portrait() {
geometry.cameraResolution = Qt.size(1280, 720)
geometry.viewFinderOrientation = 0
geometry.viewFinderWidth = 720
geometry.viewFinderHeight = 1280
compare(geometry.width, 720, "Width not calculated correctly")
compare(geometry.height, 405, "Height not calculated correctly")
}
function test_16_9_camera_portrait_in_16_9_screen_landscape() {
geometry.cameraResolution = Qt.size(720, 1280)
geometry.viewFinderOrientation = 0
geometry.viewFinderWidth = 1280
geometry.viewFinderHeight = 720
compare(geometry.width, 405, "Width not calculated correctly")
compare(geometry.height, 720, "Height not calculated correctly")
}
function test_4_3_camera_landscape_in_16_9_screen_portrait() {
geometry.cameraResolution = Qt.size(640, 480)
geometry.viewFinderOrientation = 0
geometry.viewFinderWidth = 720
geometry.viewFinderHeight = 1280
compare(geometry.width, 720, "Width not calculated correctly")
compare(geometry.height, 540, "Height not calculated correctly")
}
function test_16_9_camera_landscape_rotated_in_16_9_screen_landscape() {
geometry.cameraResolution = Qt.size(1280, 720)
geometry.viewFinderOrientation = 90
geometry.viewFinderWidth = 1280
geometry.viewFinderHeight = 720
compare(geometry.width, 405, "Width not calculated correctly")
compare(geometry.height, 720, "Height not calculated correctly")
}
ViewFinderGeometry {
id: geometry
}
}
camera-app-2.9.1+14.04.20140331/tests/unittests/tst_QmlTests.cpp 0000644 0000152 0177776 00000001265 12316315040 024500 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright (C) 2012 Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
QUICK_TEST_MAIN(QmlTests)
camera-app-2.9.1+14.04.20140331/tests/unittests/CMakeLists.txt 0000644 0000152 0177776 00000001114 12316315040 024057 0 ustar pbuser nogroup 0000000 0000000 add_executable(tst_QmlTests tst_QmlTests.cpp)
qt5_use_modules(tst_QmlTests Core Qml Quick Test QuickTest)
target_link_libraries(tst_QmlTests ${TPL_QT5_LIBRARIES})
add_test(tst_QmlTests ${CMAKE_CURRENT_BINARY_DIR}/tst_QmlTests -import ${CMAKE_SOURCE_DIR})
set_tests_properties(tst_QmlTests PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
# copy qml test files to build dir
file(GLOB qmlTestFiles RELATIVE ${CMAKE_SOURCE_DIR}/tests/unittests/ *qml)
foreach(qmlTestFile ${qmlTestFiles})
file(COPY ${qmlTestFile} DESTINATION ${CMAKE_BINARY_DIR}/tests/unittests/)
endforeach(qmlTestFile)
camera-app-2.9.1+14.04.20140331/tests/unittests/tst_StopWatch.qml 0000644 0000152 0177776 00000002364 12316315040 024650 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright 2013 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
*/
import QtQuick 2.0
import QtTest 1.0
import "../../"
import "../../.." //Needed for out of source build
TestCase {
name: "StopWatch"
function test_time_format_calc() {
stopWatch.time = 1234
compare(stopWatch.elapsed, "20:34", "Time not calculated correctly")
}
function test_time_format_pad() {
stopWatch.time = 5
compare(stopWatch.elapsed, "00:05", "Time not calculated correctly")
}
function test_time_negative() {
stopWatch.time = -1234
compare(stopWatch.elapsed, "-20:34", "Time not calculated correctly")
}
StopWatch {
id: stopWatch
}
}
camera-app-2.9.1+14.04.20140331/desktop/ 0000755 0000152 0177776 00000000000 12316315300 017566 5 ustar pbuser nogroup 0000000 0000000 camera-app-2.9.1+14.04.20140331/desktop/CMakeLists.txt 0000644 0000152 0177776 00000000175 12316315040 022332 0 ustar pbuser nogroup 0000000 0000000 install(DIRECTORY icons/hicolor DESTINATION DESTINATION
${CMAKE_INSTALL_DATADIR}/icons FILES_MATCHING PATTERN *.png)
camera-app-2.9.1+14.04.20140331/desktop/icons/ 0000755 0000152 0177776 00000000000 12316315300 020701 5 ustar pbuser nogroup 0000000 0000000 camera-app-2.9.1+14.04.20140331/desktop/icons/hicolor/ 0000755 0000152 0177776 00000000000 12316315300 022340 5 ustar pbuser nogroup 0000000 0000000 camera-app-2.9.1+14.04.20140331/desktop/icons/hicolor/128x128/ 0000755 0000152 0177776 00000000000 12316315300 023275 5 ustar pbuser nogroup 0000000 0000000 camera-app-2.9.1+14.04.20140331/desktop/icons/hicolor/128x128/apps/ 0000755 0000152 0177776 00000000000 12316315300 024240 5 ustar pbuser nogroup 0000000 0000000 camera-app-2.9.1+14.04.20140331/desktop/icons/hicolor/128x128/apps/camera-app.png 0000644 0000152 0177776 00000051675 12316315040 026773 0 ustar pbuser nogroup 0000000 0000000 ‰PNG
IHDR ‡ v÷GÌ sBITÛáOà pHYs í í˜Á7 tEXtSoftware www.inkscape.org›î< S;IDATxÚµ½i$Çq&š‘•uô9Ý=}Ít÷Ü'038 @.H
H‘â’ZQ»\ɤ…Ö`¶¤žé‡MÒ³5I?tØê‡~P&{ï™~ˆ4J2KiA‚ÄAÊ A $` Ì}÷=}_uWæ~žáéY3¤lß«‹ÕUYYááîŸá®ÞÅX¢øæ1–ˆ‡ß9JF™‡3rw¼v
‘ýáÛÝ0òÚß*4c¼(ÊÞ]"ÔïVËL˜V3y¹èJùöîQKµâ²K™¾®_ø¼¦øÓPÃ\ÊñÐÍwiùðI…J’TéácÝÍ Ã䅈ɯÐûf¤˜QL]AZº›¥aúŸžY$ï) ©2{©K_¡utH.ßÔ3÷QŠÆïòØíæy9?E*Úañ]
½<3þ@ù¾¼ý¦/vµg)”ÕÊnçxi( ô³Þçš 1TûÍ¥âïâ÷}b\g}M}%™/þuO²™`4æ!,Gzi¾Ž·‹Š‡¡4JovÉi~‹˜Ô^Ì—Š'¥Ò#LäRD»]ÅR+Ù:I±\ô{Q+äû;I¦ÉVd©ø«zÂñ€qgŸVÞhÅÂ-^_¾§òìý”òS+˜¬§•¢r_ÓTõÞÏJ$ðèªx£¥×3á%6£—HN+$ÛÉa•ð(Ë›4u7´Omû¸€X¶0Ï
IG¢K@ÑXR)»,³e¾%nÐj6ãQ+1Õˆ4Aê…V‰Ú`ÎRÉŠÓ‚ŠøùD$òºÐ¬”+²ãõRžz »¤ç&˜ J}=þéXbDrYyÓ¸,$µ¬Ež×~Ý-3©¶„Á;aÆ’Ö^,ŸåŸòëDˆXàÇ’Àˆ¥(æ0ålvóc<— ŸÏ[RFR4ê{™´Tƒ„Ñ—‡V$)=båi
v Õ§½Ï’3Æ)v‹w“æ¡Hµ‡$*µCSôÉs¿®÷MFiÇÒ2ŒbHń֎wcJYFí†g5e«òâÑ}b‡Q,ñŒt—b€1~ÍrvÇE
x¾‰\¡éGû€` ˜oÔH¼¤†(~šÈDüxõŦMöH”â†(æg‹Ê\/d—áß
ùDZzB¸ùi
LÂæÀ¯í¯·¢–gÑl"^¬ä‰K°Ã\.GäÑ8‡v(OǶÓkbØ+lOdžåXü[Ve*ó/ùVšñ³ðHAYÒgw˜ÔªUý®¯”˜d¢c”PõV|3ÏFB‹1féÓ?ßr¢J«7{½’’;Ãaðº‡f‰; à$ÃS‘J