mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.5.4.1
This commit is contained in:
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.ios; import gplx.*;
|
||||
public class IoEngineFxt {
|
||||
IoEngine EngineOf(Io_url url) {return IoEnginePool._.Fetch(url.Info().EngineKey());}
|
||||
IoEngine EngineOf(Io_url url) {return IoEnginePool._.Get_by(url.Info().EngineKey());}
|
||||
public void tst_ExistsPaths(boolean expd, Io_url... ary) {
|
||||
for (Io_url fil : ary) {
|
||||
if (fil.Type_dir())
|
||||
@@ -36,11 +36,11 @@ public class IoEngineFxt {
|
||||
IoItmDir dirItem = EngineOf(dir).QueryDir(dir);
|
||||
Io_url[] actl = new Io_url[dirItem.SubDirs().Count() + dirItem.SubFils().Count()];
|
||||
for (int i = 0; i < dirItem.SubDirs().Count(); i++) {
|
||||
IoItmDir subDir = IoItmDir_.as_(dirItem.SubDirs().FetchAt(i));
|
||||
IoItmDir subDir = IoItmDir_.as_(dirItem.SubDirs().Get_at(i));
|
||||
actl[i] = subDir.Url();
|
||||
}
|
||||
for (int i = 0; i < dirItem.SubFils().Count(); i++) {
|
||||
IoItmFil subFil = IoItmFil_.as_(dirItem.SubFils().FetchAt(i));
|
||||
IoItmFil subFil = IoItmFil_.as_(dirItem.SubFils().Get_at(i));
|
||||
actl[i + dirItem.SubDirs().Count()] = subFil.Url();
|
||||
}
|
||||
Tfds.Eq_ary_str(expd, actl);
|
||||
|
||||
@@ -92,7 +92,7 @@ public abstract class IoEngine_dir_deep_base {
|
||||
// tst_(dialog, 2, "scan", src_dir0a_dir0a);
|
||||
// }
|
||||
// void tst_(ConsoleDlg_dev dialog, int i, String s, Io_url root) {
|
||||
// Object o = dialog.Written.FetchAt(i);
|
||||
// Object o = dialog.Written.Get_at(i);
|
||||
// IoStatusArgs args = (IoStatusArgs)o;
|
||||
// Tfds.Eq(s, args.Op);
|
||||
// Tfds.Eq(root, args.Path);
|
||||
|
||||
@@ -147,12 +147,12 @@ public abstract class IoEngine_fil_basic_base {
|
||||
stream.Read(buffer, 0, textLen);
|
||||
}
|
||||
finally {stream.Rls();}
|
||||
String actl = String_.new_utf8_(buffer);
|
||||
String actl = String_.new_u8(buffer);
|
||||
Tfds.Eq("text", actl);
|
||||
}
|
||||
@Test @gplx.Virtual public void OpenStreamWrite() {
|
||||
IoStream stream = IoEngine_xrg_openWrite.new_(fil).Exec();
|
||||
byte[] buffer = Bry_.new_utf8_("text");
|
||||
byte[] buffer = Bry_.new_u8("text");
|
||||
int textLen = String_.Len("text");
|
||||
stream.Write(buffer, 0, textLen);
|
||||
stream.Rls();
|
||||
@@ -160,12 +160,12 @@ public abstract class IoEngine_fil_basic_base {
|
||||
fx.tst_LoadFilStr(fil, "text");
|
||||
}
|
||||
// @Test public virtual void OpenStreamWrite_in_place() {
|
||||
// byte[] buffer = Bry_.new_utf8_("a|b|c");
|
||||
// byte[] buffer = Bry_.new_u8("a|b|c");
|
||||
// IoStream stream = IoEngine_xrg_openWrite.new_(fil).Exec();
|
||||
// stream.Write(buffer, 0, buffer.length);
|
||||
// stream.Rls();
|
||||
//
|
||||
// buffer = Bry_.new_utf8_("B");
|
||||
// buffer = Bry_.new_u8("B");
|
||||
// stream = IoEngine_xrg_openWrite.new_(fil).Exec();
|
||||
// stream.Seek(2);
|
||||
// stream.Write(buffer, 0, buffer.length);
|
||||
|
||||
@@ -31,7 +31,7 @@ public class IoEngine_fil_basic_memory_tst extends IoEngine_fil_basic_base {
|
||||
|
||||
// bugfix: verify changed file in ownerDir's hash
|
||||
IoItmDir dirItm = fx.tst_ScanDir(fil.OwnerDir(), fil);
|
||||
IoItmFil_mem filItm = (IoItmFil_mem)dirItm.SubFils().FetchAt(0);
|
||||
IoItmFil_mem filItm = (IoItmFil_mem)dirItm.SubFils().Get_at(0);
|
||||
Tfds.Eq(filItm.Text(), "changed");
|
||||
}
|
||||
@Test public void RecycleFil() {
|
||||
@@ -39,10 +39,10 @@ public class IoEngine_fil_basic_memory_tst extends IoEngine_fil_basic_base {
|
||||
fx.tst_ExistsPaths(true, fil);
|
||||
|
||||
IoRecycleBin bin = IoRecycleBin._;
|
||||
ListAdp list = Tfds.RscDir.XtoNames();
|
||||
List_adp list = Tfds.RscDir.XtoNames();
|
||||
// foreach (String s in list)
|
||||
// Tfds.Write(s);
|
||||
list.DelAt(0); // remove drive
|
||||
list.Del_at(0); // remove drive
|
||||
IoEngine_xrg_recycleFil recycleXrg = bin.Send_xrg(fil)
|
||||
.RootDirNames_(list)
|
||||
.AppName_("gplx.test").Time_(DateAdp_.parse_gplx("20100102_115559123")).Uuid_(Guid_adp_.parse_("467ffb41-cdfe-402f-b22b-be855425784b"));
|
||||
|
||||
@@ -34,7 +34,7 @@ public class IoEngine_fil_basic_system_tst extends IoEngine_fil_basic_base {
|
||||
fx.tst_ExistsPaths(true, fil);
|
||||
|
||||
IoRecycleBin bin = IoRecycleBin._;
|
||||
ListAdp list = root.XtoNames(); list.DelAt(0); // remove drive
|
||||
List_adp list = root.XtoNames(); list.Del_at(0); // remove drive
|
||||
IoEngine_xrg_recycleFil recycleXrg = bin.Send_xrg(fil)
|
||||
.RootDirNames_(list)
|
||||
.AppName_("gplx.test").Time_(DateAdp_.parse_gplx("20100102_115559123")).Uuid_(Guid_adp_.parse_("467ffb41-cdfe-402f-b22b-be855425784b"));
|
||||
|
||||
@@ -22,7 +22,7 @@ public class IoEngine_fil_xfer_memory_tst extends IoEngine_fil_xfer_base {
|
||||
root = Io_url_.mem_dir_("mem");
|
||||
} @Override protected IoEngine engine_() {return IoEngine_.Mem_init_();}
|
||||
@Override protected Io_url AltRoot() {
|
||||
Io_mgr._.InitEngine_mem_("mem2");
|
||||
Io_mgr.I.InitEngine_mem_("mem2");
|
||||
return Io_url_.mem_dir_("mem2");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class IoEngine_stream_xfer_tst {
|
||||
@Before public void setup() {
|
||||
srcEngine = IoEngine_memory.new_("mock1");
|
||||
trgEngine = IoEngine_memory.new_("mock2");
|
||||
IoEnginePool._.AddReplace(srcEngine); IoEnginePool._.AddReplace(trgEngine);
|
||||
IoEnginePool._.Add_if_dupe_use_nth(srcEngine); IoEnginePool._.Add_if_dupe_use_nth(trgEngine);
|
||||
IoUrlInfoRegy._.Reg(IoUrlInfo_.mem_("mem1/", srcEngine.Key()));
|
||||
IoUrlInfoRegy._.Reg(IoUrlInfo_.mem_("mem2/", trgEngine.Key()));
|
||||
srcDir = Io_url_.mem_dir_("mem1/dir"); trgDir = Io_url_.mem_dir_("mem2/dir");
|
||||
|
||||
@@ -46,7 +46,7 @@ public class IoEngine_xrg_queryDir_tst {
|
||||
tst_ExecPathAry(finder_().DirInclude_() // include dirs; NOTE: fil1A not returned b/c Recur_ is not true
|
||||
, dir_("dirA"), fil_("fil1.txt"));
|
||||
}
|
||||
@Test public void SortBy() {
|
||||
@Test public void Sort_by() {
|
||||
save_text_(fil_("fil2a.txt"), fil_("fil1.txt"));
|
||||
|
||||
tst_ExecPathAry(finder_() // default: sortByAscOrder
|
||||
@@ -58,7 +58,7 @@ public class IoEngine_xrg_queryDir_tst {
|
||||
|
||||
Io_url[] save_text_(Io_url... ary) {
|
||||
for (Io_url url : ary)
|
||||
Io_mgr._.SaveFilStr(url, url.Raw());
|
||||
Io_mgr.I.SaveFilStr(url, url.Raw());
|
||||
return ary;
|
||||
}
|
||||
void tst_ExecPathAry(IoEngine_xrg_queryDir finder, Io_url... expd) {Tfds.Eq_ary(expd, finder.ExecAsUrlAry());}
|
||||
|
||||
@@ -25,8 +25,8 @@ public class IoItmDir_FetchDeepOrNull_tst {
|
||||
@Test public void FetchDeepOrNull() {
|
||||
tst_FetchDeepOrNull(rootDir, drive.GenSubDir("sub1"), true);
|
||||
tst_FetchDeepOrNull(rootDir, drive.GenSubDir("sub2"), false);
|
||||
tst_FetchDeepOrNull(rootDir.SubDirs().FetchAt(0), drive.GenSubDir("sub1"), true);
|
||||
tst_FetchDeepOrNull(rootDir.SubDirs().FetchAt(0), drive.GenSubDir("sub2"), false);
|
||||
tst_FetchDeepOrNull(rootDir.SubDirs().Get_at(0), drive.GenSubDir("sub1"), true);
|
||||
tst_FetchDeepOrNull(rootDir.SubDirs().Get_at(0), drive.GenSubDir("sub2"), false);
|
||||
}
|
||||
void tst_FetchDeepOrNull(Object rootDirObj, Io_url find, boolean expdFound) {
|
||||
IoItmDir rootDir = IoItmDir_.as_(rootDirObj);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class IoUrl_lnx_tst {
|
||||
@Test public void OwnerDir() {
|
||||
fx.tst_OwnerDir(Io_url_.lnx_dir_("/home/lnxusr"), Io_url_.lnx_dir_("/home"));
|
||||
fx.tst_OwnerDir(Io_url_.lnx_dir_("/fil.txt"), Io_url_.lnx_dir_("/"));
|
||||
fx.tst_OwnerDir(Io_url_.lnx_dir_("/"), Io_url_.Null);
|
||||
fx.tst_OwnerDir(Io_url_.lnx_dir_("/"), Io_url_.Empty);
|
||||
}
|
||||
@Test public void NameAndExt() {
|
||||
fx.tst_NameAndExt(Io_url_.lnx_fil_("/fil.txt"), "fil.txt");
|
||||
|
||||
@@ -42,8 +42,8 @@ public class IoUrl_wnt_tst {
|
||||
@Test public void OwnerDir() {
|
||||
fx.tst_OwnerDir(Io_url_.wnt_dir_("C:\\dir\\sub1"), Io_url_.wnt_dir_("C:\\dir"));
|
||||
fx.tst_OwnerDir(Io_url_.wnt_fil_("C:\\fil.txt"), Io_url_.wnt_dir_("C:"));
|
||||
fx.tst_OwnerDir(Io_url_.wnt_dir_("C:"), Io_url_.Null);
|
||||
// fx.tst_OwnerDir(Io_url_.wnt_fil_("press enter to select this folder"), Io_url_.Null);
|
||||
fx.tst_OwnerDir(Io_url_.wnt_dir_("C:"), Io_url_.Empty);
|
||||
// fx.tst_OwnerDir(Io_url_.wnt_fil_("press enter to select this folder"), Io_url_.Empty);
|
||||
}
|
||||
@Test public void NameAndExt() {
|
||||
fx.tst_NameAndExt(Io_url_.wnt_fil_("C:\\fil.txt"), "fil.txt");
|
||||
@@ -81,7 +81,7 @@ public class IoUrl_wnt_tst {
|
||||
class IoUrlFxt {
|
||||
public void tst_Xto_api(Io_url url, String expd) {Tfds.Eq(expd, url.Xto_api());}
|
||||
public void tst_OwnerRoot(Io_url url, String expd) {Tfds.Eq(expd, url.OwnerRoot().Raw());}
|
||||
public void tst_XtoNames(Io_url url, String... expdAry) {Tfds.Eq_ary(expdAry, url.XtoNames().XtoStrAry());}
|
||||
public void tst_XtoNames(Io_url url, String... expdAry) {Tfds.Eq_ary(expdAry, url.XtoNames().To_str_ary());}
|
||||
public void tst_NameAndExt(Io_url url, String expd) {Tfds.Eq(expd, url.NameAndExt());}
|
||||
public void tst_Xto_gplx(Io_url url, String expd) {Tfds.Eq(expd, url.Raw());}
|
||||
public void tst_IsDir(Io_url url, boolean expd) {Tfds.Eq(expd, url.Type_dir());}
|
||||
|
||||
Reference in New Issue
Block a user