diff --git a/notebooks/tests/AnimationFunctionTestProB2.mch b/notebooks/tests/AnimationFunctionTestProB2.mch new file mode 100644 index 0000000000000000000000000000000000000000..b37277404fff622e7a5a569b439c6091bce46dc3 --- /dev/null +++ b/notebooks/tests/AnimationFunctionTestProB2.mch @@ -0,0 +1,11 @@ +MACHINE AnimationFunctionTestProB2 + DEFINITIONS + ANIMATION_FUNCTION0 == (1..2)*(1..2)*{0}; + ANIMATION_FUNCTION1 == x; + ANIMATION_FUNCTION2 == {(0,0,"Overview")}; + ANIMATION_IMG0 == "images/small_empty_w.gif"; + ANIMATION_IMG1 == "images/small_wqueen_w.gif" + CONSTANTS x + PROPERTIES + x = {1|->2|->1, 2|->1|->1} +END \ No newline at end of file diff --git a/notebooks/tests/images/small_empty_w.gif b/notebooks/tests/images/small_empty_w.gif new file mode 100644 index 0000000000000000000000000000000000000000..0f33c780ae8e000a17f340b75a3b90f5450f6c9c Binary files /dev/null and b/notebooks/tests/images/small_empty_w.gif differ diff --git a/notebooks/tests/images/small_wqueen_w.gif b/notebooks/tests/images/small_wqueen_w.gif new file mode 100644 index 0000000000000000000000000000000000000000..4ab932d0db4c10b71eb4d37f444c453412c0bc24 Binary files /dev/null and b/notebooks/tests/images/small_wqueen_w.gif differ diff --git a/notebooks/tests/show.ipynb b/notebooks/tests/show.ipynb index 75c21d11e96d5340fa6cd00dc2cf35bc51b5107b..5dacc6b6dfb4234930c0c52a6144909a296027ec 100644 --- a/notebooks/tests/show.ipynb +++ b/notebooks/tests/show.ipynb @@ -671,6 +671,112 @@ "source": [ ":show" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Empty cells are supported." + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Loaded machine: AnimationFunctionTestProB2" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":load AnimationFunctionTestProB2.mch" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Machine constants set up using operation 0: $setup_constants()" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":constants" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Machine initialised using operation 1: $initialise_machine()" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":init" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">Overview</td>\n", + "<td style=\"padding:0px\"></td>\n", + "<td style=\"padding:0px\"></td>\n", + "</tr>\n", + "<tr>\n", + "<td style=\"padding:0px\"></td>\n", + "<td style=\"padding:0px\"></td>\n", + "<td style=\"padding:0px\"></td>\n", + "</tr>\n", + "<tr>\n", + "<td style=\"padding:0px\"></td>\n", + "<td style=\"padding:0px\"></td>\n", + "<td style=\"padding:0px\"></td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] } ], "metadata": { diff --git a/src/main/java/de/prob2/jupyter/commands/ShowCommand.java b/src/main/java/de/prob2/jupyter/commands/ShowCommand.java index 7f71ce1cf2aca16d62f35aa8ff47380f1689e89c..22daba74dfeeb838b8a733c8eaa5326a1d332033 100644 --- a/src/main/java/de/prob2/jupyter/commands/ShowCommand.java +++ b/src/main/java/de/prob2/jupyter/commands/ShowCommand.java @@ -99,7 +99,10 @@ public final class ShowCommand implements Command { for (final Object entry : row) { final int padding; final String contents; - if (entry instanceof Integer) { + if (entry == null) { + padding = 0; + contents = ""; + } else if (entry instanceof Integer) { padding = imagePadding; contents = String.format("", entry, images.get(entry)); } else if (entry instanceof String) {