mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Wikibase: Default 'null' to 0, not 1 [#792]
This commit is contained in:
parent
f19228c886
commit
72051f4ce9
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
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.xowa.xtns.scribunto.libs;
|
||||||
|
|
||||||
|
import gplx.Bry_;
|
||||||
|
import gplx.Double_;
|
||||||
|
import gplx.Keyval;
|
||||||
|
import gplx.core.tests.Gftest;
|
||||||
|
import gplx.xowa.xtns.wbases.claims.enums.Wbase_claim_value_type_;
|
||||||
|
import gplx.xowa.xtns.wbases.claims.itms.Wbase_claim_globecoordinate;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class Scrib_lib_wikibase_srl_visitor_tst {
|
||||||
|
private final Scrib_lib_wikibase_srl_visitor_fxt fxt = new Scrib_lib_wikibase_srl_visitor_fxt();
|
||||||
|
@Test
|
||||||
|
public void Geo_null_precision() {
|
||||||
|
fxt.TestGeoPrecision(0, "null"); // 2020-09-03|ISSUE#:792|null precision should default to 0 not 1;PAGE:wd:Q168751
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class Scrib_lib_wikibase_srl_visitor_fxt {
|
||||||
|
private final Scrib_lib_wikibase_srl_visitor visitor = new Scrib_lib_wikibase_srl_visitor();
|
||||||
|
public void TestGeoPrecision(double expd, String prc) {
|
||||||
|
String lat = "12";
|
||||||
|
String lng = "34";
|
||||||
|
visitor.Visit_globecoordinate(new Wbase_claim_globecoordinate(123, Wbase_claim_value_type_.Tid__value, Bry_.new_a7(lat), Bry_.new_a7(lng), null, Bry_.new_u8_safe(prc), null));
|
||||||
|
Keyval[] actl = visitor.Rv();
|
||||||
|
Keyval[] actlGeo = (Keyval[])actl[1].Val();
|
||||||
|
Gftest.Eq__double(expd, Double_.cast(actlGeo[4].Val()));
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
XOWA: the XOWA Offline Wiki Application
|
XOWA: the XOWA Offline Wiki Application
|
||||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
Copyright (C) 2012-2020 gnosygnu@gmail.com
|
||||||
|
|
||||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
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.
|
or alternatively under the terms of the Apache License Version 2.0.
|
||||||
@ -13,10 +13,20 @@ 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
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.xtns.wbases.claims.itms; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.wbases.*; import gplx.xowa.xtns.wbases.claims.*;
|
package gplx.xowa.xtns.wbases.claims.itms;
|
||||||
import gplx.xowa.xtns.wbases.claims.enums.*;
|
|
||||||
|
import gplx.Bry_;
|
||||||
|
import gplx.Decimal_adp;
|
||||||
|
import gplx.Decimal_adp_;
|
||||||
|
import gplx.Object_;
|
||||||
|
import gplx.String_;
|
||||||
|
import gplx.xowa.xtns.wbases.claims.Wbase_claim_visitor;
|
||||||
|
import gplx.xowa.xtns.wbases.claims.enums.Wbase_claim_type_;
|
||||||
|
import gplx.xowa.xtns.wbases.claims.enums.Wbase_claim_value_type_;
|
||||||
|
|
||||||
public class Wbase_claim_globecoordinate extends Wbase_claim_base {
|
public class Wbase_claim_globecoordinate extends Wbase_claim_base {
|
||||||
public Wbase_claim_globecoordinate(int pid, byte snak_tid, byte[] lat, byte[] lng, byte[] alt, byte[] prc, byte[] glb) {super(pid, snak_tid);
|
public Wbase_claim_globecoordinate(int pid, byte snak_tid, byte[] lat, byte[] lng, byte[] alt, byte[] prc, byte[] glb) {
|
||||||
|
super(pid, snak_tid);
|
||||||
this.lat = lat; this.lng = lng; this.alt = alt; this.prc = prc; this.glb = glb;
|
this.lat = lat; this.lng = lng; this.alt = alt; this.prc = prc; this.glb = glb;
|
||||||
}
|
}
|
||||||
@Override public byte Val_tid() {return Wbase_claim_type_.Tid__globecoordinate;}
|
@Override public byte Val_tid() {return Wbase_claim_type_.Tid__globecoordinate;}
|
||||||
@ -29,8 +39,11 @@ public class Wbase_claim_globecoordinate extends Wbase_claim_base {
|
|||||||
|
|
||||||
public void Glb_ttl_(byte[] v) {glb_ttl = v;}
|
public void Glb_ttl_(byte[] v) {glb_ttl = v;}
|
||||||
public Decimal_adp Prc_as_num() {
|
public Decimal_adp Prc_as_num() {
|
||||||
if (prc_as_num == null)
|
if (prc_as_num == null) {
|
||||||
prc_as_num = Bry_.Eq(prc, Object_.Bry__null) ? Decimal_adp_.One : Decimal_adp_.parse(String_.new_a7(prc));
|
prc_as_num = Bry_.Eq(prc, Object_.Bry__null)
|
||||||
|
? Decimal_adp_.Zero // 2020-09-03|ISSUE#:792|null precision should default to 0 not 1;PAGE:wd:Q168751
|
||||||
|
: Decimal_adp_.parse(String_.new_a7(prc));
|
||||||
|
}
|
||||||
return prc_as_num;
|
return prc_as_num;
|
||||||
} private Decimal_adp prc_as_num;
|
} private Decimal_adp prc_as_num;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
XOWA: the XOWA Offline Wiki Application
|
XOWA: the XOWA Offline Wiki Application
|
||||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
Copyright (C) 2012-2020 gnosygnu@gmail.com
|
||||||
|
|
||||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
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.
|
or alternatively under the terms of the Apache License Version 2.0.
|
||||||
@ -13,9 +13,13 @@ 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
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.xtns.wbases.hwtrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.wbases.*;
|
package gplx.xowa.xtns.wbases.hwtrs;
|
||||||
import org.junit.*;
|
|
||||||
import gplx.langs.jsons.*; import gplx.xowa.xtns.wbases.core.*; import gplx.xowa.xtns.wbases.claims.itms.times.*; import gplx.xowa.xtns.wbases.parsers.*; import gplx.xowa.apps.apis.xowa.html.*;
|
import gplx.Bry_;
|
||||||
|
import gplx.xowa.xtns.wbases.claims.itms.times.Wbase_date;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
public class Wdata_visitor__html_wtr_tst {
|
public class Wdata_visitor__html_wtr_tst {
|
||||||
@Before public void init() {fxt.init();} private Wdata_hwtr_mgr_fxt fxt = new Wdata_hwtr_mgr_fxt();
|
@Before public void init() {fxt.init();} private Wdata_hwtr_mgr_fxt fxt = new Wdata_hwtr_mgr_fxt();
|
||||||
@Test public void Monolingualtext() {
|
@Test public void Monolingualtext() {
|
||||||
|
Loading…
Reference in New Issue
Block a user