blob: 2d51d7e33e7a63b044694b89e0adecdeabd6be8e [file] [log] [blame]
package org.sflphone.client;
import android.test.ActivityInstrumentationTestCase2;
import com.robotium.solo.Solo;
import junit.framework.Assert;
import org.sflphone.R;
import org.sflphone.fragments.AboutFragment;
import org.sflphone.fragments.AccountsManagementFragment;
import org.sflphone.fragments.HomeFragment;
import org.sflphone.model.Account;
/**
* This is a simple framework for a test of an Application. See
* {@link android.test.ApplicationTestCase ApplicationTestCase} for more information on
* how to write and extend Application tests.
* <p/>
* To run this test, you can type:
* adb shell am instrument -w \
* -e class org.sflphone.client.HomeActivityTest \
* org.sflphone.tests/android.test.InstrumentationTestRunner
*/
public class HomeActivityTest extends ActivityInstrumentationTestCase2<HomeActivity> {
HomeActivity mActivity;
Solo mSolo;
public HomeActivityTest() {
super(HomeActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
mActivity = getActivity();
mSolo = new Solo(getInstrumentation(), getActivity());
}
public void testService() throws Exception {
Assert.assertTrue(mActivity.getService() != null);
Assert.assertTrue(mActivity.getService().getRecordPath() != null);
}
public void testSections() throws Exception {
mActivity.onSectionSelected(0);
Assert.assertTrue(mActivity.fContent instanceof HomeFragment);
String homeScreenTitle = String.format("%s.%s", getClass().getSimpleName(), getName());
mSolo.takeScreenshot(homeScreenTitle);
mActivity.onSectionSelected(1);
Assert.assertTrue(mActivity.fContent instanceof AccountsManagementFragment);
mSolo.sleep(500);
String accountsScreenTitle = String.format("%s.%s", ((Object)mActivity.fContent).getClass().getSimpleName(), getName());
mSolo.takeScreenshot(accountsScreenTitle);
mActivity.onSectionSelected(2);
Assert.assertTrue(mActivity.fContent instanceof AboutFragment);
mSolo.sleep(500);
String aboutScreenTitle = String.format("%s.%s", ((Object)mActivity.fContent).getClass().getSimpleName(), getName());
mSolo.takeScreenshot(aboutScreenTitle);
}
}