[gnumeric] Introspection fixes



commit 0c0cb7bf0a67be28c360a76f74c349cec5b78da2
Author: Morten Welinder <terra gnome org>
Date:   Thu Apr 12 11:23:00 2018 -0400

    Introspection fixes

 src/parse-util.c                   |    6 ++++++
 src/sheet.c                        |    2 +-
 test/t3001-introspection-simple.pl |   14 +++++++++++++-
 test/t3001-introspection-simple.py |   18 ++++++++++++++++--
 4 files changed, 36 insertions(+), 4 deletions(-)
---
diff --git a/src/parse-util.c b/src/parse-util.c
index f27555b..9ad6786 100644
--- a/src/parse-util.c
+++ b/src/parse-util.c
@@ -657,6 +657,12 @@ parsepos_as_string (GnmParsePos const *pp)
                                 pp->sheet && pp->sheet->convs->r1c1_addresses);
 }
 
+/**
+ * cell_name:
+ * @cell: #GnmCell
+ *
+ * Returns: (transfer none): the name of @cell, like "B11"
+ */
 char const *
 cell_name (GnmCell const *cell)
 {
diff --git a/src/sheet.c b/src/sheet.c
index 0af9d04..80617ce 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -3891,7 +3891,7 @@ cell_ordering (gconstpointer a_, gconstpointer b_)
 /**
  * sheet_cells:
  * @sheet: a #Sheet
- * @r: a #GnmRange
+ * @r: (nullable): a #GnmRange
  *
  * Retrieves an array of all cells inside @r.
  * Returns: (element-type GnmCell) (transfer container): the cells array.
diff --git a/test/t3001-introspection-simple.pl b/test/t3001-introspection-simple.pl
index 269dfff..8c1bcac 100755
--- a/test/t3001-introspection-simple.pl
+++ b/test/t3001-introspection-simple.pl
@@ -14,7 +14,10 @@ my $ref = join("",<DATA>);
               sub { $_ eq $ref });
 
 __DATA__
-Peek:
+Number of columns: 256
+Number of rows: 65536
+
+As string:
 10
 101.25
 111.25
@@ -31,3 +34,12 @@ As int:
 0
 0
 1
+
+List of cells in sheet:
+A1
+A2
+A3
+A4
+A5
+A6
+A7
diff --git a/test/t3001-introspection-simple.py b/test/t3001-introspection-simple.py
index 455bfec..e6c2204 100755
--- a/test/t3001-introspection-simple.py
+++ b/test/t3001-introspection-simple.py
@@ -6,8 +6,16 @@ gi.require_version('Gnm', '1.12')
 from gi.repository import Gnm
 Gnm.init()
 
+# Create a workbook with one sheet
 wb = Gnm.Workbook.new_with_sheets(1)
+
+# Get sheet.  Index starts at 0
 sheet = wb.sheet_by_index(0)
+print "Number of columns:", sheet.get_size().max_cols
+print "Number of rows:", sheet.get_size().max_rows
+
+# Store values and expressions is some cells.  Coordinates are (col,row)
+# both starting at 0.  (So what the gui sees as row 1 is 0 here.)
 sheet.cell_set_value(0,0,Gnm.Value.new_int(10))
 sheet.cell_set_value(0,1,Gnm.Value.new_float(101.25))
 sheet.cell_set_text(0,2,"=A1+A2")
@@ -15,12 +23,18 @@ sheet.cell_set_text(0,3,"'01")
 sheet.cell_set_text(0,4,"zzz")
 sheet.cell_set_value(0,5,Gnm.Value.new_string("abc"))
 sheet.cell_set_value(0,6,Gnm.Value.new_bool(1))
+
+# Recalculate all cells that need it
 wb.recalc()
 
-print "Peek:"
+print "\nAs string:"
 for i in range(7):
-    print sheet.cell_get_value(0,i).peek_string()
+    print sheet.cell_get_value(0,i).get_as_string()
 
 print "\nAs int:"
 for i in range(7):
     print sheet.cell_get_value(0,i).get_as_int()
+
+print "\nList of cells in sheet:"
+for c in sheet.cells(None):
+    print c.name()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]