Android Open Source - twawm2 Icon Selector 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;
/*from  w  w  w . jav  a  2  s .co  m*/
import junit.framework.TestCase;
import net.afnf.and.twawm2.R;

import com.appspot.afnf4199ga.twawm.StateMachine.NETWORK_STATE;
import com.appspot.afnf4199ga.twawm.router.RouterInfo.COM_TYPE;

public class IconSelectorTest extends TestCase {

    public void testSelectNotifyIcon_hs() {
        COM_TYPE ot = COM_TYPE.HIGH_SPEED;

        {
            NETWORK_STATE ns = NETWORK_STATE.ONLINE;
            assertEquals(R.drawable.ntficon_hs_wimax_green_1_batt_000, IconSelector.selectNotifyIcon(1, 0, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_green_1_batt_010, IconSelector.selectNotifyIcon(1, 10, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_green_1_batt_020, IconSelector.selectNotifyIcon(1, 20, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_green_2_batt_040, IconSelector.selectNotifyIcon(2, 40, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_green_4_batt_060, IconSelector.selectNotifyIcon(3, 60, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_green_6_batt_070, IconSelector.selectNotifyIcon(4, 71, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_green_6_batt_080, IconSelector.selectNotifyIcon(4, 89, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_green_6_batt_100, IconSelector.selectNotifyIcon(6, 100, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_green_6_batt_na, IconSelector.selectNotifyIcon(6, -1, ns, ot));
        }

        {
            NETWORK_STATE ns = NETWORK_STATE.OFFLINE;
            assertEquals(R.drawable.ntficon_hs_wimax_white_batt_000, IconSelector.selectNotifyIcon(1, 0, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_white_batt_010, IconSelector.selectNotifyIcon(1, 10, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_white_batt_020, IconSelector.selectNotifyIcon(1, 20, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_white_batt_040, IconSelector.selectNotifyIcon(2, 40, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_white_batt_060, IconSelector.selectNotifyIcon(3, 60, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_white_batt_070, IconSelector.selectNotifyIcon(4, 71, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_white_batt_080, IconSelector.selectNotifyIcon(4, 89, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_white_batt_100, IconSelector.selectNotifyIcon(6, 100, ns, ot));
            assertEquals(R.drawable.ntficon_hs_wimax_white_batt_na, IconSelector.selectNotifyIcon(6, -1, ns, ot));
        }

        for (int i = 0; i < 2; i++) {
            NETWORK_STATE ns = i == 0 ? NETWORK_STATE.AP_NOT_FOUND : NETWORK_STATE.NOT_WM_ROUTER;
            assertEquals(R.drawable.ntficon_wimax_gray_batt_000, IconSelector.selectNotifyIcon(1, 0, ns, ot)); // WiMAX?????????
            assertEquals(R.drawable.ntficon_wimax_gray_batt_010, IconSelector.selectNotifyIcon(1, 10, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_020, IconSelector.selectNotifyIcon(1, 20, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_040, IconSelector.selectNotifyIcon(2, 40, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_060, IconSelector.selectNotifyIcon(3, 60, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_070, IconSelector.selectNotifyIcon(4, 71, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_080, IconSelector.selectNotifyIcon(5, 89, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_100, IconSelector.selectNotifyIcon(6, 100, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_na, IconSelector.selectNotifyIcon(6, -1, ns, ot));
        }
    }

    public void testSelectNotifyIcon_nl() {
        COM_TYPE ot = COM_TYPE.NO_LIMIT;

        {
            NETWORK_STATE ns = NETWORK_STATE.ONLINE;
            assertEquals(R.drawable.ntficon_wimax_green_1_batt_000, IconSelector.selectNotifyIcon(1, 0, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_1_batt_010, IconSelector.selectNotifyIcon(1, 10, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_1_batt_020, IconSelector.selectNotifyIcon(1, 20, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_2_batt_040, IconSelector.selectNotifyIcon(2, 40, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_4_batt_060, IconSelector.selectNotifyIcon(3, 60, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_5_batt_070, IconSelector.selectNotifyIcon(4, 71, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_6_batt_080, IconSelector.selectNotifyIcon(5, 89, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_6_batt_100, IconSelector.selectNotifyIcon(6, 100, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_6_batt_na, IconSelector.selectNotifyIcon(6, -1, ns, ot));
        }

        {
            NETWORK_STATE ns = NETWORK_STATE.OFFLINE;
            assertEquals(R.drawable.ntficon_wimax_white_batt_000, IconSelector.selectNotifyIcon(1, 0, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_010, IconSelector.selectNotifyIcon(1, 10, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_020, IconSelector.selectNotifyIcon(1, 20, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_040, IconSelector.selectNotifyIcon(2, 40, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_060, IconSelector.selectNotifyIcon(3, 60, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_070, IconSelector.selectNotifyIcon(4, 71, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_080, IconSelector.selectNotifyIcon(5, 89, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_100, IconSelector.selectNotifyIcon(6, 100, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_na, IconSelector.selectNotifyIcon(6, -1, ns, ot));
        }

        for (int i = 0; i < 2; i++) {
            NETWORK_STATE ns = i == 0 ? NETWORK_STATE.AP_NOT_FOUND : NETWORK_STATE.NOT_WM_ROUTER;
            assertEquals(R.drawable.ntficon_wimax_gray_batt_000, IconSelector.selectNotifyIcon(1, 0, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_010, IconSelector.selectNotifyIcon(1, 10, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_020, IconSelector.selectNotifyIcon(1, 20, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_040, IconSelector.selectNotifyIcon(2, 40, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_060, IconSelector.selectNotifyIcon(3, 60, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_070, IconSelector.selectNotifyIcon(4, 71, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_080, IconSelector.selectNotifyIcon(5, 89, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_100, IconSelector.selectNotifyIcon(6, 100, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_na, IconSelector.selectNotifyIcon(6, -1, ns, ot));
        }
    }

    public void testSelectNotifyIcon_na() {
        COM_TYPE ot = COM_TYPE.NA;

        {
            NETWORK_STATE ns = NETWORK_STATE.ONLINE;
            assertEquals(R.drawable.ntficon_wimax_green_1_batt_000, IconSelector.selectNotifyIcon(1, 0, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_1_batt_010, IconSelector.selectNotifyIcon(1, 10, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_1_batt_020, IconSelector.selectNotifyIcon(1, 20, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_2_batt_040, IconSelector.selectNotifyIcon(2, 40, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_3_batt_060, IconSelector.selectNotifyIcon(3, 60, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_4_batt_070, IconSelector.selectNotifyIcon(4, 71, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_5_batt_080, IconSelector.selectNotifyIcon(5, 89, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_6_batt_100, IconSelector.selectNotifyIcon(6, 100, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_green_6_batt_na, IconSelector.selectNotifyIcon(6, -1, ns, ot));
        }

        {
            NETWORK_STATE ns = NETWORK_STATE.OFFLINE;
            assertEquals(R.drawable.ntficon_wimax_white_batt_000, IconSelector.selectNotifyIcon(1, 0, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_010, IconSelector.selectNotifyIcon(1, 10, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_020, IconSelector.selectNotifyIcon(1, 20, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_040, IconSelector.selectNotifyIcon(2, 40, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_060, IconSelector.selectNotifyIcon(3, 60, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_070, IconSelector.selectNotifyIcon(4, 71, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_080, IconSelector.selectNotifyIcon(5, 89, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_100, IconSelector.selectNotifyIcon(6, 100, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_white_batt_na, IconSelector.selectNotifyIcon(6, -1, ns, ot));
        }

        for (int i = 0; i < 2; i++) {
            NETWORK_STATE ns = i == 0 ? NETWORK_STATE.AP_NOT_FOUND : NETWORK_STATE.NOT_WM_ROUTER;
            assertEquals(R.drawable.ntficon_wimax_gray_batt_000, IconSelector.selectNotifyIcon(1, 0, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_010, IconSelector.selectNotifyIcon(1, 10, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_020, IconSelector.selectNotifyIcon(1, 20, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_040, IconSelector.selectNotifyIcon(2, 40, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_060, IconSelector.selectNotifyIcon(3, 60, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_070, IconSelector.selectNotifyIcon(4, 71, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_080, IconSelector.selectNotifyIcon(5, 89, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_100, IconSelector.selectNotifyIcon(6, 100, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_na, IconSelector.selectNotifyIcon(6, -1, ns, ot));
        }
    }

    public void testSelectNotifyIcon_spot() {
        COM_TYPE ot = COM_TYPE.WIFI_SPOT;

        {
            NETWORK_STATE ns = NETWORK_STATE.ONLINE;
            assertEquals(R.drawable.ntficon_wifi_green_1_batt_000, IconSelector.selectNotifyIcon(1, 0, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_green_1_batt_010, IconSelector.selectNotifyIcon(1, 10, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_green_1_batt_020, IconSelector.selectNotifyIcon(1, 20, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_green_2_batt_040, IconSelector.selectNotifyIcon(2, 40, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_green_3_batt_060, IconSelector.selectNotifyIcon(3, 60, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_green_4_batt_070, IconSelector.selectNotifyIcon(4, 71, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_green_5_batt_080, IconSelector.selectNotifyIcon(5, 89, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_green_6_batt_100, IconSelector.selectNotifyIcon(6, 100, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_green_6_batt_na, IconSelector.selectNotifyIcon(6, -1, ns, ot));
        }

        {
            NETWORK_STATE ns = NETWORK_STATE.OFFLINE;
            assertEquals(R.drawable.ntficon_wifi_white_batt_000, IconSelector.selectNotifyIcon(1, 0, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_white_batt_010, IconSelector.selectNotifyIcon(1, 10, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_white_batt_020, IconSelector.selectNotifyIcon(1, 20, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_white_batt_040, IconSelector.selectNotifyIcon(2, 40, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_white_batt_060, IconSelector.selectNotifyIcon(3, 60, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_white_batt_070, IconSelector.selectNotifyIcon(4, 71, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_white_batt_080, IconSelector.selectNotifyIcon(5, 89, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_white_batt_100, IconSelector.selectNotifyIcon(6, 100, ns, ot));
            assertEquals(R.drawable.ntficon_wifi_white_batt_na, IconSelector.selectNotifyIcon(6, -1, ns, ot));
        }

        for (int i = 0; i < 2; i++) {
            NETWORK_STATE ns = i == 0 ? NETWORK_STATE.AP_NOT_FOUND : NETWORK_STATE.NOT_WM_ROUTER;
            assertEquals(R.drawable.ntficon_wimax_gray_batt_000, IconSelector.selectNotifyIcon(1, 0, ns, ot)); // WiMAX?????????
            assertEquals(R.drawable.ntficon_wimax_gray_batt_010, IconSelector.selectNotifyIcon(1, 10, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_020, IconSelector.selectNotifyIcon(1, 20, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_040, IconSelector.selectNotifyIcon(2, 40, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_060, IconSelector.selectNotifyIcon(3, 60, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_070, IconSelector.selectNotifyIcon(4, 71, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_080, IconSelector.selectNotifyIcon(5, 89, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_100, IconSelector.selectNotifyIcon(6, 100, ns, ot));
            assertEquals(R.drawable.ntficon_wimax_gray_batt_na, IconSelector.selectNotifyIcon(6, -1, ns, ot));
        }
    }

    public void testSelectWdIcon_hs() {
        COM_TYPE ot = COM_TYPE.HIGH_SPEED;

        {
            NETWORK_STATE ns = NETWORK_STATE.ONLINE;
            assertEquals(R.drawable.icon_hs_wimax_green_1_batt_000, IconSelector.selectWdIcon(1, 0, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_green_1_batt_010, IconSelector.selectWdIcon(1, 10, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_green_1_batt_020, IconSelector.selectWdIcon(1, 20, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_green_2_batt_040, IconSelector.selectWdIcon(2, 40, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_green_4_batt_060, IconSelector.selectWdIcon(3, 60, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_green_6_batt_070, IconSelector.selectWdIcon(4, 71, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_green_6_batt_080, IconSelector.selectWdIcon(4, 89, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_green_6_batt_100, IconSelector.selectWdIcon(6, 100, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_green_6_batt_na, IconSelector.selectWdIcon(6, -1, ns, ot));
        }

        {
            NETWORK_STATE ns = NETWORK_STATE.OFFLINE;
            assertEquals(R.drawable.icon_hs_wimax_white_batt_000, IconSelector.selectWdIcon(1, 0, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_white_batt_010, IconSelector.selectWdIcon(1, 10, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_white_batt_020, IconSelector.selectWdIcon(1, 20, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_white_batt_040, IconSelector.selectWdIcon(2, 40, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_white_batt_060, IconSelector.selectWdIcon(3, 60, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_white_batt_070, IconSelector.selectWdIcon(4, 71, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_white_batt_080, IconSelector.selectWdIcon(4, 89, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_white_batt_100, IconSelector.selectWdIcon(6, 100, ns, ot));
            assertEquals(R.drawable.icon_hs_wimax_white_batt_na, IconSelector.selectWdIcon(6, -1, ns, ot));
        }

        for (int i = 0; i < 2; i++) {
            NETWORK_STATE ns = i == 0 ? NETWORK_STATE.AP_NOT_FOUND : NETWORK_STATE.NOT_WM_ROUTER;
            assertEquals(R.drawable.icon_wimax_gray_batt_000, IconSelector.selectWdIcon(1, 0, ns, ot)); // WiMAX?????????
            assertEquals(R.drawable.icon_wimax_gray_batt_010, IconSelector.selectWdIcon(1, 10, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_020, IconSelector.selectWdIcon(1, 20, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_040, IconSelector.selectWdIcon(2, 40, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_060, IconSelector.selectWdIcon(3, 60, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_070, IconSelector.selectWdIcon(4, 71, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_080, IconSelector.selectWdIcon(5, 89, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_100, IconSelector.selectWdIcon(6, 100, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_na, IconSelector.selectWdIcon(6, -1, ns, ot));
        }
    }

    public void testSelectWdIcon_nl() {
        COM_TYPE ot = COM_TYPE.NO_LIMIT;

        {
            NETWORK_STATE ns = NETWORK_STATE.ONLINE;
            assertEquals(R.drawable.icon_wimax_green_1_batt_000, IconSelector.selectWdIcon(1, 0, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_1_batt_010, IconSelector.selectWdIcon(1, 10, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_1_batt_020, IconSelector.selectWdIcon(1, 20, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_2_batt_040, IconSelector.selectWdIcon(2, 40, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_4_batt_060, IconSelector.selectWdIcon(3, 60, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_5_batt_070, IconSelector.selectWdIcon(4, 71, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_6_batt_080, IconSelector.selectWdIcon(5, 89, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_6_batt_100, IconSelector.selectWdIcon(6, 100, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_6_batt_na, IconSelector.selectWdIcon(6, -1, ns, ot));
        }

        {
            NETWORK_STATE ns = NETWORK_STATE.OFFLINE;
            assertEquals(R.drawable.icon_wimax_white_batt_000, IconSelector.selectWdIcon(1, 0, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_010, IconSelector.selectWdIcon(1, 10, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_020, IconSelector.selectWdIcon(1, 20, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_040, IconSelector.selectWdIcon(2, 40, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_060, IconSelector.selectWdIcon(3, 60, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_070, IconSelector.selectWdIcon(4, 71, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_080, IconSelector.selectWdIcon(5, 89, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_100, IconSelector.selectWdIcon(6, 100, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_na, IconSelector.selectWdIcon(6, -1, ns, ot));
        }

        for (int i = 0; i < 2; i++) {
            NETWORK_STATE ns = i == 0 ? NETWORK_STATE.AP_NOT_FOUND : NETWORK_STATE.NOT_WM_ROUTER;
            assertEquals(R.drawable.icon_wimax_gray_batt_000, IconSelector.selectWdIcon(1, 0, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_010, IconSelector.selectWdIcon(1, 10, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_020, IconSelector.selectWdIcon(1, 20, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_040, IconSelector.selectWdIcon(2, 40, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_060, IconSelector.selectWdIcon(3, 60, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_070, IconSelector.selectWdIcon(4, 71, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_080, IconSelector.selectWdIcon(5, 89, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_100, IconSelector.selectWdIcon(6, 100, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_na, IconSelector.selectWdIcon(6, -1, ns, ot));
        }
    }

    public void testSelectWdIcon_na() {
        COM_TYPE ot = COM_TYPE.NA;

        {
            NETWORK_STATE ns = NETWORK_STATE.ONLINE;
            assertEquals(R.drawable.icon_wimax_green_1_batt_000, IconSelector.selectWdIcon(1, 0, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_1_batt_010, IconSelector.selectWdIcon(1, 10, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_1_batt_020, IconSelector.selectWdIcon(1, 20, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_2_batt_040, IconSelector.selectWdIcon(2, 40, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_3_batt_060, IconSelector.selectWdIcon(3, 60, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_4_batt_070, IconSelector.selectWdIcon(4, 71, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_5_batt_080, IconSelector.selectWdIcon(5, 89, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_6_batt_100, IconSelector.selectWdIcon(6, 100, ns, ot));
            assertEquals(R.drawable.icon_wimax_green_6_batt_na, IconSelector.selectWdIcon(6, -1, ns, ot));
        }

        {
            NETWORK_STATE ns = NETWORK_STATE.OFFLINE;
            assertEquals(R.drawable.icon_wimax_white_batt_000, IconSelector.selectWdIcon(1, 0, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_010, IconSelector.selectWdIcon(1, 10, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_020, IconSelector.selectWdIcon(1, 20, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_040, IconSelector.selectWdIcon(2, 40, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_060, IconSelector.selectWdIcon(3, 60, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_070, IconSelector.selectWdIcon(4, 71, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_080, IconSelector.selectWdIcon(5, 89, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_100, IconSelector.selectWdIcon(6, 100, ns, ot));
            assertEquals(R.drawable.icon_wimax_white_batt_na, IconSelector.selectWdIcon(6, -1, ns, ot));
        }

        for (int i = 0; i < 2; i++) {
            NETWORK_STATE ns = i == 0 ? NETWORK_STATE.AP_NOT_FOUND : NETWORK_STATE.NOT_WM_ROUTER;
            assertEquals(R.drawable.icon_wimax_gray_batt_000, IconSelector.selectWdIcon(1, 0, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_010, IconSelector.selectWdIcon(1, 10, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_020, IconSelector.selectWdIcon(1, 20, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_040, IconSelector.selectWdIcon(2, 40, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_060, IconSelector.selectWdIcon(3, 60, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_070, IconSelector.selectWdIcon(4, 71, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_080, IconSelector.selectWdIcon(5, 89, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_100, IconSelector.selectWdIcon(6, 100, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_na, IconSelector.selectWdIcon(6, -1, ns, ot));
        }
    }

    public void testSelectWdIcon_spot() {
        COM_TYPE ot = COM_TYPE.WIFI_SPOT;

        {
            NETWORK_STATE ns = NETWORK_STATE.ONLINE;
            assertEquals(R.drawable.icon_wifi_green_1_batt_000, IconSelector.selectWdIcon(1, 0, ns, ot));
            assertEquals(R.drawable.icon_wifi_green_1_batt_010, IconSelector.selectWdIcon(1, 10, ns, ot));
            assertEquals(R.drawable.icon_wifi_green_1_batt_020, IconSelector.selectWdIcon(1, 20, ns, ot));
            assertEquals(R.drawable.icon_wifi_green_2_batt_040, IconSelector.selectWdIcon(2, 40, ns, ot));
            assertEquals(R.drawable.icon_wifi_green_3_batt_060, IconSelector.selectWdIcon(3, 60, ns, ot));
            assertEquals(R.drawable.icon_wifi_green_4_batt_070, IconSelector.selectWdIcon(4, 71, ns, ot));
            assertEquals(R.drawable.icon_wifi_green_5_batt_080, IconSelector.selectWdIcon(5, 89, ns, ot));
            assertEquals(R.drawable.icon_wifi_green_6_batt_100, IconSelector.selectWdIcon(6, 100, ns, ot));
            assertEquals(R.drawable.icon_wifi_green_6_batt_na, IconSelector.selectWdIcon(6, -1, ns, ot));
        }

        {
            NETWORK_STATE ns = NETWORK_STATE.OFFLINE;
            assertEquals(R.drawable.icon_wifi_white_batt_000, IconSelector.selectWdIcon(1, 0, ns, ot));
            assertEquals(R.drawable.icon_wifi_white_batt_010, IconSelector.selectWdIcon(1, 10, ns, ot));
            assertEquals(R.drawable.icon_wifi_white_batt_020, IconSelector.selectWdIcon(1, 20, ns, ot));
            assertEquals(R.drawable.icon_wifi_white_batt_040, IconSelector.selectWdIcon(2, 40, ns, ot));
            assertEquals(R.drawable.icon_wifi_white_batt_060, IconSelector.selectWdIcon(3, 60, ns, ot));
            assertEquals(R.drawable.icon_wifi_white_batt_070, IconSelector.selectWdIcon(4, 71, ns, ot));
            assertEquals(R.drawable.icon_wifi_white_batt_080, IconSelector.selectWdIcon(5, 89, ns, ot));
            assertEquals(R.drawable.icon_wifi_white_batt_100, IconSelector.selectWdIcon(6, 100, ns, ot));
            assertEquals(R.drawable.icon_wifi_white_batt_na, IconSelector.selectWdIcon(6, -1, ns, ot));
        }

        for (int i = 0; i < 2; i++) {
            NETWORK_STATE ns = i == 0 ? NETWORK_STATE.AP_NOT_FOUND : NETWORK_STATE.NOT_WM_ROUTER;
            assertEquals(R.drawable.icon_wimax_gray_batt_000, IconSelector.selectWdIcon(1, 0, ns, ot)); // WiMAX?????????
            assertEquals(R.drawable.icon_wimax_gray_batt_010, IconSelector.selectWdIcon(1, 10, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_020, IconSelector.selectWdIcon(1, 20, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_040, IconSelector.selectWdIcon(2, 40, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_060, IconSelector.selectWdIcon(3, 60, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_070, IconSelector.selectWdIcon(4, 71, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_080, IconSelector.selectWdIcon(5, 89, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_100, IconSelector.selectWdIcon(6, 100, ns, ot));
            assertEquals(R.drawable.icon_wimax_gray_batt_na, IconSelector.selectWdIcon(6, -1, ns, ot));
        }
    }
}




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