fix TC fail
authorGwangbok Kim <gwangbok.kim@samsung.com>
Tue, 19 Mar 2013 08:18:49 +0000 (17:18 +0900)
committerGwangbok Kim <gwangbok.kim@samsung.com>
Tue, 19 Mar 2013 11:36:58 +0000 (20:36 +0900)
Change-Id: I4d00a45a4bb1d96bea7baf6f55f1d2c091cd4a7f
Signed-off-by: Gwangbok Kim <gwangbok.kim@samsung.com>
inc/FSclContact.h
src/FScl_ContactEventImpl.cpp
src/FScl_ContactEventImpl.h
src/FScl_ContactImpl.cpp

index 0b2bf73..30293a4 100644 (file)
@@ -429,7 +429,7 @@ public:
         * @param[in]   index                   An index to set the value
         * @param[in]   event                   The event to set
         * @exception   E_SUCCESS               The method is successful.
-        * @exception   E_INVALID_ARG           The specified @c event is empty.
+        * @exception   E_INVALID_ARG           The date of the specified @c event has not been set.
         * @exception   E_OUT_OF_RANGE          The specified @c index is outside the bounds of the properties.
         */
        result SetEventAt(int index, const ContactEvent& event);
@@ -584,7 +584,7 @@ public:
         * @return      An error code
         * @param[in]   event                   The event to add
         * @exception   E_SUCCESS               The method is successful.
-        * @exception   E_INVALID_ARG           The specified @c event is empty.
+        * @exception   E_INVALID_ARG           The date of the specified @c event has not been set.
         */
        result AddEvent(const ContactEvent& event);
 
index 047b025..7175c7e 100644 (file)
@@ -32,6 +32,7 @@ namespace Tizen { namespace Social
 
 _ContactEventImpl::_ContactEventImpl(void)
 : __type(CONTACT_EVENT_TYPE_BIRTHDAY)
+, __isDateChanged(false)
 {
 }
 
@@ -40,6 +41,7 @@ _ContactEventImpl::_ContactEventImpl(const _ContactEventImpl& rhs)
        __date = rhs.__date;
        __type = rhs.__type;
        __label = rhs.__label;
+       __isDateChanged = rhs.__isDateChanged;
 }
 
 _ContactEventImpl::~_ContactEventImpl(void)
@@ -58,6 +60,7 @@ _ContactEventImpl::operator =(const _ContactEventImpl& rhs)
        __date = rhs.__date;
        __type = rhs.__type;
        __label = rhs.__label;
+       __isDateChanged = rhs.__isDateChanged;
 
        return *this;
 }
@@ -137,6 +140,7 @@ void
 _ContactEventImpl::SetDate(const DateTime& date)
 {
        __date = date;
+       __isDateChanged = true;
 }
 
 void
@@ -145,6 +149,12 @@ _ContactEventImpl::SetLabel(const String& label)
        __label = label;
 }
 
+bool
+_ContactEventImpl::IsDateChanged(void) const
+{
+       return __isDateChanged;
+}
+
 const _ContactEventImpl*
 _ContactEventImpl::GetInstance(const ContactEvent& contactEvent)
 {
index a7acabd..0042b3e 100644 (file)
@@ -66,6 +66,8 @@ public:
 
        bool operator !=(const _ContactEventImpl& rhs) const;
 
+       bool IsDateChanged(void) const;
+
        static const _ContactEventImpl* GetInstance(const ContactEvent& contactEvent);
 
        static _ContactEventImpl* GetInstance(ContactEvent& contactEvent);
@@ -74,6 +76,7 @@ private:
        ContactEventType __type;
        Tizen::Base::DateTime __date;
        Tizen::Base::String __label;
+       bool __isDateChanged;
 }; // _ContactEventImpl
 
 }} // Tizen::Social
index c524414..38f44f1 100644 (file)
@@ -45,6 +45,7 @@
 #include "FScl_AddressImpl.h"
 #include "FScl_ImAddressImpl.h"
 #include "FScl_OrganizationImpl.h"
+#include "FScl_ContactEventImpl.h"
 
 using namespace Tizen::App;
 using namespace Tizen::Base;
@@ -1805,6 +1806,7 @@ result
 _ContactImpl::AddEvent(const ContactEvent& event)
 {
        SysTryReturn(NID_SCL, !__isRemoved || !IsFailed(Invalidate()), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+       SysTryReturn(NID_SCL, _ContactEventImpl::GetInstance(event)->IsDateChanged(), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The datetime of the event has not been set.", GetErrorMessage(E_INVALID_ARG));
 
        int type = 0;
        int intValue = 0;
@@ -2526,6 +2528,7 @@ _ContactImpl::SetEventAt(int index, const ContactEvent& event)
 {
        SysTryReturn(NID_SCL, index >= 0, E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[%s] index %d must be greater than or equal to 0.", GetErrorMessage(E_OUT_OF_RANGE), index);
        SysTryReturn(NID_SCL, !__isRemoved || Invalidate() == E_SUCCESS, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+       SysTryReturn(NID_SCL, _ContactEventImpl::GetInstance(event)->IsDateChanged(), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The datetime of the event has not been set.", GetErrorMessage(E_INVALID_ARG));
 
        int type = 0;
        int intValue = 0;