Skip to content

Commit

Permalink
Backup Calendar-Contacts configured with test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed Aug 5, 2024
1 parent cf222d4 commit 0dfc9a1
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 8 deletions.
20 changes: 13 additions & 7 deletions app/src/main/res/layout/backup_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
android:id="@+id/backup_settings_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/standard_quarter_padding"
android:text="@string/backup_settings"
android:textStyle="bold" />

Expand Down Expand Up @@ -82,7 +81,7 @@
android:layout_height="wrap_content"
android:text="@string/daily_backup"
android:textColor="@color/text_color"
android:textSize="@dimen/two_line_primary_text_size" />
android:textSize="14sp" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/last_backup_with_date"
Expand All @@ -100,25 +99,32 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/alternate_half_margin"
android:layout_marginTop="@dimen/standard_margin"
android:gravity="end"
android:layout_marginRight="@dimen/alternate_half_margin"
android:layout_marginBottom="@dimen/standard_margin"
android:orientation="horizontal">

<com.google.android.material.button.MaterialButton
android:id="@+id/contacts_datepicker"
style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="@dimen/backup_button_width"
style="@style/OutlinedButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/alternate_half_margin"
android:layout_marginEnd="@dimen/alternate_half_margin"
android:layout_weight="0.8"
android:minHeight="@dimen/minimum_size_for_touchable_area"
android:text="@string/restore_backup"
android:visibility="invisible"
tools:visibility="visible" />

<com.google.android.material.button.MaterialButton
android:id="@+id/backup_now"
android:layout_width="@dimen/backup_button_width"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/standard_half_margin"
android:layout_marginStart="@dimen/alternate_half_margin"
android:layout_marginEnd="@dimen/alternate_half_margin"
android:layout_weight="1"
android:minHeight="@dimen/minimum_size_for_touchable_area"
android:text="@string/contacts_backup_button"
android:theme="@style/Widget.Material3.Button.IconButton.Filled" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<integer name="contacts_backup_expire">-1</integer>
<string name="calendar_backup_folder">/.Calendar-Backup</string>
<!-- flag to enable/disable contact backup -->
<bool name="show_calendar_backup">true</bool>
<bool name="show_calendar_backup">false</bool>

<!-- What's new -->
<bool name="show_whats_new">true</bool>
Expand Down
33 changes: 33 additions & 0 deletions app/src/test/java/com/nmc/android/CalendarBackupSetupTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.nmc.android

import android.content.res.Resources
import com.owncloud.android.R
import org.junit.After
import org.junit.Before
import org.junit.Test
import org.mockito.Mock
import org.mockito.MockitoAnnotations

class CalendarBackupSetupTest {

@Mock
lateinit var resources: Resources

private lateinit var mocks: AutoCloseable

@Before
fun setUp() {
mocks = MockitoAnnotations.openMocks(this)
}

@Test
fun assertShowCalendarBackupBooleanFalse(){
assert(!resources.getBoolean(R.bool.show_calendar_backup))
}

@After
fun tearDown() {
mocks.close()
}

}

0 comments on commit 0dfc9a1

Please sign in to comment.