Android Open Source - twawm2 Customize Actions Activity Test






From Project

Back to project page twawm2.

License

The source code is released under:

Copyright (c) 2014, afnf All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistr...

If you think the Android project twawm2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.appspot.afnf4199ga.twawm.ctl;
//from   w  w  w.  j ava2s.  com
import java.util.ArrayList;

import net.afnf.and.twawm2.DexmakerInstrumentationTestCase;

public class CustomizeActionsActivityTest extends DexmakerInstrumentationTestCase {

  public void testConstructListItemArrayFromCustomizedData_01() {

    String[] labels = { "label1", "label2", "label3", "label4", "label5" };
    String[] customizedDatas = { null, "", "a1,", "a1,b1,", "a1,b1,c1,d1,e1,f1,", "A1,", "zzzzzzzzzzzzzzz" };

    for (String customizedData : customizedDatas) {
      ArrayList<ListItem> array = CustomizeActionsActivity.constructListItemArrayFromCustomizedData(labels, customizedData);
      assertEquals(5, array.size());
      int i = 0;
      assertEquals("a,label1,1", array.get(i++).toString());
      assertEquals("b,label2,1", array.get(i++).toString());
      assertEquals("c,label3,1", array.get(i++).toString());
      assertEquals("d,label4,1", array.get(i++).toString());
      assertEquals("e,label5,1", array.get(i++).toString());
    }
  }

  public void testConstructListItemArrayFromCustomizedData_02() {

    String[] labels = { "label1", "label2", "label3", "label4", "label5" };
    String[] customizedDatas = { "a1,b0,", "a1,b0,c1,d1,e1,f1," };

    for (String customizedData : customizedDatas) {
      ArrayList<ListItem> array = CustomizeActionsActivity.constructListItemArrayFromCustomizedData(labels, customizedData);
      assertEquals(5, array.size());
      int i = 0;
      assertEquals("a,label1,1", array.get(i++).toString());
      assertEquals("b,label2,0", array.get(i++).toString());
      assertEquals("c,label3,1", array.get(i++).toString());
      assertEquals("d,label4,1", array.get(i++).toString());
      assertEquals("e,label5,1", array.get(i++).toString());
    }
  }

  public void testConstructListItemArrayFromCustomizedData_03() {

    String[] labels = { "label1", "label2", "label3", "label4", "label5" };
    String[] customizedDatas = { "a1,c0,b1", "a1,c0,b1,d1,e1" };

    for (String customizedData : customizedDatas) {
      ArrayList<ListItem> array = CustomizeActionsActivity.constructListItemArrayFromCustomizedData(labels, customizedData);
      assertEquals(5, array.size());
      int i = 0;
      assertEquals("a,label1,1", array.get(i++).toString());
      assertEquals("c,label3,0", array.get(i++).toString());
      assertEquals("b,label2,1", array.get(i++).toString());
      assertEquals("d,label4,1", array.get(i++).toString());
      assertEquals("e,label5,1", array.get(i++).toString());
    }
  }

  public void testConstructListItemArrayFromCustomizedData_04() {

    String[] labels = { "label1", "label2", "label3", "label4", "label5" };
    String[] customizedDatas = { "c1,a1,b0", "c1,a1,b0,d1,e1" };

    for (String customizedData : customizedDatas) {
      ArrayList<ListItem> array = CustomizeActionsActivity.constructListItemArrayFromCustomizedData(labels, customizedData);
      assertEquals(5, array.size());
      int i = 0;
      assertEquals("c,label3,1", array.get(i++).toString());
      assertEquals("a,label1,1", array.get(i++).toString());
      assertEquals("b,label2,0", array.get(i++).toString());
      assertEquals("d,label4,1", array.get(i++).toString());
      assertEquals("e,label5,1", array.get(i++).toString());
    }
  }

  public void testConstructListItemArrayFromCustomizedData_05() {

    String[] labels = { "label1", "label2", "label3", "label4", "label5" };
    String[] customizedDatas = { "e0,a1,b0,d1,c1" };

    for (String customizedData : customizedDatas) {
      ArrayList<ListItem> array = CustomizeActionsActivity.constructListItemArrayFromCustomizedData(labels, customizedData);
      assertEquals(5, array.size());
      int i = 0;
      assertEquals("e,label5,0", array.get(i++).toString());
      assertEquals("a,label1,1", array.get(i++).toString());
      assertEquals("b,label2,0", array.get(i++).toString());
      assertEquals("d,label4,1", array.get(i++).toString());
      assertEquals("c,label3,1", array.get(i++).toString());
    }
  }
}




Java Source Code List

com.appspot.afnf4199ga.twawm.BluetoothHelper.java
com.appspot.afnf4199ga.twawm.Const.java
com.appspot.afnf4199ga.twawm.Const.java
com.appspot.afnf4199ga.twawm.HostnameListTest.java
com.appspot.afnf4199ga.twawm.HostnameList.java
com.appspot.afnf4199ga.twawm.IconSelectorTest.java
com.appspot.afnf4199ga.twawm.IconSelector.java
com.appspot.afnf4199ga.twawm.OnlineChecker.java
com.appspot.afnf4199ga.twawm.StateMachineTest.java
com.appspot.afnf4199ga.twawm.StateMachine.java
com.appspot.afnf4199ga.twawm.TwawmUtils.java
com.appspot.afnf4199ga.twawm.app.BackgroundServiceTest.java
com.appspot.afnf4199ga.twawm.app.BackgroundService.java
com.appspot.afnf4199ga.twawm.app.DefaultWidgetProvider.java
com.appspot.afnf4199ga.twawm.app.InfoActivity.java
com.appspot.afnf4199ga.twawm.app.InitialConfigurationWizardActivity.java
com.appspot.afnf4199ga.twawm.app.LogSendActivity.java
com.appspot.afnf4199ga.twawm.app.MainActivity.java
com.appspot.afnf4199ga.twawm.app.MainApp.java
com.appspot.afnf4199ga.twawm.app.MyPreferenceActivity.java
com.appspot.afnf4199ga.twawm.app.NetworkSwitcher.java
com.appspot.afnf4199ga.twawm.app.StaticIntentListener.java
com.appspot.afnf4199ga.twawm.app.UIAct.java
com.appspot.afnf4199ga.twawm.ctl.CustomizeActionsActivityTest.java
com.appspot.afnf4199ga.twawm.ctl.CustomizeActionsActivity.java
com.appspot.afnf4199ga.twawm.ctl.CwacTouchListView.java
com.appspot.afnf4199ga.twawm.ctl.ListItem.java
com.appspot.afnf4199ga.twawm.router.EcoModeControlTest.java
com.appspot.afnf4199ga.twawm.router.EcoModeControl.java
com.appspot.afnf4199ga.twawm.router.InetLookupWrappter.java
com.appspot.afnf4199ga.twawm.router.InetLookupWrappter.java
com.appspot.afnf4199ga.twawm.router.MyHttpClientTest.java
com.appspot.afnf4199ga.twawm.router.MyHttpClient.java
com.appspot.afnf4199ga.twawm.router.MyHttpClient.java
com.appspot.afnf4199ga.twawm.router.RouterControlByHttpTest.java
com.appspot.afnf4199ga.twawm.router.RouterControlByHttp.java
com.appspot.afnf4199ga.twawm.router.RouterControlByHttp.java
com.appspot.afnf4199ga.twawm.router.RouterControl.java
com.appspot.afnf4199ga.twawm.router.RouterControl.java
com.appspot.afnf4199ga.twawm.router.RouterInfo.java
com.appspot.afnf4199ga.twawm.router.RouterInfo.java
com.appspot.afnf4199ga.utils.AndroidUtilsTest.java
com.appspot.afnf4199ga.utils.AndroidUtils.java
com.appspot.afnf4199ga.utils.AndroidUtils.java
com.appspot.afnf4199ga.utils.Logger.java
com.appspot.afnf4199ga.utils.Logger.java
com.appspot.afnf4199ga.utils.MyStringUtlisTest.java
com.appspot.afnf4199ga.utils.MyStringUtlis.java
com.appspot.afnf4199ga.utils.MyStringUtlis.java
com.appspot.afnf4199ga.utils.MyTestUtils.java
com.appspot.afnf4199ga.utils.MyUncaughtExceptionHandler.java
com.appspot.afnf4199ga.utils.MyUncaughtExceptionHandler.java
com.appspot.afnf4199ga.wmgraph.app.FetchThread.java
com.appspot.afnf4199ga.wmgraph.app.InetLookupThread.java
com.appspot.afnf4199ga.wmgraph.app.InfoActivity.java
com.appspot.afnf4199ga.wmgraph.app.MainActivity.java
com.appspot.afnf4199ga.wmgraph.app.MyPreferenceActivity.java
com.appspot.afnf4199ga.wmgraph.app.UIAct.java
net.afnf.and.twawm2.DexmakerInstrumentationTestCase.java
net.afnf.and.twawm2.MyInstrumentationTestRunner.java