-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New unit test added in Smooth check box section, Message retry part, and node find section
- Loading branch information
1 parent
7f14733
commit 7ba988a
Showing
5 changed files
with
240 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
.../androidTest/java/com/w3engineers/unicef/util/lib/circle_checkbox/SmoothCheckBoxTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.w3engineers.unicef.util.lib.circle_checkbox; | ||
|
||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.os.Handler; | ||
import android.os.Looper; | ||
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/* | ||
* ============================================================================ | ||
* Copyright (C) 2019 W3 Engineers Ltd - All Rights Reserved. | ||
* Unauthorized copying of this file, via any medium is strictly prohibited | ||
* Proprietary and confidential | ||
* ============================================================================ | ||
*/ | ||
|
||
@RunWith(AndroidJUnit4.class) | ||
public class SmoothCheckBoxTest { | ||
private Context mContext; | ||
private static final String KEY_INSTANCE_STATE = "InstanceState"; | ||
|
||
@Before | ||
public void setUp() { | ||
mContext = InstrumentationRegistry.getContext(); | ||
} | ||
|
||
@Test | ||
public void stateSaveTest() { | ||
|
||
addDelay(); | ||
|
||
SmoothCheckBox entity = new SmoothCheckBox(mContext); | ||
|
||
entity.setChecked(true); | ||
|
||
Parcelable parcelable = entity.onSaveInstanceState(); | ||
|
||
entity.onRestoreInstanceState(parcelable); | ||
|
||
Bundle bundle = (Bundle) parcelable; | ||
|
||
assertTrue(bundle.getBoolean(KEY_INSTANCE_STATE)); | ||
|
||
addDelay(); | ||
} | ||
|
||
@Test | ||
public void uncheckEventOfBoxTest(){ | ||
addDelay(); | ||
|
||
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { | ||
@Override | ||
public void run() { | ||
SmoothCheckBox entity = new SmoothCheckBox(mContext); | ||
|
||
entity.setChecked(false,true); | ||
|
||
assertFalse(entity.isChecked()); | ||
|
||
addDelay(); | ||
addDelay(); | ||
addDelay(); | ||
} | ||
},1); | ||
|
||
} | ||
|
||
private void addDelay() { | ||
try { | ||
Thread.sleep(500); | ||
} catch (InterruptedException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.