Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New 20130329 #52

Merged
merged 2 commits into from
Mar 29, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions zstl/test/org/zkoss/zktest/test2/B65/B65_ZK_1278Test.scala
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,100 @@
package org.zkoss.zktest.test2.B65

import org.zkoss.ztl.Tags
import org.zkoss.zstl.ZTL4ScalaTestCase

@Tags(tags = "B65-ZK-1278.zul")
class B65_ZK_1278Test extends ZTL4ScalaTestCase {

def testClick() = {
val zscript = """
<zk>
<script>
zk.afterMount(function () {
setTimeout(function () {
jq('#zk_log')[0].rows = 50;
}, 1000);
});
</script>
<label multiline="true">
1. Please open the "A" and then "B"
2. If the log information are added too much that is a bug. (the log textbox should not appear the scrollbar)
</label>
<tree id="aggregationTree" zclass="z-dottree" mold="paging"
height="100%" width="100%" multiple="false" vflex="true"
hflex="true" style="border:none" renderdefer="0">
<treecols sizable="true">
<treecol label="Column Lable"/>
</treecols>
</tree>
<zscript><![CDATA[
public class SimpleTreeTestModel extends AbstractTreeModel {
private static final long serialVersionUID = 1L;

private static final String ROOT = "root";
private static final int LEVELS = 6;
public SimpleTreeTestModel() {
super(ROOT);
}

public Object getChild(Object arg0, int arg1) {
Clients.log("getChild() - Arg0: " + arg0 + ", Arg1: " +arg1);

if (arg0.equals(ROOT)) {
switch (arg1) {
case 0 : return "A";
case 1 : return "B";
case 2 : return "C";
case 3 : return "D";
case 4 : return "E";
default : return "IMPOSSIBLE";
}
}
else {
// E.g. A22222.
return arg0 + arg1;
}
}

public int getChildCount(Object arg0) {
Clients.log("getChildCount() - Arg0: " + arg0);

if (arg0.equals(ROOT)) {
return 5;
}

if (arg0.length() <= LEVELS) {
return 3;
}

// Impossible.
return 0;
}

public boolean isLeaf(Object arg0) {
//Clients.log("isLeaf() - Arg0: " + arg0);

if (arg0.equals(ROOT)) {
return false;
}

// E.g. A00000
return arg0.length() == LEVELS;
}
}
aggregationTree.setModel(new SimpleTreeTestModel());
]]></zscript>
</zk>
"""
runZTL(zscript,
() => {
click(jq(".z-treecell:contains(A) .z-dottree-root-close"))
waitResponse()
click(jq(".z-treecell:contains(B) .z-dottree-root-close"))
waitResponse()
val log = jq("#zk_log")
verifyEquals("the log textbox should not appear the scrollbar", log.scrollTop() <= log.height())
})

}
}
89 changes: 89 additions & 0 deletions zstl/test/org/zkoss/zktest/test2/B65/B65_ZK_1597Test.scala
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,89 @@
package org.zkoss.zktest.test2.B65

import org.zkoss.ztl.Tags
import org.zkoss.zstl.ZTL4ScalaTestCase

@Tags(tags = "B65-ZK-1597.zul")
class B65_ZK_1597Test extends ZTL4ScalaTestCase {

def testClick() = {
val zscript = """
<zk>
<window title="Hello World!!" border="normal" width="800px"
height="500px">
<zscript>ListModelList model = new ListModelList();
model.add("a");
model.add("b");
model.add("c");</zscript>
<tabbox hflex="1" vflex="1">
<tabs>
<tab id="tab" label="tab 1" droppable="true" draggable="true">
<attribute name="onDrop">
DropEvent evt = (DropEvent) event;
Component dragged = evt.getDragged();
Component target = evt.getTarget();
dragged.getParent().insertBefore(dragged, target);
dragged.selected= true;
</attribute>
</tab>
<tab label="Items" draggable="true" droppable="true" id="tabItems">
<attribute name="onDrop">
DropEvent evt = (DropEvent) event;
Component dragged = evt.getDragged();
Component target = evt.getTarget();
dragged.getParent().insertBefore(dragged, target);
dragged.selected= true;
</attribute>
</tab>
</tabs>
<tabpanels>
<tabpanel>
<label multiline="true">
1, Please select the tab "Items".
2, Drag the tab "Items" to prev of "tab 1" and drop it.
3, The tab "Items" should be selected and the content displays the first tabpanel.
</label>
</tabpanel>
<tabpanel>
<borderlayout height="100%" width="100%">
<north size="30px" flex="true" splittable="true" minsize="30" maxsize="30" >
<combobox />
</north>
<center autoscroll="true">
<listbox id="listbox" model="${model}" >
<listhead>
<listheader label="id" />
<listheader label="descricao" />
</listhead>
</listbox>
</center>
</borderlayout>
</tabpanel>
</tabpanels>
</tabbox>
</window>
</zk>"""
runZTL(zscript,
() => {
val position = "2,2"
val src = jq(".z-tab:contains(Items)")
val target = jq(".z-tab:contains(tab 1)")
mouseMoveAt(src, position)
waitResponse

mouseDownAt(src, position)
waitResponse

mouseMoveAt(target, position)
waitResponse

mouseUpAt(target, position)
waitResponse


verifyEquals("The tab 'Items' should be selected and the content displays the first tabpanel.", jq(".z-tab:eq(0)").text() == "Items")
verifyEquals("The tab 'Items' should be selected and the content displays the first tabpanel.", jq(".z-tabpanel:eq(0) .z-label:contains(1)").exists())
})

}
}
85 changes: 85 additions & 0 deletions zstl/test/org/zkoss/zktest/test2/B65/B65_ZK_1612Test.scala
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,85 @@
package org.zkoss.zktest.test2.B65

import org.zkoss.ztl.Tags
import org.zkoss.zstl.ZTL4ScalaTestCase

@Tags(tags = "B65-ZK-1612.zul")
class B65_ZK_1612Test extends ZTL4ScalaTestCase {

def testClick() = {
val zscript = """
<zk>

<zscript><![CDATA[
void changeTitle(org.zkoss.zul.Panel thePanel)
{
thePanel.setTitle("Dropped!");
}

]]>
</zscript>
<label multiline="true">
1. Please click the "Button Image"
2. You should see a dialog and close it.
3. Please drag the "Button Image" into the window of the right side panel.
4. You should see the title of the right side panel is changed.
</label>
<window width="800px" height="800px" border="normal" title="test">
<grid>
<rows>
<row>
<panel id="panel1" title="PANEL1" droppable="ABC" onDrop="changeTitle(panel1);">
<panelchildren>
<window width="200px" height="200px" border="normal" draggable="ABC">
<toolbarbutton image="/img/button.png" onClick="alert(1)">

</toolbarbutton>
</window>
</panelchildren>
</panel>

<panel id="panel2" title="PANEL2" droppable="ABC" onDrop="changeTitle(panel2);">
<panelchildren>
<window width="200px" height="200px" border="normal" draggable="ABC" />
</panelchildren>
</panel>
</row>
</rows>
</grid>
</window>

</zk>
"""
runZTL(zscript,
() => {
val img = jq("img[src*=button]")

click(img)
waitResponse()
verifyTrue("You should see a dialog", jq(".z-messagebox-window").exists())

click(jq(".z-button"))
waitResponse()

val header = jq(".z-panel-header:eq(1)")
val headerText = header.text()

val position = "2,2"
val target = jq(".z-panel-body:eq(1)")
mouseMoveAt(img, position)
waitResponse

mouseDownAt(img, position)
waitResponse

mouseMoveAt(target, position)
waitResponse

mouseUpAt(target, position)
waitResponse

verifyTrue("You should see the title of the right side panel is changed.", header.text() != headerText)
})

}
}
75 changes: 75 additions & 0 deletions zstl/test/org/zkoss/zktest/test2/B65/B65_ZK_1617Test.scala
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,75 @@
package org.zkoss.zktest.test2.B65

import org.zkoss.ztl.Tags
import org.zkoss.zstl.ZTL4ScalaTestCase

@Tags(tags = "B65-ZK-1617.zul")
class B65_ZK_1617Test extends ZTL4ScalaTestCase {

def testClick() = {
val zscript = """<?xml version="1.0" encoding="UTF-8"?>

<!--
B65-ZK-1617.zul

Purpose:

Description:

History:
Fri, Feb 08, 2013 10:02:33 AM, Created by jumperchen

Copyright (C) 2013 Potix Corporation. All Rights Reserved.

-->
<div>
<label multiline="true">
1. Please click the 'Rename' button.
2. Try to drag the title of the panel, and it should be able to drag and drop.
</label>
<button id="btn" label="Rename" onClick="onClick()"/>
<portallayout>
<portalchildren>
<panel id="panel" title="Change Me" border="normal">
<panelchildren>
<div style="display:block;" width="400px" height="300px"/>
</panelchildren>
</panel>
</portalchildren>
</portallayout>
<zscript>
public void onClick() {
panel.setTitle("Change Title");
}
</zscript>
</div>"""
runZTL(zscript,
() => {
val btn = jq(".z-button:contains(Rename)")
click(btn)
waitResponse()

val position = "2,2"
val src = jq(".z-panel-header")

val top = src.offsetTop()

mouseMoveAt(src, position)
waitResponse

mouseDownAt(src, position)
waitResponse

mouseMoveAt(btn, position)
waitResponse

verifyTrue("it should be able to drag and drop.", top != src.offsetTop())

mouseUpAt(btn, position)
waitResponse


})

}
}
Loading