From: <prn...@us...> - 2012-09-04 19:01:23
|
Revision: 10960 http://octave.svn.sourceforge.net/octave/?rev=10960&view=rev Author: prnienhuis Date: 2012-09-04 19:01:14 +0000 (Tue, 04 Sep 2012) Log Message: ----------- Add a small delay to UNO (LibreOffice/OOo) calls to avoid lockup Modified Paths: -------------- trunk/octave-forge/main/io/inst/io_ods_testscript.m trunk/octave-forge/main/io/inst/io_xls_testscript.m Modified: trunk/octave-forge/main/io/inst/io_ods_testscript.m =================================================================== --- trunk/octave-forge/main/io/inst/io_ods_testscript.m 2012-09-04 09:09:48 UTC (rev 10959) +++ trunk/octave-forge/main/io/inst/io_ods_testscript.m 2012-09-04 19:01:14 UTC (rev 10960) @@ -20,10 +20,15 @@ ## Author: Philip Nienhuis ## Created: 2012-02-25 ## Updates: +## 2012-09-04 Add small delay between LibreOffice calls to avoid lock-ups with UNO - printf ("\nTesting .ods interface %s ...\n", intf); +isuno = false; dly = 0.25; +if (strcmp (lower (intf), 'uno')); + isuno = true; +endif + ## 1. Initialize test arrays printf ("\n 1. Initialize arrays.\n"); arr1 = [ 1 2; 3 4.5]; @@ -32,26 +37,26 @@ ## 2. Insert empty sheet printf ("\n 2. Insert first empty sheet.\n"); -odswrite ('io-test.ods', {''}, 'EmptySheet', 'b4', intf); +odswrite ('io-test.ods', {''}, 'EmptySheet', 'b4', intf); if (isuno); sleep (dly); endif ## 3. Add data to test sheet printf ("\n 3. Add data to test sheet.\n"); -odswrite ('io-test.ods', arr1, 'Testsheet', 'c2:d3', intf); -odswrite ('io-test.ods', arr2, 'Testsheet', 'd4:z20', intf); +odswrite ('io-test.ods', arr1, 'Testsheet', 'c2:d3', intf); if (isuno); sleep (dly); endif +odswrite ('io-test.ods', arr2, 'Testsheet', 'd4:z20', intf); if (isuno); sleep (dly); endif ## 4. Insert another sheet printf ("\n 4. Add another sheet with just one number in A1.\n"); -odswrite ('io-test.ods', [1], 'JustOne', 'A1', intf); +odswrite ('io-test.ods', [1], 'JustOne', 'A1', intf); if (isuno); sleep (dly); endif ## 5. Get sheet info & find sheet with data and data range printf ("\n 5. Explore sheet info.\n"); -[~, shts] = odsfinfo ('io-test.ods', intf); +[~, shts] = odsfinfo ('io-test.ods', intf); if (isuno); sleep (dly); endif shnr = strmatch ('Testsheet', shts(:, 1)); # Note case! crange = shts{shnr, 2}; ## 6. Read data back printf ("\n 6. Read data back.\n"); -[num, txt, raw, lims] = odsread ('io-test.ods', shnr, crange, intf); +[num, txt, raw, lims] = odsread ('io-test.ods', shnr, crange, intf); if (isuno); sleep (dly); endif ## 7. Here come the tests, part 1 printf ("\n 7. Tests part 1 (basic I/O):\n"); @@ -92,9 +97,9 @@ ## Check if formulas_as_text works: printf ("\n 8. Repeat reading, now return formulas as text\n"); opts.formulas_as_text = 1; -ods = odsopen ('io-test.ods', 0, intf); -raw = ods2oct (ods, shnr, crange, opts); -ods = odsclose (ods); +ods = odsopen ('io-test.ods', 0, intf); if (isuno); sleep (dly); endif +raw = ods2oct (ods, shnr, crange, opts); if (isuno); sleep (dly); endif +ods = odsclose (ods); if (isuno); sleep (dly); endif clear ods; ## 9. Here come the tests, part 2. Fails on COM Modified: trunk/octave-forge/main/io/inst/io_xls_testscript.m =================================================================== --- trunk/octave-forge/main/io/inst/io_xls_testscript.m 2012-09-04 09:09:48 UTC (rev 10959) +++ trunk/octave-forge/main/io/inst/io_xls_testscript.m 2012-09-04 19:01:14 UTC (rev 10960) @@ -21,15 +21,18 @@ ## Created: 2012-02-25 ## Updates: ## 2012-06-06 Adapted to COM implementation for "formulas_as_text" option +## 2012-09-04 Added delay between LibreOffice calls to avoid lockups with UNO printf ("\nTesting .xls interface %s ...\n", intf); -if (strcmp (lower (intf), 'oxs')); +isuno = false; dly = 0.25; +intf2 = intf; +if (strcmp (lower (intf), 'oxs')) printf ("OXS interface has no write support enabled - writing is done with POI.\n"); intf2 = 'com'; -else; - intf2 = intf; +elseif (strcmp (lower (intf), 'uno')); + isuno = true; endif ## 1. Initialize test arrays @@ -40,26 +43,26 @@ ## 2. Insert empty sheet printf ("\n 2. Insert first empty sheet.\n"); -xlswrite ('io-test.xls', {''}, 'EmptySheet', 'b4', intf2); +xlswrite ('io-test.xls', {''}, 'EmptySheet', 'b4', intf2); if (isuno); sleep (dly); endif ## 3. Add data to test sheet printf ("\n 3. Add data to test sheet.\n"); -xlswrite ('io-test.xls', arr1, 'Testsheet', 'c2:d3', intf2); -xlswrite ('io-test.xls', arr2, 'Testsheet', 'd4:z20', intf2); +xlswrite ('io-test.xls', arr1, 'Testsheet', 'c2:d3', intf2); if (isuno); sleep (dly); endif +xlswrite ('io-test.xls', arr2, 'Testsheet', 'd4:z20', intf2); if (isuno); sleep (dly); endif ## 4. Insert another sheet printf ("\n 4. Add another sheet with just one number in A1.\n"); -xlswrite ('io-test.xls', [1], 'JustOne', 'A1', intf2); +xlswrite ('io-test.xls', [1], 'JustOne', 'A1', intf2); if (isuno); sleep (dly); endif ## 5. Get sheet info & find sheet with data and data range printf ("\n 5. Explore sheet info.\n"); -[~, shts] = xlsfinfo ('io-test.xls', intf); +[~, shts] = xlsfinfo ('io-test.xls', intf); if (isuno); sleep (dly); endif shnr = strmatch ('Testsheet', shts(:, 1)); # Note case! crange = shts{shnr, 2}; ## 6. Read data back printf ("\n 6. Read data back.\n"); -[num, txt, raw, lims] = xlsread ('io-test.xls', shnr, crange, intf); +[num, txt, raw, lims] = xlsread ('io-test.xls', shnr, crange, intf); if (isuno); sleep (dly); endif ## 7. Here come the tests, part 1 printf ("\n 7. Tests part 1 (basic I/O):\n"); @@ -97,9 +100,9 @@ ## Check if "formulas_as_text" option works: printf ("\n 8. Repeat reading, now return formulas as text\n"); opts.formulas_as_text = 1; -xls = xlsopen ('io-test.xls', 0, intf); -raw = xls2oct (xls, shnr, crange, opts); -xls = xlsclose (xls); +xls = xlsopen ('io-test.xls', 0, intf); if (isuno); sleep (dly); endif +raw = xls2oct (xls, shnr, crange, opts); if (isuno); sleep (dly); endif +xls = xlsclose (xls); if (isuno); sleep (dly); endif ## 9. Here come the tests, part 2. printf ("\n 9. Tests part 2 (read back formula):\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |