diff options
author | Maurice Lam <yukl@google.com> | 2015-04-02 17:03:08 -0700 |
---|---|---|
committer | Maurice Lam <yukl@google.com> | 2015-04-03 18:26:42 -0700 |
commit | d61674efcfaa9f591a44fc75d59566cdd5b409eb (patch) | |
tree | 220ca8157515e15800bd28058bede2f794a42499 /library/test/src/com/android/setupwizardlib/test/SetupWizardLayoutTests.java | |
parent | e7b519c1769be4e43fff8c9a909cb1ba15f25ebb (diff) | |
download | android_frameworks_opt_setupwizard-d61674efcfaa9f591a44fc75d59566cdd5b409eb.tar.gz android_frameworks_opt_setupwizard-d61674efcfaa9f591a44fc75d59566cdd5b409eb.tar.bz2 android_frameworks_opt_setupwizard-d61674efcfaa9f591a44fc75d59566cdd5b409eb.zip |
[SetupWizardLib] Add progress bar support
Added methods showProgressBar, hideProgressBar and isProgressBarShown
to SetupWizardLayout, that will show the bar if the corresponding
ViewStub exists.
This implementation has an improvement over existing Setup Wizard
implementations in that it supports ListViews as well as ScrollViews,
and the progress bar will be sticky together with the header instead
of being scrolled away.
Change-Id: Ifd7acae36a9b244d759b6528bb5dfdc3e1d15091
Diffstat (limited to 'library/test/src/com/android/setupwizardlib/test/SetupWizardLayoutTests.java')
-rw-r--r-- | library/test/src/com/android/setupwizardlib/test/SetupWizardLayoutTests.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/library/test/src/com/android/setupwizardlib/test/SetupWizardLayoutTests.java b/library/test/src/com/android/setupwizardlib/test/SetupWizardLayoutTests.java index cce2f70..f640ca8 100644 --- a/library/test/src/com/android/setupwizardlib/test/SetupWizardLayoutTests.java +++ b/library/test/src/com/android/setupwizardlib/test/SetupWizardLayoutTests.java @@ -24,6 +24,7 @@ import android.test.suitebuilder.annotation.SmallTest; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; +import android.widget.ProgressBar; import android.widget.TextView; import com.android.setupwizardlib.SetupWizardLayout; @@ -112,6 +113,36 @@ public class SetupWizardLayoutTests extends InstrumentationTestCase { assertNull("getNavigationBar() in test_template should return null", navigationBar); } + @SmallTest + public void testShowProgressBar() { + final SetupWizardLayout layout = new SetupWizardLayout(mContext); + layout.showProgressBar(); + assertTrue("Progress bar should be shown", layout.isProgressBarShown()); + final View progressBar = layout.findViewById(R.id.suw_layout_progress); + assertTrue("Progress bar view should be shown", + progressBar instanceof ProgressBar && progressBar.getVisibility() == View.VISIBLE); + } + + @SmallTest + public void testHideProgressBar() { + final SetupWizardLayout layout = new SetupWizardLayout(mContext); + layout.showProgressBar(); + assertTrue("Progress bar should be shown", layout.isProgressBarShown()); + layout.hideProgressBar(); + assertFalse("Progress bar should be hidden", layout.isProgressBarShown()); + final View progressBar = layout.findViewById(R.id.suw_layout_progress); + assertTrue("Progress bar view should exist", + progressBar == null || progressBar.getVisibility() != View.VISIBLE); + } + + @SmallTest + public void testShowProgressBarNotExist() { + // test_template does not have progress bar, so showNavigationBar() should do nothing. + final SetupWizardLayout layout = new SetupWizardLayout(mContext, R.layout.test_template); + layout.showProgressBar(); + assertFalse("Progress bar should not be shown", layout.isProgressBarShown()); + } + private void assertDefaultTemplateInflated(SetupWizardLayout layout) { View decorView = layout.findViewById(R.id.suw_layout_decor); View navbar = layout.findViewById(R.id.suw_layout_navigation_bar); |