[gnumeric] xls: self check code.



commit 761929a2ea1451801caf1004903ef3cba6c1471a
Author: Morten Welinder <terra gnome org>
Date:   Mon Mar 12 15:52:24 2012 -0400

    xls: self check code.

 plugins/excel/ms-excel-util.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/plugins/excel/ms-excel-util.c b/plugins/excel/ms-excel-util.c
index 8b320f9..1f2612c 100644
--- a/plugins/excel/ms-excel-util.c
+++ b/plugins/excel/ms-excel-util.c
@@ -616,6 +616,31 @@ static paper_size_table_entry const paper_size_table[] = {
 const char *
 xls_paper_name (unsigned idx, gboolean *rotated)
 {
+#if 0
+	/*
+	 * Self-check code.  We fail in ~15 cases where we lack info
+	 * to distinguish.
+	 */
+	static gboolean first = TRUE;
+	if (first) {
+		unsigned ui;
+
+		first = FALSE;
+
+		for (ui = 0; ui < G_N_ELEMENTS (paper_size_table); ui++) {
+			const char *name = paper_size_table[ui].gp_name;
+			gboolean rotated = paper_size_table[ui].rotated;
+			GtkPaperSize *ps = gtk_paper_size_new (name);
+			unsigned ui2 = xls_paper_size (ps, rotated);
+			if (ui != ui2 && name) {
+				g_printerr ("PAPER MISMATCH: %d %d %s\n",
+					    ui, ui2, name);
+			}
+			gtk_paper_size_free (ps);
+		}
+	}
+#endif
+
 	if (idx < G_N_ELEMENTS (paper_size_table)) {
 		*rotated = paper_size_table[idx].rotated;
 		return paper_size_table[idx].gp_name;



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