Revision: 201035
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 17 Sep 2010 08:27:22 +0300
changeset 3 b2d662d68a49
parent 2 a4a7966c042b
child 4 6ea82847f1b7
Revision: 201035 Kit: 201037
calendarwidget.pkg
calendarwidgetplugin/inc/contentlayouthandler.h
calendarwidgetplugin/resource/calendarwidgetplugin.manifest
calendarwidgetplugin/src/contentlayouthandler.cpp
calendarwidgetplugin/tsrc/matti_testcases/Calendar_widget_tests.rb
calendarwidgetplugin/tsrc/matti_testcases/config/test_execution_profile.sip
package_definition.xml
package_map.xml
rom/bld.inf
--- a/calendarwidget.pkg	Thu Sep 02 20:15:01 2010 +0300
+++ b/calendarwidget.pkg	Fri Sep 17 08:27:22 2010 +0300
@@ -11,6 +11,8 @@
 ; Localised vendor names
 %{"Nokia Corporation"}
 
+"/epoc32/data/z/private/20022F35/import/widgetregistry/2002C35A/calendarwidgetplugin.manifest" - "$:/private/20022F35/import/widgetregistry/2002C35A/calendarwidgetplugin.manifest",FM,"application/hs-widget-uninstall+xml",RR,RW
+
 "/epoc32/release/armv5/urel/calendarwidgetplugin.dll"  - "$:/sys/bin/calendarwidgetplugin.dll"
 "/epoc32/data/z/private/20022F35/import/widgetregistry/2002C35A/calendarwidgetplugin.qtplugin"  - "$:/private/20022F35/import/widgetregistry/2002C35A/calendarwidgetplugin.qtplugin"
 "/epoc32/data/z/private/20022F35/import/widgetregistry/2002C35A/calendarwidgetplugin.manifest"  - "$:/private/20022F35/import/widgetregistry/2002C35A/calendarwidgetplugin.manifest"
--- a/calendarwidgetplugin/inc/contentlayouthandler.h	Thu Sep 02 20:15:01 2010 +0300
+++ b/calendarwidgetplugin/inc/contentlayouthandler.h	Fri Sep 17 08:27:22 2010 +0300
@@ -432,6 +432,11 @@
     AgendaUtil* mAgendaUtil;
     QList<AgendaEntry> mAgendaEntryList;
     XQSettingsManager* mCalendarKeyManager;
+    
+    //label visibility
+    bool mReminderVisible;
+    bool mUpperLabelLongVisible;
+    bool mUpperLabelShortVisible;
 
     // State variables
     bool mDateHighlightActive;
--- a/calendarwidgetplugin/resource/calendarwidgetplugin.manifest	Thu Sep 02 20:15:01 2010 +0300
+++ b/calendarwidgetplugin/resource/calendarwidgetplugin.manifest	Fri Sep 17 08:27:22 2010 +0300
@@ -1,8 +1,10 @@
-<?xml version="1.0" encoding="utf-8"?>
-<widgetprovider>
-    <widget library="calendarwidgetplugin"
-            uri="calendarwidgetplugin"
-            title="CalendarWidget"
-            iconuri="qtg_large_calendar.png"
-            description="Shows calendar events."/>
-</widgetprovider>
+<?xml version="1.0" encoding="UTF-8" ?>
+<hswidgetmanifest>
+    <uri>calendarwidgetplugin</uri>
+    <title>CalendarWidget</title>
+    <description>Shows calendar events.</description>
+    <icon>qtg_large_calendar.png</icon>
+    <previewimage>calendarwidgetpreview.png</previewimage>
+    <hidden>false</hidden>
+    <servicexml>calendarwidgetplugin.xml</servicexml>
+</hswidgetmanifest>
--- a/calendarwidgetplugin/src/contentlayouthandler.cpp	Thu Sep 02 20:15:01 2010 +0300
+++ b/calendarwidgetplugin/src/contentlayouthandler.cpp	Fri Sep 17 08:27:22 2010 +0300
@@ -333,6 +333,9 @@
     setLabelVisible(mUpperLabelLong, false);
     setLabelVisible(mLowerLabel, false);
     setLabelVisible(mReminderLabel, false);
+    mReminderVisible = false;
+    mUpperLabelLongVisible = false;
+    mUpperLabelShortVisible = false;
 }
 
 /*
@@ -880,7 +883,7 @@
     AgendaEntry entry = mAgendaEntryList.at(id);
     for (int i = id + 1; i < mAgendaEntryList.count(); i++) {
         if ((entry.startTime() <= mAgendaEntryList.at(i).startTime())
-            && (entry.endTime() >= mAgendaEntryList.at(i).startTime())
+            && (entry.endTime() > mAgendaEntryList.at(i).startTime())
             && entry.startTime().date() == mAgendaEntryList.at(i).startTime().date()) {
             aEndEventIndex = i;
             overlappingEvents++;
@@ -1109,9 +1112,12 @@
         // Make sure all three labels exists
         if (mUpperLabelShort && mUpperLabelLong && mReminderLabel) {
             int currentState = 0;
-            currentState += (mReminderLabel->isVisible() ? 1 : 0);
-            currentState += (mUpperLabelLong->isVisible()  ? 2 : 0);
-            currentState += (mUpperLabelShort->isVisible() ? 4 : 0);
+            bool reminderVisible = mReminderLabel->isVisible();
+            bool upperLabelLong = mUpperLabelLong->isVisible();
+            bool upperLabelShort = mUpperLabelShort->isVisible();
+            currentState += (/*mReminderLabel->isVisible()*/mReminderVisible ? 1 : 0);
+            currentState += (/*mUpperLabelLong->isVisible()*/mUpperLabelLongVisible  ? 2 : 0);
+            currentState += (/*mUpperLabelShort->isVisible()*/mUpperLabelShortVisible ? 4 : 0);
 
             int action = -1;
             if (label == mReminderLabel) {
@@ -1134,6 +1140,9 @@
             int newState = stateTransition[currentState * 4 + action];
             
             if (newState != currentState) {
+                mReminderVisible = newState & 1;
+                mUpperLabelLongVisible = newState & 2;
+                mUpperLabelShortVisible = newState & 4;
                 mReminderLabel->setVisible(newState & 1);
                 mUpperLabelLong->setVisible(newState & 2);
                 mUpperLabelShort->setVisible(newState & 4);
@@ -1172,10 +1181,7 @@
 
 void ContentLayoutHandler::setLowerLabelOverlapping(int numberOfEvents)
 {
-    QString trString(hbTrId("txt_calendar_widget_v_dblist_val_l1_events"));
-    // TODO: Remove the replacing of the parameter, once localized
-    //       string is corrected.
-    setLabelText(mLowerLabel, trString.replace("%Ln", "%L1").arg(numberOfEvents));
+    setLabelText(mLowerLabel, hbTrId("txt_calendar_widget_v_dblist_val_l1_events", numberOfEvents));
 }
 
 //from DateIconLayoutHandler
--- a/calendarwidgetplugin/tsrc/matti_testcases/Calendar_widget_tests.rb	Thu Sep 02 20:15:01 2010 +0300
+++ b/calendarwidgetplugin/tsrc/matti_testcases/Calendar_widget_tests.rb	Fri Sep 17 08:27:22 2010 +0300
@@ -17,7 +17,7 @@
 
 # require needed Ruby, MATTI and Orbit files
 require 'test/unit'
-require 'matti'
+require 'tdriver'
 require 'date'
 #require 'parsedate'
 #require 'OrbitBehaviours'
@@ -40,7 +40,7 @@
   def initialize (args)
 	super(args)
 	# MANDATORY DEFINITION: Define device "suts" which are used in testing, remember defined [ut] name in matti_parameters.xml
-	@sut = MATTI.sut(:Id => 'sut_s60_qt')
+	@sut = TDriver.sut(:Id => 'sut_s60_qt')
 	#to see if there is some widgets on the screen
 	retry_count = 0
 	begin
@@ -572,6 +572,58 @@
   
     ########################################################################################################################################
 	#
+	#	set_event_date_via_UI
+	#
+	#	description:
+	#		This function sets wanted event date via calendar UI  
+	#
+	#	preconditions: 
+	#
+	#	parameters:
+	#		-app:				application needed
+	#		-date:				date, what is wanted to set
+	#
+	#	created: Jarno Mäkelä
+	#	creation date: 20-Aug-2010
+	#
+	########################################################################################################################################
+	  
+  def set_event_date_via_UI(app,date)
+	#Check,what value there is currently in hour date
+	current_day_value = app.HbDatePickerView(:__index => 0).HbAbstractItemContainer.HbDatePickerViewItem(:__index => 2).HbTextItem.attribute("text")
+	puts "current_day_value = " + current_day_value
+	current_day_value_i = current_day_value.to_i
+	set_date_day_value = date[0..1]
+	puts "set_date_day_value = " + set_date_day_value
+	set_date_day_value_i = set_date_day_value.to_i
+	for i in 0..(set_date_day_value_i - 1 - current_day_value_i)
+		index = 2 + i
+		app.HbDatePickerView(:__index => 0).HbAbstractItemContainer.HbDatePickerViewItem(:__index => index).HbTextItem.gesture(:Up,0.5,53)
+	end
+	current_month_value = app.HbDatePickerView(:__index => 1).HbAbstractItemContainer.HbDatePickerViewItem(:__index => 2).HbTextItem.attribute("text")
+	puts "current_month_value = " + current_month_value
+	current_month_value_i = current_month_value.to_i
+	set_date_month_value = date[3..4]
+	puts "set_date_month_value = " + set_date_month_value
+	set_date_month_value_i = set_date_month_value.to_i
+	for i in 0..(set_date_month_value_i - 1 - current_month_value_i)
+		index = 2 + i
+		app.HbDatePickerView(:__index => 1).HbAbstractItemContainer.HbDatePickerViewItem(:__index => index).HbTextItem.gesture(:Up,0.5,53)
+	end
+	current_year_value = app.HbDatePickerView(:__index => 2).HbAbstractItemContainer.HbDatePickerViewItem(:__index => 2).HbTextItem.attribute("text")
+	puts "current_year_value = " + current_year_value
+	current_year_value_i = current_year_value.to_i
+	set_date_year_value = date[6..9]
+	puts "set_date_year_value = " + set_date_year_value
+	set_date_year_value_i = set_date_year_value.to_i
+	for i in 0..(set_date_year_value_i - 1 - current_year_value_i)
+		index = 2 + i
+		app.HbDatePickerView(:__index => 2).HbAbstractItemContainer.HbDatePickerViewItem(:__index => index).HbTextItem.gesture(:Up,0.5,53)
+	end
+  end
+  
+    ########################################################################################################################################
+	#
 	#	create_calendar_event !!!FIXTURE NOT WORKING !!!
 	#
 	#	description:
@@ -730,12 +782,20 @@
 	cal_app.HbPushButton( :name => 'startTime' ).tap
 	set_event_time_via_UI(cal_app,start_time_to_verify)
 	cal_app.HbTextItem( :text => 'OK' ).tap
+	#cal_app.HbIconItem(:iconName => 'qtg_mono_back').tap
+	start_date = start_time_split[0]
+	#add start date
+	if start_date[0..1].to_i > @day.to_i || start_date[3..4].to_i > @month.to_i || start_date[6..9].to_i > @year.to_i then
+		puts "calendar event is in another day that today in future"
+		#set calendar date
+		cal_app.HbPushButton( :name => 'startDate' ).tap
+		set_event_date_via_UI(cal_app,start_date)
+		cal_app.HbTextItem( :text => 'OK' ).tap
+	end
 	cal_app.HbIconItem(:iconName => 'qtg_mono_back').tap
-	#cal_app.HbIconItem(:iconName => 'qtg_mono_back').tap
 	cal_app.close
 	#let's put date if event is in other future day than today
 	if start_day > @day.to_i then
-	   start_date = start_time_split[0]
 	   month_text = case start_date[3..4]
 			when "01" then "Jan"
 			when "02" then "Feb"
@@ -780,7 +840,6 @@
   ############################################################################################################################################
 
   def test_initialize_calendar_widget_test_env
-	puts "test_initialize_calendar_widget_test_env start"
 	app = @sut.application(:name => 'hsapplication')
 	#Let's check existing Home screens
 	#identificator = TestObjectIdentificator.new(:type => :HsPageVisual)
@@ -942,12 +1001,11 @@
 		#Device is in Homescreen
 		app = @sut.application(:name => 'hsapplication')
 		verify(){app.HbIconItem(:iconName => 'qtg_mono_applications_all')}
-		navigate_to_first_homescreen
 		#- One event happens few hours after current phone time at today and one event at tomorrow in Calendar.
 		check_phone_date
 		check_phone_time
 		today_time_for_verification = create_calendar_event_via_calendar("not working",@day.to_i,@month.to_i,@year.to_i,@hour.to_i+2,@minute.to_i,0,1,0)
-		tomorrow_time_for_verification = create_calendar_event(app, 'Tomorrow meeting',@day.to_i+1,@month.to_i,@year.to_i,@hour.to_i,@minute.to_i,0,1,0)
+		tomorrow_time_for_verification = create_calendar_event_via_calendar("not working",@day.to_i+1,@month.to_i,@year.to_i,@hour.to_i+2,@minute.to_i,0,1,0)
 		#-Calendar widget is added to Home Screen.
 		#Not adding calendar widget, if it already exists there
 		if not(app.test_object_exists?("HbWidget",{:name => 'CalendarWidget'})) then
@@ -962,15 +1020,12 @@
 		day_to_verify = @day.to_i
 		verify(){app.HbTextItem(:text => day_to_verify)}
 		verify(){app.HbLabel( :name => 'upperLabel' ).HbTextItem( :text => today_time_for_verification )}
-		verify(){app.HbLabel( :name => 'lowerLabel' ).HbTextItem( :text => 'Today meeting' )}
+		verify(){app.HbLabel( :name => 'lowerLabel' ).HbTextItem( :text => 'Unnamed' )}
 		#Verify, that reminder icon in widget is shown
-		#cannot verify yet, since with calendar fixture only events, that has no reminder, are possible to create
-		#if not(app.test_object_exists?("HbIconItem",{:iconName => 'images/bell.PNG'})) then
-		#	raise VerificationError ,"ERROR: There is not reminder icon in calendar widget, when it should be there", caller
-		#end
-		
-		remove_calendar_widget_from_homescreen(0)
-		delete_calendar_events(app)
+		if not(app.test_object_exists?("HbFrameItem",{:frameGraphicsName => 'qtg_small_reminder'})) then
+			raise VerificationError ,"ERROR: There is not reminder icon in calendar widget, when it should be there", caller
+		end
+		delete_calendar_events_via_UI
 	#rescue
 	#	if (running_round < max_running_rounds) then
     #       running_round = running_round + 1
@@ -1111,7 +1166,7 @@
   #
   #	===	preconditions
   #	- Device is in Home Screen.
-  # - Some events are created in Calendar.
+  # - At least one upcoming event created in Calendar.
   # - Calendar widget is added to Home Screen.
   #
   #	===	params
@@ -1119,8 +1174,31 @@
   #
   ############################################################################################################################################
   
-  def _test_calendar_widget_tapping_upcoming_event
-	
+  def test_calendar_widget_tapping_upcoming_event
+	#Preconditions:
+	#	- Device is in Home Screen.
+	app = @sut.application(:name => 'hsapplication')
+	# - At least one upcoming event created in Calendar.
+	check_phone_date
+	check_phone_time
+	today_time_for_verification = create_calendar_event_via_calendar("not working",@day.to_i,@month.to_i,@year.to_i,@hour.to_i+2,@minute.to_i,0,0,0)
+	#-Calendar widget is added to Home Screen.
+	#Not adding calendar widget, if it already exists there
+	if not(app.test_object_exists?("HbWidget",{:name => 'CalendarWidget'})) then
+		#add calendar widget to home screen
+		app.HbIconItem(:iconName => 'qtg_mono_applications_all').tap
+		add_calendar_widget_to_homescreen(app,'AppListButton')
+	end	
+	#Step 1:Tap on the upcoming event in Calendar widget.
+	app.HbTextItem( :text => today_time_for_verification ).tap
+	#Step 1 Expected: 
+	#- Calendar agenda view is opened.
+	#- The date is same as the event date.
+	cal_app = @sut.application(:name => 'calendar')
+	verify(){cal_app.CalenAgendaView( :name => 'agendaView' )}
+	#Error in SW, cannot verify date yet, since shows no date
+	#postactions
+	delete_calendar_events_via_UI
   end
   
   ##############################################################################################################################################
--- a/calendarwidgetplugin/tsrc/matti_testcases/config/test_execution_profile.sip	Thu Sep 02 20:15:01 2010 +0300
+++ b/calendarwidgetplugin/tsrc/matti_testcases/config/test_execution_profile.sip	Fri Sep 17 08:27:22 2010 +0300
@@ -5,6 +5,7 @@
 test_calendar_widget_one_event_today_one_event_tomorrow(TestClassCalendarWidget)=0
 test_calendar_widget_overlapping_events_fixed(TestClassCalendarWidget)=1
 test_calendar_widget_overlapping_events(TestClassCalendarWidget)=0
+test_calendar_widget_tapping_upcoming_event(TestClassCalendarWidget)=1
 test_calendar_widget_no_events(TestClassCalendarWidget)=1
 test_Calendar_widget_NFT_Switch_between_HS_and_application_library_50_times(TestClassCalendarWidget)=0
 test_calendar_widget_One_upcoming_event_in_7_day_away_and_one_in_8_day_away(TestClassCalendarWidget)=0
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml	Fri Sep 17 08:27:22 2010 +0300
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0" xmlns:qt="http://www.nokia.com/qt">
+   <package id="calendarwidget" name="Calendar Widget" levels="build app">
+    <collection id="calendarwidget_info" name="Calendar Widget Info" level="build">
+     <component id="calendarwidget_rom" name="Calendar Widget ROM" filter="s60,dfs_build" introduced="^4">
+      <unit bldFile="rom"/>
+     </component>
+    </collection>
+    <collection id="calendarwidgetinstaller" name="Calendar Widget Installer" level="build">
+		<!-- collection is really a component, need to move down a directory -->
+     <component id="calendarwidgetinstaller_build" name="Calendar Widget Installer Build" filter="s60,dfs_build" introduced="^4">
+	  <unit bldFile="calendarwidgetinstaller" qt:proFile="calendarwidgetinstaller.pro"/>
+     </component>
+    </collection>
+    <collection id="calendarwidgetplugin" name="Calendar Widget Plugin" level="app">
+		<!-- collection is really a component, need to move down a directory -->
+     <component id="calendarwidgetplugin_build" name="Calendar Widget Plugin Build" filter="s60,dfs_build" introduced="^4" class="plugin">
+	  <unit bldFile="calendarwidgetplugin" qt:proFile="calendarwidgetplugin.pro"/>
+     </component>
+     <component id="calendarwidgetplugin_test" name="Calendar Widget Plugin Test" filter="s60,dfs_build" introduced="^4">
+      <unit bldFile="calendarwidgetplugin/tsrc" qt:proFile="tsrc.pro"/>
+     </component>
+    </collection>
+   </package>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_map.xml	Fri Sep 17 08:27:22 2010 +0300
@@ -0,0 +1,1 @@
+<PackageMap root="sf" layer="app"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rom/bld.inf	Fri Sep 17 08:27:22 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+PRJ_MMPFILES
+
+ gnumakefile ../sis/calendarwidget_stub_sis.mk
+
+prj_extensions
+
+ START EXTENSION app-services/buildstubsis
+ OPTION SRCDIR ../sis
+ OPTION SISNAME calendarwidget_stub
+ END
+
+
+PRJ_EXPORTS
+
+calendarwidget.iby CORE_APP_LAYER_IBY_EXPORT_PATH(calendarwidget.iby)
+calendarwidgetresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(calendarwidgetresources.iby)