1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Html: Move get_elem_val to xo.elem

This commit is contained in:
gnosygnu
2017-02-22 09:41:37 -05:00
parent 5bd3371802
commit 12848b7cf5
896 changed files with 69011 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.draws.*; import gplx.gfui.imgs.*;
public class GfuiBorderMgr_tst {
@Before public void setup() {
borderMgr = GfuiBorderMgr.new_();
}
@Test public void NullToEdge() { // all null -> one edge
tst_Eq(borderMgr, null, null, null, null, null);
borderMgr.Top_(red);
tst_Eq(borderMgr, null, red, null, null, null);
}
@Test public void EdgeToAll() { // one edge -> all edge
borderMgr.Top_(red);
tst_Eq(borderMgr, null, red, null, null, null);
borderMgr.All_(black);
tst_Eq(borderMgr, black, null, null, null, null);
}
@Test public void AllToEdge() { // all edge -> one new; three old
borderMgr.All_(red);
tst_Eq(borderMgr, red, null, null, null, null);
borderMgr.Top_(black);
tst_Eq(borderMgr, null, black, red, red, red);
}
void tst_Eq(GfuiBorderMgr borderMgr, PenAdp all, PenAdp top, PenAdp left, PenAdp right, PenAdp bottom) {
Tfds.Eq(borderMgr.All(), all);
Tfds.Eq(borderMgr.Top(), top);
Tfds.Eq(borderMgr.Left(), left);
Tfds.Eq(borderMgr.Right(), right);
Tfds.Eq(borderMgr.Bot(), bottom);
}
GfuiBorderMgr borderMgr;
PenAdp black = PenAdp_.black_(), red = PenAdp_.new_(ColorAdp_.Red, 1);
}

View File

@@ -0,0 +1,33 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import org.junit.*; import gplx.gfui.ipts.*; import gplx.gfui.controls.windows.*; import gplx.gfui.controls.standards.*; import gplx.gfui.controls.customs.*;
public class GfuiMoveElemBtn_tst {
@Before public void setup() {
form = GfuiWin_.app_("form"); form.Size_(100, 100);
moveBtn = GfuiBtn_.new_("moveBtn");
GfuiMoveElemBnd bnd = GfuiMoveElemBnd.new_(); bnd.TargetElem_set(form);
moveBtn.IptBnds().Add(bnd);
}
@Test public void Basic() {
Tfds.Eq(form.X(), 0);
IptEventMgr.ExecKeyDown(moveBtn, IptEvtDataKey.test_(MoveRightArg()));
Tfds.Eq(form.X(), 10);
}
IptKey MoveRightArg() {return IptKey_.Ctrl.Add(IptKey_.Right);}
GfuiWin form; GfuiBtn moveBtn;
}

View File

@@ -0,0 +1,30 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import org.junit.*;
public class Gfui_tab_itm_data_tst {
@Before public void init() {} private Gfui_tab_itm_data_fxt fxt = new Gfui_tab_itm_data_fxt();
@Test public void Get_idx_after_closing() {
fxt.Test_Get_idx_after_closing(0, 1, -1);
fxt.Test_Get_idx_after_closing(4, 5, 3);
fxt.Test_Get_idx_after_closing(3, 5, 4);
}
}
class Gfui_tab_itm_data_fxt {
public void Test_Get_idx_after_closing(int cur, int len, int expd) {
Tfds.Eq(expd, Gfui_tab_itm_data.Get_idx_after_closing(cur, len));
}
}

View File

@@ -0,0 +1,129 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.tabs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import org.junit.*; import gplx.gfui.controls.tabs.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
public class TabBox_tst {
// @Before public void setup() {
// fx = TabBoxFxt.new_();
// } TabBoxFxt fx;
@Test public void Add() {
// fx.Make(1).tst_Selected("0").FetchBtnAt(0).tst_X(0);
// fx.Make(3).tst_Selected("2").FetchBtnAt(2).tst_X(160);
}
// @Test public void Del_at() {
// fx.Make(2).Del_at(1).tst_Btns("0");
// fx.Make(2).Del_at(0).tst_Btns("1");
// fx.Make(3).Del_at(0).tst_Btns("1", "2");
// fx.Make(3).Del_at(1).tst_Btns("0", "2");
// fx.Make(3).Del_at(2).tst_Btns("0", "1");
// fx.Make(3).Select(1).Del_at(1).tst_Selected("2"); // 1 deleted; 2 shifted down into slot
// fx.Make(3).Select(1).Del_at(0).tst_Selected("1"); // 0 deleted; 1 still remains active (but will have idx of 0
// fx.Make(3).Select(2).Del_at(2).tst_Selected("1"); // 2 deleted; 1 selected
// }
// @Test public void Selected_byAdd() {
// fx.Make(2).Select(0).tst_Selected("0").Select(1).tst_Selected("1");
// }
// @Test public void Selected_byBtn() {
// fx.Make(2).tst_Selected("1");
//
// GfuiBtn btn = fx.TabBox().SubBtnArea().Get_at(0);
// btn.Click();
// fx.tst_Selected("0");
// }
// @Test public void ReorderTab() {
// fx.Make(3).Reorder(0, -1).tst_Raised(false);
// fx.Make(3).Reorder(2, 1).tst_Raised(false);
// fx.Make(3).Reorder(0, 1).tst_Btns("1", "0", "2").tst_Raised(true).tst_FocusOrder();
// fx.Make(3).Reorder(0, 2).tst_Btns("1", "2", "0").tst_Raised(true).tst_FocusOrder();
// fx.Make(3).Reorder(2, -1).tst_Btns("0", "2", "1").tst_Raised(true).tst_FocusOrder();
// fx.Make(3).Reorder(0, 1).Reorder(1, 2).tst_Btns("0", "2", "1").tst_Raised(true);//.tst_FocusOrder(); // FIXME: broken after FocusOrder set for entire form (instead of per container)
// }
}
class GfuiElemFxt {
public GfuiElem UnderElem() {return underElem;} GfuiElem underElem;
@gplx.Internal protected GfuiElemFxt tst_X(int expd) {Tfds.Eq(expd, underElem.X()); return this;}
public static GfuiElemFxt new_(GfuiElem elem) {
GfuiElemFxt rv = new GfuiElemFxt();
rv.underElem = elem;
return rv;
} GfuiElemFxt() {}
}
class TabBoxFxt implements Gfo_invk {
@gplx.Internal protected TabBox TabBox() {return tabBox;}
@gplx.Internal protected TabBoxFxt Make(int count) {
for (int i = 0; i < tabBox.Tabs_Count(); i++)
tabBox.Tabs_DelAt(0);
for (int i = 0; i < count; i++)
tabBox.Tabs_Add(Int_.To_str(i), Int_.To_str(i));
return this;
}
@gplx.Internal protected TabBoxFxt Del_at(int index) {tabBox.Tabs_DelAt(index); return this;}
// @gplx.Internal protected TabBoxFxt Select(int index) {tabBox.Tabs_Select(index); return this;}
@gplx.Internal protected GfuiElemFxt FetchBtnAt(int index) {
GfuiBtn btn = (GfuiBtn)tabBox.BtnBox().SubElems().Get_at(index);
GfuiElemFxt fx_elem = GfuiElemFxt.new_(btn);
return fx_elem;
}
// @gplx.Internal protected TabBoxFxt tst_BtnX(int idx, int expdX) {
// Tfds.Eq(expdX, tabBox.SubBtnArea().Get_at(idx).X());
// return this;
// }
@gplx.Internal protected TabBoxFxt tst_Selected(String expd) {
TabPnlItm curTab = tabBox.Tabs_SelectedItm();
GfuiBtn btn = (GfuiBtn)tabBox.BtnBox().SubElems().Get_at(curTab.Idx());
Tfds.Eq(expd, btn.Text());
return this;
}
@gplx.Internal protected TabBoxFxt tst_Btns(String... expd) {
String[] actl = new String[tabBox.Tabs_Count() ];
for (int i = 0; i < tabBox.Tabs_Count() ; i++) {
GfuiBtn button = (GfuiBtn)tabBox.BtnBox().SubElems().Get_at(i);
actl[i] = button.TextMgr().Val();
}
Tfds.Eq_ary(expd, actl);
return this;
}
// @gplx.Internal protected TabBoxFxt tst_Raised(boolean expd) {Tfds.Eq(expd, received != null); return this;}
// @gplx.Internal protected TabBoxFxt Reorder(int i, int delta) {
// tabBox.Width_(240); // needed for lytMgr
// TabBnd_reorderTab reorderBnd = TabBnd_reorderTab.Instance;
// received = null;
// TabPnl pnl = tabBox.Tabs_FetchAt(i);
// reorderBnd.MoveTab(pnl.SubTabBtn(), delta);
// return this;
// }
// @gplx.Internal protected TabBoxFxt tst_FocusOrder() {
// for (int i = 0; i < tabBox.SubBtnArea().SubZones().Get_at(0).Count(); i++) {
// GfuiElem subBtn = (GfuiElem)tabBox.SubBtnArea().SubZones().Get_at(0).Get_at(i);
// Tfds.Eq(i, subBtn.UnderElem().Core().Focus_index());
// }
// return this;
// }
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, OrderChangedReceived_cmd)) OrderChangedReceived(m);
else return Gfo_invk_.Rv_unhandled;
return this;
} public static final String OrderChangedReceived_cmd = "OrderChangedReceived";
TabBox tabBox;
public static TabBoxFxt new_() {
TabBoxFxt rv = new TabBoxFxt();
rv.tabBox = TabBox_.new_();
return rv;
} TabBoxFxt() {}
void OrderChangedReceived(GfoMsg msg) {
} //int[] received = null;
}

View File

@@ -0,0 +1,85 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import org.junit.*; import gplx.gfui.controls.elems.*;
public class GfuiFocusOrderer_tst {
@Before public void setup() {
owner = GfuiElem_.new_();
list = List_adp_.New(); // list of all controls
}
@Test public void Horizontal() {
ini_Subs(owner, list, xy_(40, 0), xy_(20, 0), xy_(0, 0));
tst_FocusIndxs(owner, list, 0, 1, 2);
GfuiFocusOrderer.OrderByX(owner);
tst_FocusIndxs(owner, list, 2, 1, 0);
}
@Test public void Vertical() {
ini_Subs(owner, list, xy_(0, 40), xy_(0, 20), xy_(0, 0));
tst_FocusIndxs(owner, list, 0, 1, 2);
GfuiFocusOrderer.OrderByY(owner);
tst_FocusIndxs(owner, list, 2, 1, 0);
}
@Test public void Grid() {
ini_Subs(owner, list, xy_(20, 20), xy_(0, 20), xy_(20, 0), xy_(0, 0));
tst_FocusIndxs(owner, list, 0, 1, 2, 3);
GfuiFocusOrderer.OrderByX(owner);
tst_FocusIndxs(owner, list, 3, 2, 1, 0);
}
@Test public void Deep() {
ini_Subs(owner, list, xy_(20, 0), xy_(0, 0));
GfuiElem sub0 = sub_(owner, 0), sub1 = sub_(owner, 1);
ini_Subs(sub0, list, xy_(20, 0), xy_(0, 0));
ini_Subs(sub1, list, xy_(20, 0), xy_(0, 0));
tst_FocusIndxs(owner, list, 0, 1, 0, 1, 0, 1); // 2 owner controls (0, 1); each has two subs (0, 1)
GfuiFocusOrderer.OrderByX(owner);
tst_FocusIndxs(owner, list, 3, 0, 5, 4, 2, 1);
}
@Test public void Manusl() {
ini_Subs(owner, list, xy_(0, 0), xy_(20, 0));
tst_FocusIndxs(owner, list, 0, 1);
GfuiElem sub1 = owner.SubElems().Get_at(0);
GfuiElem sub2 = owner.SubElems().Get_at(1);
sub1.Focus_idx_(1);
sub2.Focus_idx_(0);
GfuiFocusOrderer.OrderByX(owner);
tst_FocusIndxs(owner, list, 1, 0);
}
PointAdp xy_(int x, int y) {return PointAdp_.new_(x, y);}
GfuiElem sub_(GfuiElem owner, int i) {return owner.SubElems().Get_at(i);}
void ini_Subs(GfuiElem owner, List_adp list, PointAdp... points) {
for (int i = 0; i < points.length; i++) {
GfuiElem sub = GfuiElem_.sub_(Int_.To_str(i), owner);
sub.Pos_(points[i]);
sub.UnderElem().Core().Focus_index_set(i);
list.Add(sub);
}
}
void tst_FocusIndxs(GfuiElem owner, List_adp list, int... expd) {
int[] actl = new int[list.Count()];
for (int i = 0; i < actl.length; i++) {
GfuiElem sub = (GfuiElem)list.Get_at(i);
actl[i] = sub.UnderElem().Core().Focus_index();
}
Tfds.Eq_ary(expd, actl);
}
GfuiElem owner; List_adp list;
}

View File

@@ -0,0 +1,56 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.draws; import gplx.*; import gplx.gfui.*;
import org.junit.*;
public class ColorAdp__tst {
@Test public void parse_hex_() {
tst_parse_hex_("#00000000", 0, 0, 0, 0);
tst_parse_hex_("#000102FF", 0, 1, 2, 255);
tst_parse_hex_("#FF000102", 255, 0, 1, 2);
}
@Test public void parse_int_() {
tst_parse_int_(0, 0, 0, 0, 0);
tst_parse_int_(255, 0, 0, 0, 255);
tst_parse_int_(65535, 0, 0, 255, 255);
tst_parse_int_(16777215, 0, 255, 255, 255);
tst_parse_int_(Int_.Max_value, 127, 255, 255, 255);
tst_parse_int_(-1, 255, 255, 255, 255);
}
@Test public void parse() {
tst_parse_("0,0,0,0", 0, 0, 0, 0); // parse all ints
tst_parse_("0,0,0", 255, 0, 0, 0); // a=255, parse rest
tst_parse_("255", 0, 0, 0, 255); // parse as single int
}
void tst_parse_hex_(String raw, int a, int r, int g, int b) {
ColorAdp color = ColorAdp_.parse_hex_(raw);
tst_ColorAdp(color, a, r, g, b);
Tfds.Eq(color.XtoHexStr(), raw);
}
void tst_parse_int_(int val, int a, int r, int g, int b) {
ColorAdp color = ColorAdp_.new_int_(val);
tst_ColorAdp(color, a, r, g, b);
Tfds.Eq(color.Value(), val);
}
void tst_parse_(String s, int alpha, int red, int green, int blue) {tst_ColorAdp(ColorAdp_.parse(s), alpha, red, green, blue);}
void tst_ColorAdp(ColorAdp color, int alpha, int red, int green, int blue) {
TfdsTstr_fxt tstr = TfdsTstr_fxt.new_();
tstr.Eq_str(color.Alpha(), alpha, "alpha");
tstr.Eq_str(color.Red(), red, "red");
tstr.Eq_str(color.Green(), green, "green");
tstr.Eq_str(color.Blue(), blue, "blue");
tstr.tst_Equal("color");
}
}

View File

@@ -0,0 +1,24 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.envs; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.envs.*;
public class ClipboardAdp__tst {
@Test public void Basic() {
ClipboardAdp_.SetText("test");
Tfds.Eq(true, ClipboardAdp_.IsText());
Tfds.Eq("test", ClipboardAdp_.GetText());
}
}

View File

@@ -0,0 +1,27 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.envs; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.envs.*;
public class ScreenAdp_tst {
@Test public void parse() {
ScreenAdp actl = ScreenAdp_.parse("{screen{0}");
Tfds.Eq(0, actl.Index());
}
@Test public void opposite_() {
ScreenAdp actl = ScreenAdp_.from_point_(PointAdp_.new_(2000, 2000));
Tfds.Eq(0, actl.Index());
}
}

View File

@@ -0,0 +1,46 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.imgs; import gplx.*; import gplx.gfui.*;
import org.junit.*;
import gplx.core.consoles.*;
import gplx.core.ios.*;
import gplx.core.security.*;
import gplx.gfui.imgs.*;
public class ImageAdp_tst {
@Before public void setup() {
load = Tfds.RscDir.GenSubFil_nest("150_gfui", "imgs", "strawberry_java.bmp");
} ImageAdp img; Io_url load;
@Test public void load_() {
img = ImageAdp_.file_(load);
Tfds.Eq(80, img.Width());
Tfds.Eq(80, img.Height());
Tfds.Eq("80,80", img.Size().toString());
Tfds.Eq(img.Url(), load);
}
@Test public void SaveAsBmp() {
img = ImageAdp_.file_(load);
Io_url save = load.GenNewNameOnly("strawberry_temp");
DateAdp beforeModifiedTime = Io_mgr.Instance.QueryFil(save).ModifiedTime();
img.SaveAsBmp(save);
DateAdp afterModifiedTime = Io_mgr.Instance.QueryFil(save).ModifiedTime();
Tfds.Eq_true(CompareAble_.Is(CompareAble_.More, afterModifiedTime, beforeModifiedTime));
Hash_algo algo = Hash_algo_.New__md5();
String loadHash = algo.Hash_stream_as_str(Console_adp_.Noop, Io_mgr.Instance.OpenStreamRead(load));
String saveHash = algo.Hash_stream_as_str(Console_adp_.Noop, Io_mgr.Instance.OpenStreamRead(save));
Tfds.Eq(loadHash, saveHash);
}
}

View File

@@ -0,0 +1,29 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.ipts.*; import gplx.gfui.controls.windows.*;
public class GfuiClickKeyMgr_tst {
@Test public void ExtractKeyFromText() {
tst_ExtractKey("&click", IptKey_.C);
tst_ExtractKey("&", IptKey_.None);
tst_ExtractKey("trailing &", IptKey_.None);
tst_ExtractKey("me & you", IptKey_.None);
}
void tst_ExtractKey(String text, IptKey expd) {
IptKey actl = GfuiWinKeyCmdMgr.ExtractKeyFromText(text);
Tfds.Eq(expd, actl);
}
}

View File

@@ -0,0 +1,60 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*;
public class IptArgChainMgr_tst {
@Before public void setup() {
fx = new IptArgChainMgr_fx();
} IptArgChainMgr_fx fx;
@Test public void Add() {
fx.run_Add(IptKey_.A, IptKey_.B, IptKey_.C);
fx.tst_(IptKey_.A, 1);
fx.tst_(IptKey_.B, 1);
fx.tst_(IptKey_.C, 2);
fx.tst_(IptKey_.B, 0);
fx.tst_(IptKey_.C, 0);
}
@Test public void Del() {
fx.run_Add(IptKey_.A, IptKey_.B, IptKey_.C);
fx.run_Del(IptKey_.A, IptKey_.B, IptKey_.C);
fx.tst_(IptKey_.A, 0);
fx.tst_(IptKey_.B, 0);
fx.tst_(IptKey_.C, 0);
}
class IptArgChainMgr_fx {
public IptArgChainMgr Under() {return under;} IptArgChainMgr under = new IptArgChainMgr();
public IptArgChainMgr_fx run_Add(IptKey... ary) {under.Add(new IptKeyChain(ary)); return this;}
public IptArgChainMgr_fx run_Del(IptKey... ary) {under.Del(new IptKeyChain(ary)); return this;}
public IptArgChainMgr_fx tst_(IptKey key, int expd) {
String process = under.Process(key);
String activeKey = under.ActiveKey();
String literal = key.Key();
if (expd == 0) {
Tfds.Eq(process, "", "0:{0} should be empty:process", literal);
Tfds.Eq(activeKey, "", "0:{0} should be noop:activeKey", literal);
}
else if (expd == 1) {
Tfds.Eq(process, "", "1:{0} should be empty:process", literal);
Tfds.Eq_true(String_.Has_at_end(activeKey, key.Key() + ","), "1:{0} should set key:activeKey,{1}", literal, activeKey);
}
else if (expd == 2) {
Tfds.Eq_true(String_.EqNot(process, ""), "2:{0} should not be empty;process,{1}", literal, process);
Tfds.Eq(activeKey, "", "2:{0} should be empty:activeKey", literal);
}
return this;
}
}
}

View File

@@ -0,0 +1,61 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.ipts.*;
public class IptArg_parser_tst {
@Test public void KeyBasic() {
tst_parse_Key_("key.a", IptKey_.A);
tst_parse_Key_("key.d0", IptKey_.D0);
tst_parse_Key_("key.semicolon", IptKey_.Semicolon);
tst_parse_Key_("key.equal", IptKey_.Equal);
tst_parse_Key_("key.pageUp", IptKey_.PageUp);
tst_parse_Key_("key.ctrl", IptKey_.Ctrl);
tst_parse_Key_("key.none", IptKey_.None);
} void tst_parse_Key_(String raw, IptKey expd) {Tfds.Eq(expd.Val(), IptKey_.parse(raw).Val());}
@Test public void KbdCmdModifiers() {
tst_parse_Key_("key.ctrl+key.enter", IptKey_.Ctrl.Add(IptKey_.Enter));
tst_parse_Key_("key.alt+key.escape", IptKey_.Alt.Add(IptKey_.Escape));
tst_parse_Key_("key.shift+key.f1", IptKey_.Shift.Add(IptKey_.F1));
tst_parse_Key_("key.shift+key.ctrl", IptKey_.Ctrl.Add(IptKey_.Shift));
tst_parse_Key_("key.ctrl+key.alt+key.slash", IptKey_.Ctrl.Add(IptKey_.Alt).Add(IptKey_.Slash));
}
@Test public void KeyWhitespace() {
tst_parse_Key_("key.ctrl + key.alt + key.slash", IptKey_.Ctrl.Add(IptKey_.Alt).Add(IptKey_.Slash));
}
@Test public void MouseBtn() {
tst_parse_MouseBtn_("mouse.left", IptMouseBtn_.Left);
tst_parse_MouseBtn_("mouse.right", IptMouseBtn_.Right);
tst_parse_MouseBtn_("mouse.middle", IptMouseBtn_.Middle);
tst_parse_MouseBtn_("mouse.x1", IptMouseBtn_.X1);
tst_parse_MouseBtn_("mouse.x2", IptMouseBtn_.X2);
} void tst_parse_MouseBtn_(String raw, IptMouseBtn expd) {Tfds.Eq(expd, IptMouseBtn_.parse(raw));}
@Test public void MouseWheel() {
tst_parse_MouseWheel_("wheel.up", IptMouseWheel_.Up);
tst_parse_MouseWheel_("wheel.down", IptMouseWheel_.Down);
} void tst_parse_MouseWheel_(String raw, IptMouseWheel expd) {Tfds.Eq(expd, IptMouseWheel_.parse(raw));}
@Test public void Mod() {
tst_parse_("mod.c", IptKey_.Ctrl);
tst_parse_("mod.cs", IptKey_.add_(IptKey_.Ctrl, IptKey_.Shift));
tst_parse_("mod.cas", IptKey_.add_(IptKey_.Ctrl, IptKey_.Alt, IptKey_.Shift));
tst_parse_("mod.c+key.c", IptKey_.add_(IptKey_.Ctrl, IptKey_.C));
}
@Test public void All() {
tst_parse_("key.c", IptKey_.C);
tst_parse_("mouse.left", IptMouseBtn_.Left);
tst_parse_("wheel.up", IptMouseWheel_.Up);
tst_parse_("mod.c", IptKey_.Ctrl);
} void tst_parse_(String raw, IptArg expd) {Tfds.Eq(expd, IptArg_.parse(raw));}
}

View File

@@ -0,0 +1,70 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.core.strings.*;
public class IptBndMgr_tst {
@Before public void setup() {
fx = new IptBndMgr_fx();
} IptBndMgr_fx fx;
@Test public void Add() {
fx.ini_Clear().run_Add("key.a").tst_Exec_same("key.a").tst_Exec_none("key.b");
fx.ini_Clear().run_Add("key.ctrl+key.a").tst_Exec_same("key.ctrl+key.a").tst_Exec_none("key.ctrl").tst_Exec_none("key.a");
fx.ini_Clear().run_Add("key.a|key.b").tst_Exec_same("key.a").tst_Exec_same("key.b").tst_Exec_none("key.c");
fx.ini_Clear().run_Add("mouse.left").tst_Exec_same("mouse.left");
fx.ini_Clear().run_Add("key.a,key.b")
.tst_Exec_none("key.a").tst_Exec_same("key.b")
.tst_Exec_none("key.a").tst_Exec_none("key.c").tst_Exec_none("key.a").tst_Exec_same("key.b")
.tst_Exec_none("key.a").tst_Exec_none("key.a").tst_Exec_none("key.b");
}
class IptBndMgr_fx {
public IptBndMgr Under() {return under;} IptBndMgr under = IptBndMgr.new_();
public IptBndMgr_fx ini_Clear() {under.Clear(); return this;}
public IptBndMgr_fx run_Add(String raw) {
IptArg[] args = IptArg_.parse_ary_(raw);
List_adp list = List_adp_.New();
for (IptArg arg : args)
list.Add(arg);
IptBnd_mok bnd = new IptBnd_mok(output).Key_(raw).Ipts_(list).EventTypes_(IptEventType_.default_(args));
under.Add(bnd);
return this;
}
public IptBndMgr_fx tst_Exec_none(String key) {return tst_Exec(key, "");}
public IptBndMgr_fx tst_Exec_same(String key) {return tst_Exec(key, key);}
public IptBndMgr_fx tst_Exec(String key, String expd) {
output.Clear();
IptArg[] args = IptArg_.parse_ary_(key);
for (IptArg arg : args) {
IptEventData evData = IptEventData.new_(null, IptArg_.EventType_default(arg), arg, null, null);
under.Process(evData);
}
Tfds.Eq(expd, output.To_str());
return this;
}
String_bldr output = String_bldr_.new_();
public IptBndMgr_fx() {}
}
class IptBnd_mok implements IptBnd {
public String Key() {return key;} public IptBnd_mok Key_(String v) {key = v; return this;} private String key;
public List_adp Ipts() {return args;} public IptBnd_mok Ipts_(List_adp v) {args = v; return this;} List_adp args;
public IptEventType EventTypes() {return eventTypes;} public IptBnd_mok EventTypes_(IptEventType v) {eventTypes = v; return this;} IptEventType eventTypes;
public Object Srl(GfoMsg owner) {return this;}
public void Exec(IptEventData iptData) {
output.Add(iptData.EventArg().Key());
}
public IptBnd_mok(String_bldr v) {output = v;} String_bldr output;
}
}

View File

@@ -0,0 +1,82 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*;
public class IptCfg_tst {
@Before public void setup() {
IptCfgRegy.Instance.Clear();
box = new IptBndsOwner_mok();
cfg = new IptCfg_mok();
key = IptBndsOwner_mok.Invk_Reg;
} IptBndsOwner_mok box; IptCfg_mok cfg; String key;
@Test public void Basic() {
cfg.run_GetOrDflt(box, key, IptKey_.A);
box.tst_SendKey(IptKey_.A, 1);
}
@Test public void Del() {
cfg.run_GetOrDflt(box, key, IptKey_.A);
box.IptBnds().Cfgs_delAll();
box.tst_SendKey(IptKey_.A, 0);
}
@Test public void Change() {
cfg.run_GetOrDflt(box, key, IptKey_.A);
cfg.run_Set(key, IptKey_.B);
box.tst_SendKey(IptKey_.B, 1);
cfg.run_Set(key, IptKey_.C);
box.tst_SendKey(IptKey_.C, 1);
box.tst_SendKey(IptKey_.B, 0);
}
@Test public void SetBeforeInit() {
cfg.run_Set(key, IptKey_.B);
cfg.run_GetOrDflt(box, key, IptKey_.A);
box.tst_SendKey(IptKey_.B, 1);
box.tst_SendKey(IptKey_.A, 0);
}
@Test public void SetBeforeInit_msg() {
cfg.run_Set_msg(key, 2, IptKey_.B);
cfg.run_GetOrDflt(box, key, IptKey_.A); // iptBnd exists; ignore Key_.A (and also msg=1)
box.tst_SendKey(IptKey_.B, 2);
box.tst_SendKey(IptKey_.A, 0);
}
@Test public void Chained() {
cfg.run_GetOrDflt(box, key, IptKeyChain.parse("key.ctrl+key.a,key.b"));
cfg.run_Set(key, IptKey_.A);
box.tst_SendKey(IptKey_.A, 1);
}
class IptCfg_mok {
public IptCfg Cfg() {return cfg;}
public void run_GetOrDflt(IptBndsOwner box, String key, IptArg... ary) {IptBnd_.msg_(cfg, box, key, make_(key, 1), ary);}
public void run_Set(String key, IptArg... ary) {cfg.Set(key, make_(key, 1), ary);}
public void run_Set_msg(String key, int i, IptArg... ary) {cfg.Set(key, make_(key, i), ary);}
GfoMsg make_(String key, int i) {return GfoMsg_.new_cast_(key).Add("val", i);}
public IptCfg_mok() {cfg = (IptCfg_base)IptCfg_.new_("cfg");} IptCfg_base cfg;
}
class IptBndsOwner_mok implements IptBndsOwner {
public IptBndMgr IptBnds() {return iptBnds;} IptBndMgr iptBnds = IptBndMgr.new_();
public Gfo_evt_mgr Evt_mgr() {if (evt_mgr == null) evt_mgr = new Gfo_evt_mgr(this); return evt_mgr;} Gfo_evt_mgr evt_mgr;
public void tst_SendKey(IptKey key, int expd) {
iptBnds.Process(IptEventData.new_(null, IptEventType_.KeyDown, key, IptEvtDataKey.new_(key), IptEvtDataMouse.Null));
Tfds.Eq(expd, actl);
actl = 0;
} int actl;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_Reg)) {actl = m.ReadIntOr("val", 0);}
else return Gfo_invk_.Rv_unhandled;
return this;
} public static final String Invk_Reg = "Reg";
}
}

View File

@@ -0,0 +1,32 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.ipts.*;
public class IptEventType_tst {
@Test public void Has() {
tst_Has(IptEventType_.KeyDown, IptEventType_.KeyDown, true);
tst_Has(IptEventType_.KeyUp, IptEventType_.KeyDown, false);
tst_Has(IptEventType_.None, IptEventType_.KeyDown, false);
tst_Has(IptEventType_.KeyDown, IptEventType_.None, false);
tst_Has(IptEventType_.KeyDown.Add(IptEventType_.KeyUp), IptEventType_.KeyDown, true);
tst_Has(IptEventType_.MouseDown.Add(IptEventType_.MouseUp), IptEventType_.KeyDown, false);
tst_Has(IptEventType_.KeyDown.Add(IptEventType_.KeyUp), IptEventType_.None, false);
} void tst_Has(IptEventType val, IptEventType find, boolean expd) {Tfds.Eq(expd, IptEventType_.Has(val, find));}
@Test public void add_() {
tst_add(IptEventType_.KeyDown, IptEventType_.KeyDown, IptEventType_.KeyDown.Val());
tst_add(IptEventType_.KeyDown, IptEventType_.KeyUp, IptEventType_.KeyDown.Val() + IptEventType_.KeyUp.Val());
} void tst_add(IptEventType lhs, IptEventType rhs, int expd) {Tfds.Eq(expd, IptEventType_.add_(lhs, rhs).Val());}
}

View File

@@ -0,0 +1,57 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*;
public class IptKeyStrMgr_tst {
@Test public void KeyBasic() {
tst_XtoUiStr(IptKey_.A, "a");
tst_XtoUiStr(IptKey_.Z, "z");
tst_XtoUiStr(IptKey_.Shift.Add(IptKey_.A), "A");
tst_XtoUiStr(IptKey_.Shift.Add(IptKey_.Z), "Z");
tst_XtoUiStrShifted(IptKey_.Equal, "=", "+");
tst_XtoUiStrShifted(IptKey_.D0, "0", ")");
tst_XtoUiStrShifted(IptKey_.D1, "1", "!");
tst_XtoUiStrShifted(IptKey_.D2, "2", "@");
tst_XtoUiStrShifted(IptKey_.D3, "3", "#");
tst_XtoUiStrShifted(IptKey_.D4, "4", "$");
tst_XtoUiStrShifted(IptKey_.D5, "5", "%");
tst_XtoUiStrShifted(IptKey_.D6, "6", "^");
tst_XtoUiStrShifted(IptKey_.D7, "7", "&");
tst_XtoUiStrShifted(IptKey_.D8, "8", "*");
tst_XtoUiStrShifted(IptKey_.D9, "9", "(");
tst_XtoUiStrShifted(IptKey_.Minus, "-", "_");
tst_XtoUiStrShifted(IptKey_.Backslash, "\\", "|");
tst_XtoUiStrShifted(IptKey_.Semicolon, ";", ":");
tst_XtoUiStrShifted(IptKey_.Quote, "'", "\"");
tst_XtoUiStrShifted(IptKey_.Comma, ",", "<");
tst_XtoUiStrShifted(IptKey_.Period, ".", ">");
tst_XtoUiStrShifted(IptKey_.Slash, "?", "/");
tst_XtoUiStrShifted(IptKey_.Tick, "`", "~");
tst_XtoUiStrShifted(IptKey_.OpenBracket, "[", "{");
tst_XtoUiStrShifted(IptKey_.CloseBracket, "]", "}");
}
@Test public void FetchByKeyPress() {
tst_FetchByKeyPress('a', IptKey_.add_(IptKey_.A));
tst_FetchByKeyPress('A', IptKey_.add_(IptKey_.A, IptKey_.Shift));
tst_FetchByKeyPress('1', IptKey_.add_(IptKey_.D1));
tst_FetchByKeyPress('!', IptKey_.add_(IptKey_.D1, IptKey_.Shift));
} void tst_FetchByKeyPress(char c, IptKey expd) {Tfds.Eq(expd.Key(), IptKeyStrMgr.Instance.FetchByKeyPress((int)c).Key());}
void tst_XtoUiStr(IptKey key, String expd) {Tfds.Eq(expd, key.XtoUiStr());}
void tst_XtoUiStrShifted(IptKey key, String expdNormal, String expdShifted) {
Tfds.Eq(expdNormal, key.XtoUiStr());
Tfds.Eq(expdShifted, IptKey_.Shift.Add(key).XtoUiStr());
}
}

View File

@@ -0,0 +1,37 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*;
public class IptKey__tst {
private final IptKey__fxt fxt = new IptKey__fxt();
@Test public void To_str() {
fxt.Test_to_str(196608, "mod.cs");
}
@Test public void To_str__numeric() {
fxt.Test_to_str(12345, "key.#12345");
}
@Test public void Parse() {
fxt.Test_parse("key.#10", 10);
}
}
class IptKey__fxt {
public void Test_to_str(int keycode, String expd) {
Tfds.Eq(expd, IptKey_.To_str(keycode));
}
public void Test_parse(String raw, int keycode) {
Tfds.Eq(keycode, IptKey_.parse(raw).Val());
}
}

View File

@@ -0,0 +1,110 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.layouts; import gplx.*; import gplx.gfui.*;
import org.junit.*;
public class GftBand_tst {
@Before public void setup() {
fx.Clear().ini_OwnerSize(200, 400);
} GftGrid_fx fx = new GftGrid_fx();
@Test public void Bands_1() {
fx .ini_AddItms(2)
.ini_Set(0, GftBand.new_().Cells_num_(2))
.run()
.tst_Filter(0, 1).tst_X(0, 100).tst_W_all(100).tst_H_all(20).tst_Y_all(0);
}
@Test public void Bands_1_half() { // only add 1 to 2 cell-band
fx .ini_AddItms(1)
.ini_Set(0, GftBand.new_().Cells_num_(2))
.run()
.tst_Filter(0).tst_X(0).tst_W(100).tst_H(20).tst_Y(0);
}
@Test public void Bands_2() { // put cells 2, 3 on band 1
fx .ini_AddItms(4)
.ini_Set(0, GftBand.new_().Cells_num_(2))
.ini_Set(1, GftBand.new_().Cells_num_(2))
.run()
.tst_Filter(0, 1).tst_X(0, 100).tst_W_all(100).tst_H_all(20).tst_Y_all(0)
.tst_Filter(2, 3).tst_X(0, 100).tst_W_all(100).tst_H_all(20).tst_Y_all(20); // put on 2nd row
}
@Test public void Pct_one() {
fx .ini_AddItms(1)
.ini_Set(0, GftBand.new_().Cell_pct_(50))
.run()
.tst_Filter(0).tst_X(0).tst_W(100).tst_H_all(20).tst_Y_all(0);
}
@Test public void Pct_many() {
fx .ini_AddItms(3)
.ini_Set(0, GftBand.new_().Cell_pct_(20).Cell_pct_(70).Cell_pct_(10))
.run()
.tst_Filter(0, 2).tst_W(40, 140, 20).tst_X(0, 40, 180).tst_H_all(20).tst_Y_all(0);
}
@Test public void Mix_pctAtEnd() {
fx .ini_AddItms(2)
.ini_Set(0, GftBand.new_().Cell_abs_(60).Cell_pct_(100))
.run()
.tst_Filter(0, 1).tst_X(0, 60).tst_W(60, 140).tst_H_all(20).tst_Y_all(0);
}
@Test public void Mix_pctAtBgn() {
fx .ini_AddItms(2)
.ini_Set(0, GftBand.new_().Cell_pct_(100).Cell_abs_(60))
.run()
.tst_Filter(0, 1).tst_X(0, 140).tst_W(140, 60).tst_H_all(20).tst_Y_all(0);
}
@Test public void Mix_pctAtMid() {
fx .ini_AddItms(3)
.ini_Set(0, GftBand.new_().Cell_abs_(60).Cell_pct_(100).Cell_abs_(40))
.run()
.tst_Filter(0, 2).tst_X(0, 60, 160).tst_W(60, 100, 40).tst_H_all(20).tst_Y_all(0);
}
@Test public void Height_pct() {
fx .ini_AddItms(1)
.ini_Set(0, GftBand.new_().Cell_pct_(100).Len1_pct_(100))
.run()
.tst_Filter(0).tst_X(0).tst_W(200).tst_H_all(400).tst_Y_all(0);
}
@Test public void Height_mix() {
fx .ini_AddItms(3)
.ini_Set(0, GftBand.new_().Cells_num_(1).Len1_abs_( 60))
.ini_Set(1, GftBand.new_().Cells_num_(1).Len1_pct_(100))
.ini_Set(2, GftBand.new_().Cells_num_(1).Len1_abs_( 20))
.run()
.tst_Filter(0).tst_H( 60).tst_Y_all( 0).tst_X(0).tst_W(200)
.tst_Filter(1).tst_H(320).tst_Y_all( 60).tst_X(0).tst_W(200)
.tst_Filter(2).tst_H( 20).tst_Y_all(380).tst_X(0).tst_W(200);
}
@Test public void RevDir() {
fx .ini_AddItms(2).ini_BandDir(DirInt.Bwd)
.ini_Set(0, 1, GftBand.new_().Cells_num_(1).Len1_abs_(20))
.run()
.tst_Filter(0).tst_W(200).tst_H(20).tst_X(0).tst_Y(380)
.tst_Filter(1).tst_W(200).tst_H(20).tst_X(0).tst_Y(360);
}
@Test public void SubLyts() {
fx .ini_AddItms(2).ini_AddLyts(2)
.ini_Lyt(0).ini_Set(0, GftBand.new_().Cells_num_(1).Len1_pct_(100))
.ini_Lyt(1).ini_Set(0, GftBand.new_().Cells_num_(1).Len1_abs_( 20)).ini_BandDir(DirInt.Bwd)
.run()
.tst_Filter(0).tst_W(200).tst_H(400).tst_X(0).tst_Y( 0)
.tst_Filter(1).tst_W(200).tst_H( 20).tst_X(0).tst_Y(380);
}
@Test public void Var() {
fx .ini_AddItms(2)
.ini_ItmWidth(0, 30).ini_ItmWidth(1, 40)
.ini_Set(0, GftBand.new_().Cells_var_(2))
.run()
.tst_Filter(0, 1).tst_X(0, 30).tst_W(30, 40).tst_H_all(20).tst_Y_all(0);
}
}