Search in sources :

Example 6 with TestDomObject

use of com.taobao.weex.dom.TestDomObject in project incubator-weex by apache.

the class ComponentTest method create.

public static void create(WXComponent comp, View view) {
    TestDomObject domObject = new TestDomObject();
    WXVContainer parent;
    if ((parent = comp.getParent()) != null) {
        if (view != null) {
            comp.mHost = view;
        } else {
            comp.createView();
        }
    } else {
        parent = WXDivTest.create();
        parent.addChild(comp);
        parent.createChildViewAt(-1);
    }
    comp.setLayout(domObject);
    domObject = new TestDomObject();
    comp.updateDom(domObject);
    comp.applyLayoutAndEvent(comp);
    addEvent(comp);
}
Also used : TestDomObject(com.taobao.weex.dom.TestDomObject)

Example 7 with TestDomObject

use of com.taobao.weex.dom.TestDomObject in project incubator-weex by apache.

the class WXImageTest method setUp.

@Before
public void setUp() throws Exception {
    mInstance = WXSDKInstanceTest.createInstance();
    mDomObject = new TestDomObject();
    PowerMockito.when(Mockito.spy(mDomObject).clone()).thenReturn(mDomObject);
    mWXDiv = PowerMockito.mock(WXDiv.class);
    mWXImage = new WXImage(mInstance, mDomObject, mWXDiv);
}
Also used : TestDomObject(com.taobao.weex.dom.TestDomObject) Before(org.junit.Before)

Example 8 with TestDomObject

use of com.taobao.weex.dom.TestDomObject in project weex-example by KalicyZhou.

the class WXImageTest method setUp.

@Before
public void setUp() throws Exception {
    mInstance = WXSDKInstanceTest.createInstance();
    mDomObject = new TestDomObject();
    PowerMockito.when(Mockito.spy(mDomObject).clone()).thenReturn(mDomObject);
    mWXDiv = PowerMockito.mock(WXDiv.class);
    mWXImage = new WXImage(mInstance, mDomObject, mWXDiv);
}
Also used : TestDomObject(com.taobao.weex.dom.TestDomObject) Before(org.junit.Before)

Example 9 with TestDomObject

use of com.taobao.weex.dom.TestDomObject in project weex-example by KalicyZhou.

the class WXSliderTest method testPages.

@Test
public void testPages() throws Exception {
    component = create();
    component.addChild(ComponentTest.createComponent(new TestDomObject(), component, TestComponent.class));
    component.addChild(ComponentTest.createComponent(new TestDomObject(), component, TestComponent.class));
    component.addChild(ComponentTest.createComponent(new TestDomObject(), component, TestComponent.class));
    component.addChild(ComponentTest.createComponent(new TestDomObject(), component, TestComponent.class));
    component.addChild(ComponentTest.createComponent(new TestDomObject(), component, TestComponent.class));
    WXIndicator indicator = new WXIndicator(component.getInstance(), new TestDomObject(), component, false);
    ComponentTest.create(indicator);
    component.addChild(indicator);
    ComponentTest.create(component);
    assertEquals(5, component.mViewPager.getCirclePageAdapter().getRealCount());
    assertEquals(6, component.getChildCount());
    component.mViewPager.setCurrentItem(0);
}
Also used : TestDomObject(com.taobao.weex.dom.TestDomObject) Test(org.junit.Test) WXSDKInstanceTest(com.taobao.weex.WXSDKInstanceTest)

Example 10 with TestDomObject

use of com.taobao.weex.dom.TestDomObject in project incubator-weex by apache.

the class DefaultDragHelperTest method setUp.

@Before
public void setUp() throws Exception {
    WXDiv div = WXDivTest.create();
    ComponentTest.create(div);
    listComponent = create(div);
    ComponentTest.create(listComponent);
    fakeCell = new WXCell(WXSDKInstanceTest.createInstance(), new TestDomObject(), null, false);
    c1 = new WXCell(WXSDKInstanceTest.createInstance(), new TestDomObject(), null, false);
    c2 = new WXCell(WXSDKInstanceTest.createInstance(), new TestDomObject(), null, false);
    c3 = new WXCell(WXSDKInstanceTest.createInstance(), new TestDomObject(), null, false);
    mFakeDataSource = new ArrayList<>();
    mFakeDataSource.add(c1);
    mFakeDataSource.add(c2);
    mFakeDataSource.add(c3);
    mockedEventTrigger = mock(EventTrigger.class);
    mFakeDragHelper = new DefaultDragHelper(mFakeDataSource, listComponent.getHostView().getInnerView(), mockedEventTrigger);
}
Also used : WXDiv(com.taobao.weex.ui.component.WXDiv) TestDomObject(com.taobao.weex.dom.TestDomObject) Before(org.junit.Before)

Aggregations

TestDomObject (com.taobao.weex.dom.TestDomObject)14 WXSDKInstanceTest (com.taobao.weex.WXSDKInstanceTest)9 Test (org.junit.Test)9 Before (org.junit.Before)3 ComponentTest (com.taobao.weex.ui.component.ComponentTest)2 WXComponent (com.taobao.weex.ui.component.WXComponent)2 WXDivTest (com.taobao.weex.ui.component.WXDivTest)2 TestComponent (com.taobao.weex.ui.component.TestComponent)1 WXDiv (com.taobao.weex.ui.component.WXDiv)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1