New tests + new handling of second linphone core for test env + fix in layout for tests

This commit is contained in:
Sylvain Berfini 2013-06-14 10:55:59 +02:00
parent 17b07db88d
commit c22a6688a9
11 changed files with 78 additions and 46 deletions

View file

@ -34,7 +34,7 @@
android:src="@drawable/call_answer" />
<ImageView
android:id="@+id/chat"
android:id="@+id/start_chat"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"

View file

@ -115,7 +115,7 @@ public class ContactFragment extends Fragment implements OnClickListener {
v.findViewById(R.id.dial).setVisibility(View.GONE);
}
v.findViewById(R.id.chat).setOnClickListener(chatListener);
v.findViewById(R.id.start_chat).setOnClickListener(chatListener);
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
if (lpc != null) {
if (!displayednumberOrAddress.startsWith("sip:")) {
@ -126,9 +126,9 @@ public class ContactFragment extends Fragment implements OnClickListener {
if (!numberOrAddress.contains("@")) {
tag = numberOrAddress + "@" + lpc.getDomain();
}
v.findViewById(R.id.chat).setTag(tag);
v.findViewById(R.id.start_chat).setTag(tag);
} else {
v.findViewById(R.id.chat).setTag(numberOrAddress);
v.findViewById(R.id.start_chat).setTag(numberOrAddress);
}
final String finalNumberOrAddress = numberOrAddress;
@ -161,7 +161,7 @@ public class ContactFragment extends Fragment implements OnClickListener {
}
if (getResources().getBoolean(R.bool.disable_chat)) {
v.findViewById(R.id.chat).setVisibility(View.GONE);
v.findViewById(R.id.start_chat).setVisibility(View.GONE);
}
controls.addView(v);

View file

@ -18,6 +18,9 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
/**
* @author Sylvain Berfini
*/
public class AccountAssistant extends SampleTest {
@SmallTest

View file

@ -11,6 +11,9 @@ import org.linphone.core.LinphoneProxyConfig;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.KeyEvent;
/**
* @author Sylvain Berfini
*/
public class AccountManagement extends SampleTest {
@LargeTest
@ -33,7 +36,7 @@ public class AccountManagement extends SampleTest {
LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
Assert.assertEquals(proxyConfigs.length, 2);
LinphoneProxyConfig proxyConfig = proxyConfigs[1];
Assert.assertEquals(proxyConfig.getState(), RegistrationState.RegistrationOk);
Assert.assertEquals(RegistrationState.RegistrationOk, proxyConfig.getState());
Assert.assertTrue(proxyConfig.getIdentity(), proxyConfig.getIdentity().contains("new"));
}

View file

@ -0,0 +1,26 @@
package org.linphone.test;
import junit.framework.Assert;
import org.linphone.core.LinphoneCore.RegistrationState;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
/**
* @author Sylvain Berfini
*/
public class AinitTestEnv extends SampleTest {
@SmallTest
@MediumTest
@LargeTest
public void testAInitLinphoneCore() {
LinphoneTestManager.createAndStart(aContext, iContext);
solo.sleep(2000);
Assert.assertEquals(RegistrationState.RegistrationOk, LinphoneTestManager.getLc().getProxyConfigList()[0].getState());
}
}

View file

@ -5,28 +5,20 @@ import junit.framework.Assert;
import org.linphone.InCallActivity;
import org.linphone.LinphoneActivity;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCore.RegistrationState;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
/**
* @author Sylvain Berfini
*/
public class Calls extends SampleTest {
@SmallTest
@MediumTest
@LargeTest
public void testAInitLinphoneCore() {
LinphoneTestManager.createAndStart(aContext, iContext);
solo.sleep(2000);
Assert.assertEquals(RegistrationState.RegistrationOk, LinphoneTestManager.getLc().getProxyConfigList()[0].getState());
}
@SmallTest
@MediumTest
@LargeTest
public void testBSimpleCall() {
public void testASimpleCall() {
solo.enterText(0, iContext.getString(R.string.account_test_calls_login) + "@" + iContext.getString(R.string.account_test_calls_domain));
solo.clickOnView(solo.getView(org.linphone.R.id.Call));
@ -40,11 +32,4 @@ public class Calls extends SampleTest {
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@SmallTest
@MediumTest
@LargeTest
public void testZShutDownLinphoneCore() {
LinphoneTestManager.destroy();
}
}

View file

@ -6,24 +6,16 @@ import org.linphone.LinphoneActivity;
import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatMessage.State;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.mediastream.Log;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
/**
* @author Sylvain Berfini
*/
public class Chat extends SampleTest {
@SmallTest
@MediumTest
@LargeTest
public void testAInitLinphoneCore() {
LinphoneTestManager.createAndStart(aContext, iContext);
solo.sleep(2000);
Assert.assertEquals(RegistrationState.RegistrationOk, LinphoneTestManager.getLc().getProxyConfigList()[0].getState());
}
@LargeTest
public void testBEmptyChatHistory() {
@ -53,7 +45,6 @@ public class Chat extends SampleTest {
public void testDNotEmptyChatHistory() {
goToChat();
Assert.assertFalse(solo.searchText(aContext.getString(org.linphone.R.string.no_chat_history)));
Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.account_test_calls_login)));
}
@ -105,13 +96,6 @@ public class Chat extends SampleTest {
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.no_chat_history)));
}
@SmallTest
@MediumTest
@LargeTest
public void testZShutDownLinphoneCore() {
LinphoneTestManager.destroy();
}
private void goToChat() {
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);

View file

@ -8,6 +8,9 @@ import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
/**
* @author Sylvain Berfini
*/
public class Contacts extends SampleTest {
@MediumTest
@ -87,6 +90,10 @@ public class Contacts extends SampleTest {
@LargeTest
public void testFStartChatFromContact() {
goToContacts();
solo.clickOnText(iContext.getString(org.linphone.test.R.string.contact_name));
solo.clickOnView(solo.getView(org.linphone.R.id.start_chat));
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.button_send_message)));
}
@SmallTest

View file

@ -10,6 +10,9 @@ import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
/**
* @author Sylvain Berfini
*/
public class History extends SampleTest {
@SmallTest
@ -40,6 +43,7 @@ public class History extends SampleTest {
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
solo.sleep(2000);
Assert.assertEquals(1, LinphoneTestManager.getLc().getCallsNb());
Assert.assertEquals(LinphoneCall.State.StreamsRunning, LinphoneTestManager.getLc().getCalls()[0].getState());
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));

View file

@ -8,8 +8,9 @@ import android.widget.ListView;
import com.jayway.android.robotium.solo.Solo;
/**
* @author Sylvain Berfini
*/
public abstract class SampleTest extends ActivityInstrumentationTestCase2<LinphoneLauncherActivity>{
protected final int STRING_LENGTH_MAX = 20;

View file

@ -0,0 +1,19 @@
package org.linphone.test;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
/**
* @author Sylvain Berfini
*/
public class ZShutdownTestEnv extends SampleTest {
@SmallTest
@MediumTest
@LargeTest
public void testZShutDownLinphoneCore() {
LinphoneTestManager.destroy();
}
}