newaxes should return newly created axes. 20/14120/2
Bruno JOFRET [Tue, 25 Mar 2014 10:30:48 +0000 (11:30 +0100)]
Change-Id: I79995bee468ad38ff8f5a547d37c86a480e434f1

scilab/modules/graphics/sci_gateway/c/sci_newaxes.c
scilab/modules/graphics/tests/unit_tests/newaxes.dia.ref
scilab/modules/graphics/tests/unit_tests/newaxes.tst

index 45deaa8..ac9529a 100644 (file)
@@ -121,7 +121,7 @@ int sci_newaxes(char * fname, unsigned long fname_len)
                     return 1;
                 }
 
-                AssignOutputVariable(pvApiCtx, 1) = 1;
+                AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
                 ReturnArguments(pvApiCtx);
             }
             else
index c4f9365..7aa2ec3 100644 (file)
@@ -36,3 +36,13 @@ assert_checkequal(f.children(2).style, "frame");
 assert_checkequal(f.children(2).children(1).type, "Axes");
 assert_checkequal(f.children(2).children(1).children(1).type, "Compound");
 assert_checkequal(size(f.children(2).children(1).children(1).children, '*'), 3);
+delete(f);
+f = gcf();
+a = newaxes(f);
+assert_checkequal(a.type, "Axes");
+delete(f);
+f = figure("default_axes", "off");
+fra = uicontrol(f, "style", "frame", "position", [0 0 400 400]);
+a = newaxes(fra);
+assert_checkequal(a.type, "Axes");
+delete(f);
index ca3813c..0234f7e 100644 (file)
@@ -43,3 +43,16 @@ assert_checkequal(f.children(2).style, "frame");
 assert_checkequal(f.children(2).children(1).type, "Axes");
 assert_checkequal(f.children(2).children(1).children(1).type, "Compound");
 assert_checkequal(size(f.children(2).children(1).children(1).children, '*'), 3);
+
+delete(f);
+
+f = gcf();
+a = newaxes(f);
+assert_checkequal(a.type, "Axes");
+delete(f);
+
+f = figure("default_axes", "off");
+fra = uicontrol(f, "style", "frame", "position", [0 0 400 400]);
+a = newaxes(fra);
+assert_checkequal(a.type, "Axes");
+delete(f);
\ No newline at end of file