Configure: house cleaning.
[gnumeric.git] / test / t3004-introspection-overrides.py
blobbc43496e9dc87f872f7fcb0035fb1aaeb220da8f
1 #!/usr/bin/python
2 # -----------------------------------------------------------------------------
4 import gi
5 gi.require_version('Gnm', '1.12')
6 from gi.repository import Gnm
7 from gi.repository import GOffice as Go
8 Gnm.init()
10 import os.path
12 def atomize_path(p):
13 res=[]
14 while 1:
15 h,t = os.path.split(p)
16 if t != "":
17 res.append(t)
18 if h == "":
19 break
20 if h == p:
21 res.append(h)
22 break
23 p = h
24 res.reverse()
25 return res
27 l=atomize_path(os.path.dirname(gi.overrides.Gnm.__file__))
28 if len(l) > 3 and l[-3] == "introspection":
29 print("Using in-tree gi.overrides.Gnm")
30 else:
31 print("Using installed gi.overrides.Gnm at {}"
32 .format (gi.overrides.Gnm.__file__))
34 # -----------------------------------------------------------------------------
36 print("\nTesting GnmValue overrides:")
37 # __str__
38 print(Gnm.Value.new_empty())
39 print(Gnm.Value.new_bool(0))
40 print(Gnm.Value.new_bool(1))
41 print(Gnm.Value.new_int(12))
42 print(Gnm.Value.new_float(12.5))
43 print(Gnm.Value.new_string("howdy"))
44 v=Gnm.Value.new_float(12.5)
45 v.set_fmt(Go.Format.new_from_XL("0.00"))
46 print(v)
48 # -----------------------------------------------------------------------------
50 print("\nTesting GnmRange overrides:")
51 # __new__
52 r=Gnm.Range(1,2,3,4)
53 # __str__
54 print(r)