-<widget id='http://tizen.org/test/tct-behavior-tests' xmlns='http://www.w3.org/ns/widgets' xmlns:tizen='http://tizen.org/ns/widgets'>
- <access origin="*"/>
- <icon src="icon.png" height="128" width="128"/>
- <name>tct-behavior-tests</name>
- <tizen:application id="tctbhtests.tct-behavior-tests" required_version="1.0"/>
- <tizen:privilege name="http://tizen.org/privilege/alarm"/>
- <tizen:privilege name="http://tizen.org/privilege/application.launch"/>
- <tizen:privilege name="http://tizen.org/privilege/bluetooth.admin"/>
- <tizen:privilege name="http://tizen.org/privilege/bluetooth.gap"/>
- <tizen:privilege name="http://tizen.org/privilege/bluetooth.spp"/>
- <tizen:privilege name="http://tizen.org/privilege/calendar.read"/>
- <tizen:privilege name="http://tizen.org/privilege/calendar.write"/>
- <tizen:privilege name="http://tizen.org/privilege/callhistory.read"/>
- <tizen:privilege name="http://tizen.org/privilege/callhistory.write"/>
- <tizen:privilege name="http://tizen.org/privilege/contact.read"/>
- <tizen:privilege name="http://tizen.org/privilege/contact.write"/>
- <tizen:privilege name="http://tizen.org/privilege/content.read"/>
- <tizen:privilege name="http://tizen.org/privilege/content.write"/>
- <tizen:privilege name="http://tizen.org/privilege/download"/>
- <tizen:privilege name="http://tizen.org/privilege/filesystem.read"/>
- <tizen:privilege name="http://tizen.org/privilege/filesystem.write"/>
- <tizen:privilege name="http://tizen.org/privilege/messaging.read"/>
- <tizen:privilege name="http://tizen.org/privilege/messaging.write"/>
- <tizen:privilege name="http://tizen.org/privilege/nfc.admin"/>
- <tizen:privilege name="http://tizen.org/privilege/nfc.cardemulation"/>
- <tizen:privilege name="http://tizen.org/privilege/nfc.common"/>
- <tizen:privilege name="http://tizen.org/privilege/nfc.p2p"/>
- <tizen:privilege name="http://tizen.org/privilege/nfc.tag"/>
- <tizen:privilege name="http://tizen.org/privilege/notification"/>
- <tizen:privilege name="http://tizen.org/privilege/power"/>
- <tizen:privilege name="http://tizen.org/privilege/system"/>
- <tizen:privilege name="http://tizen.org/privilege/time"/>
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://tizen.org/test/tct-behavior-tests" viewmodes="">
+ <access origin="*"/>
+ <tizen:application id="tctbhtests.Behavior" package="tctbhtests" required_version="1.0"/>
+ <icon src="icon.png" height="128" width="128"/>
+ <name>tct-behavior-tests</name>
+ <tizen:privilege name="http://tizen.org/privilege/alarm"/>
+ <tizen:privilege name="http://tizen.org/privilege/application.launch"/>
+ <tizen:privilege name="http://tizen.org/privilege/bluetooth.admin"/>
+ <tizen:privilege name="http://tizen.org/privilege/bluetooth.gap"/>
+ <tizen:privilege name="http://tizen.org/privilege/bluetooth.spp"/>
+ <tizen:privilege name="http://tizen.org/privilege/calendar.read"/>
+ <tizen:privilege name="http://tizen.org/privilege/calendar.write"/>
+ <tizen:privilege name="http://tizen.org/privilege/callhistory.read"/>
+ <tizen:privilege name="http://tizen.org/privilege/callhistory.write"/>
+ <tizen:privilege name="http://tizen.org/privilege/contact.read"/>
+ <tizen:privilege name="http://tizen.org/privilege/contact.write"/>
+ <tizen:privilege name="http://tizen.org/privilege/content.read"/>
+ <tizen:privilege name="http://tizen.org/privilege/content.write"/>
+ <tizen:privilege name="http://tizen.org/privilege/download"/>
+ <tizen:privilege name="http://tizen.org/privilege/filesystem.read"/>
+ <tizen:privilege name="http://tizen.org/privilege/filesystem.write"/>
+ <tizen:privilege name="http://tizen.org/privilege/messaging.read"/>
+ <tizen:privilege name="http://tizen.org/privilege/messaging.write"/>
+ <tizen:privilege name="http://tizen.org/privilege/nfc.admin"/>
+ <tizen:privilege name="http://tizen.org/privilege/nfc.cardemulation"/>
+ <tizen:privilege name="http://tizen.org/privilege/nfc.common"/>
+ <tizen:privilege name="http://tizen.org/privilege/nfc.p2p"/>
+ <tizen:privilege name="http://tizen.org/privilege/nfc.tag"/>
+ <tizen:privilege name="http://tizen.org/privilege/notification"/>
+ <tizen:privilege name="http://tizen.org/privilege/power"/>
+ <tizen:privilege name="http://tizen.org/privilege/system"/>
+ <tizen:privilege name="http://tizen.org/privilege/time"/>
+ <tizen:privilege name="http://tizen.org/privilege/datasync"/>
+ <tizen:privilege name="http://tizen.org/privilege/package.info"/>
+ <tizen:privilege name="http://tizen.org/privilege/packagemanager.install"/>
+ <tizen:privilege name="http://tizen.org/privilege/setting"/>
+ <tizen:setting screen-orientation="portrait" context-menu="disable" background-support="enable" encryption="disable" install-location="auto"/>
</widget>
<li id="LocationGps" class="test_app"/>
<li data-role="list-divider" role="heading">Sensors</li>
<li id="Accelerometer" class="test_app"/>
+ <li data-role="list-divider" role="heading">Application</li>
+ <li id="Alarm" class="test_app"></li>
+ <li id="Application" class="test_app"></li>
+ <li id="Package" class="test_app"></li>
+ <li data-role="list-divider" role="heading">Communication</li>
+ <li id="Bluetooth" class="test_app"></li>
+ <li id="Messaging(S.MMS)" class="test_app"></li>
+ <li id="Messaging(Email)" class="test_app"></li>
+ <li id="NFC" class="test_app"></li>
+ <li id="Push" class="test_app"></li>
+ <li data-role="list-divider" role="heading">Content</li>
+ <li id="Content" class="test_app"></li>
+ <li id="Download" class="test_app"></li>
+ <li data-role="list-divider" role="heading">Social</li>
+ <li id="DataSync" class="test_app"></li>
+ <li data-role="list-divider" role="heading">System</li>
+ <li id="Power" class="test_app"></li>
+ <li id="SystemInfo" class="test_app"></li>
+ <li id="SystemSetting(Screen)" class="test_app"></li>
+ <li id="SystemSetting(IncomingCall)" class="test_app"></li>
+ <li id="SystemSetting(NotificationEmail)" class="test_app"></li>
+ <li data-role="list-divider" role="heading">UserInterface</li>
+ <li id="Notification" class="test_app"></li>
</ul>
</div>
<div data-role="footer" data-position="fixed">
--- /dev/null
+<!DOCTYPE html>
+<!--
+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:
+ Lin, Wanming <wanmingx.lin@intel.com>
+
+-->
+<html>
+<head>
+<meta charset="utf-8" />
+<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
+<title>Alarm</title>
+<link rel="stylesheet" type="text/css" href="../../css/jquery.mobile-1.3.0.min.css" />
+<script src="../../js/thirdparty/jquery-1.9.1.min.js"></script>
+<script src="../../js/thirdparty/jquery.mobile-1.3.0.min.js"></script>
+<script src="../../js/app_common.js"></script>
+<script src="js/main.js"></script>
+</head>
+<body>
+ <div data-role="page" id="main">
+ <div data-role="header" data-position="fixed">
+ <h1 id="main_page_title">Alarm</h1>
+ </div>
+ <div id="content">
+ <ul data-role="listview">
+ <li data-role="list-divider">Alarm List</li>
+ </ul>
+ <ul data-role="listview" id="alarm-all-list"></ul>
+ <ul data-role="listview">
+ <li data-role="list-divider">Alarm Add</li>
+ <li>
+ <a href="#absolute-alarm-add">
+ <div data-role="button">Absolute</div>
+ </a>
+ </li>
+ <li>
+ <a href="#relative-alarm-add">
+ <div data-role="button">Relative</div>
+ </a>
+ </li>
+ <li data-role="list-divider">Alarm Delete</li>
+ <li>
+ <div data-role="button" id="alarm-remove-all">Delete all</div>
+ </li>
+ </ul>
+ </div>
+ <div data-role="footer" data-position="fixed">
+ <a href="javascript:reportResult('Alarm', 'PASS');" data-icon="check" style="color: green">Pass</a>
+ <a href="javascript:reportResult('Alarm', 'FAIL');" data-icon="delete" style="color: red">Fail</a>
+ <a href="#popupInfo" data-rel="popup" data-transition="pop" data-role="button" data-icon="info">Info</a>
+ <a href="javascript:backAppsHome();" data-icon="home">Exit</a>
+ </div>
+ <div data-role="popup" id="popupInfo">
+ <p>Alarm test info</p>
+ </div>
+ </div>
+ <div data-role="page" id="absolute-alarm-add">
+ <div data-role="header" data-position="fixed">
+ <h1 id="main_page_title">Absolute Alarm Add</h1>
+ </div>
+ <div id="content">
+ <ul data-role="listview">
+ <li data-role="list-divider">Time</li>
+ <li class="ui-datetime">
+ <div class="ui-datetime-text-main ui-datetime-nosubtitle">
+ <input type="datetime" name="alarm-time" id="alarm-time" />
+ </div>
+ </li>
+ <li data-role="list-divider">Repeat interval (sec)</li>
+ <li><input id="absolute-alarm-period" name="absolute-alarm-period" data-popupenabled="false" type="range" value="50" min="0" max="99" /></li>
+ <li data-role="list-divider">Action on alarm expiration</li>
+ <!-- <li><input type="radio" name="launch-choice-absolute" id="launch-app-absolute" value="app" checked="checked" /> Application launch</li> -->
+ <li>
+ <div data-role="button" id="absolute-alarm-save">Save</div>
+ </li>
+ </ul>
+ </div>
+ <div data-role="footer" data-position="fixed">
+ <a href="javascript:reportResult('Alarm', 'PASS');" data-icon="check" style="color: green">Pass</a>
+ <a href="javascript:reportResult('Alarm', 'FAIL');" data-icon="delete" style="color: red">Fail</a>
+ <a href="#popupInfo" data-rel="popup" data-transition="pop" data-role="button" data-icon="info">Info</a>
+ <a href="javascript:backAppsHome();" data-icon="home">Exit</a>
+ </div>
+ <div data-role="popup" id="popupInfo">
+ <p>Alarm test info</p>
+ </div>
+ </div>
+ <div data-role="page" id="relative-alarm-add">
+ <div data-role="header" data-position="fixed">
+ <h1 id="main_page_title">Relative Alarm Add</h1>
+ </div>
+ <div id="content">
+ <ul data-role="listview">
+ <li data-role="list-divider">Delay (sec)</li>
+ <li><input id="relative-alarm-delay" name="relative-alarm-delay" data-popupenabled="false" type="range" value="50" min="0" max="99" /></li>
+ <li data-role="list-divider">Repeat interval (sec)</li>
+ <li><input id="relative-alarm-period" name="relative-alarm-period" data-popupenabled="false" type="range" value="50" min="0" max="99" /></li>
+ <li data-role="list-divider">Action on alarm expiration</li>
+ <li>
+ <div data-role="button" id="relative-alarm-save">Save</div>
+ </li>
+ </ul>
+ </div>
+ <div data-role="footer" data-position="fixed">
+ <a href="javascript:reportResult('Alarm', 'PASS');" data-icon="check" style="color: green">Pass</a>
+ <a href="javascript:reportResult('Alarm', 'FAIL');" data-icon="delete" style="color: red">Fail</a>
+ <a href="#popupInfo" data-rel="popup" data-transition="pop" data-role="button" data-icon="info">Info</a>
+ <a href="javascript:backAppsHome();" data-icon="home">Exit</a>
+ </div>
+ <div data-role="popup" id="popupInfo">
+ <p>Alarm test info</p>
+ </div>
+ </div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+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:
+ Lin, Wanming <wanmingx.lin@intel.com>
+
+-->
+<html>
+<head>
+<title>Alarm</title>
+<meta http-equiv="REFRESH" content="0;url=Alarm.html" />
+</head>
+<body>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+/*
+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:
+ Lin, Wanming <wanmingx.lin@intel.com>
+
+ */
+
+$(document).delegate("#main", "pageinit", function() {
+
+ $("#main").bind("pagebeforeshow", displayAlarms);
+
+ $("#alarm-remove-all").bind("vclick", function() {
+ removeAll();
+ return false;
+ });
+
+ $("#alarm-all-list").delegate("li", "vclick", function() {
+ alarmInfo($(this).data("id"));
+ return false;
+ });
+
+ $("#alarm-all-list").delegate("div", "vclick", function() {
+ removeAlarm($(this).parent().data("id"));
+ return false;
+ });
+});
+
+$(document).delegate("#absolute-alarm-add", "pageinit", function() {
+ $("#absolute-alarm-save").bind("vclick", function() {
+ addAlarmAbsolute();
+ return false;
+ });
+});
+
+$(document).delegate("#relative-alarm-add", "pageinit", function() {
+ $("#relative-alarm-save").bind("vclick", function() {
+ addAlarmRelative();
+ });
+});
+
+function displayAlarms() {
+ // get full list of alarms
+ var alarmsArray = tizen.alarm.getAll();
+ var period, str = "";
+
+ for (var i = 0; i < alarmsArray.length; i++) {
+ if (alarmsArray[i].period) {
+ period = alarmsArray[i].period + " sec";
+ } else {
+ period = "none";
+ }
+
+ if (alarmsArray[i] instanceof tizen.AlarmAbsolute) {
+ var d = alarmsArray[i].date,
+ m = d.getMinutes();
+
+ str += '<li data-id="'
+ + alarmsArray[i].id
+ + '">'
+ + (d.getMonth() + 1)
+ + '/'
+ + d.getDate()
+ + '/'
+ + d.getFullYear()
+ + ' '
+ + d.getHours()
+ + ':'
+ + ((m < 10) ? "0" + m : m)
+ + ' Absolute alarm<br>(Period: '
+ + period
+ + ') <div data-role="button" data-inline="true">Delete</div></li>';
+ } else if (alarmsArray[i] instanceof tizen.AlarmRelative) {
+ str += '<li data-id="'
+ + alarmsArray[i].id
+ + '">'
+ + alarmsArray[i].delay
+ + ' sec Relative alarm<br>(Period: '
+ + period
+ + ') <div data-role="button" data-inline="true">Delete</div></li>';
+ } else {
+ alert("Wrong alarm instance");
+ break;
+ }
+ }
+ $("#alarm-all-list").html(str).trigger("create").listview("refresh");
+}
+
+function addAlarm(alarm) {
+ var arg;
+ arg = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
+ null,
+ null,
+ null,
+ [new tizen.ApplicationControlData("id", ["tctbhtests.Behavior"])]);
+
+ try {
+ tizen.alarm.add(alarm, "tctbhtests.Behavior", arg);
+ } catch (e) {
+ alert("error: " + e.message);
+ }
+}
+
+function addAlarmAbsolute() {
+ var period = parseInt($("#absolute-alarm-period").prop("value")),
+ time = $("#alarm-time").prop("value"),
+ year, month, date, hours, minutes, splits, d, t;
+
+ if (time == null || period < 0) {
+ alert("Getting alarm settings failed");
+ return;
+ }
+
+ splits = time.split("T");
+ d = splits[0].split("-");
+ t = splits[1].split(":");
+
+ year = parseInt(d[0]);
+ month = parseInt(d[1]) - 1;
+ date = parseInt(d[2]);
+ hours = parseInt(t[0]);
+ minutes = parseInt(t[1]);
+
+ var inputDate = new Date(year, month, date, hours, minutes, 0, 0);
+ var myAlarm = new tizen.AlarmAbsolute(inputDate, (period > 0 ? period : null));
+
+ //addAlarm(myAlarm, $("#launch-app-absolute"));
+ addAlarm(myAlarm);
+
+ //$.mobile.changePage("#main");
+ window.history.back();
+}
+
+function addAlarmRelative() {
+ var period = parseInt($("#relative-alarm-period").prop("value")),
+ delay = parseInt($("#relative-alarm-delay").prop("value"));
+
+ if ((delay < 0) || (period < 0)) {
+ alert("Getting alarm settings failed");
+ return;
+ }
+
+ var myAlarm = new tizen.AlarmRelative(delay, period);
+
+ //addAlarm(myAlarm, $("#launch-app-relative"));
+ addAlarm(myAlarm);
+
+ //$.mobile.changePage("#main");
+ window.history.back();
+}
+
+function removeAll() {
+ tizen.alarm.removeAll();
+ displayAlarms();
+}
+
+function removeAlarm(id) {
+ try {
+ tizen.alarm.remove(id);
+ } catch (e) {
+ console.log("Alarm remove failed. The once alarm might be already removed automatically");
+ }
+ displayAlarms();
+}
+
+function alarmInfo(id) {
+ var alarm = tizen.alarm.get(id);
+
+ if (alarm) {
+ if (alarm instanceof tizen.AlarmAbsolute) {
+ alert("Next scheduled alarm is " + alarm.getNextScheduledDate());
+ } else {
+ alert("Remaining seconds is " + alarm.getRemainingSeconds() + " SECS");
+ }
+ } else {
+ alert("Alarm info retrieving failed<br/>This once alarm might be already removed automatically");
+ displayAlarms();
+ }
+}