Skip to content

Commit

Permalink
Fix and test cases for Mantis bug 1839 (and 2012)
Browse files Browse the repository at this point in the history
  • Loading branch information
ganelson committed Apr 10, 2022
1 parent 1a92fbc commit 5da67dc
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# Inform 7

v10.1.0-alpha.1+6U78 'Krypton' (9 April 2022)
v10.1.0-alpha.1+6U79 'Krypton' (10 April 2022)

## About Inform 7

Expand Down
4 changes: 2 additions & 2 deletions build.txt
@@ -1,3 +1,3 @@
Prerelease: alpha.1
Build Date: 9 April 2022
Build Number: 6U78
Build Date: 10 April 2022
Build Number: 6U79
4 changes: 4 additions & 0 deletions inform7/Tests/Test Problems/PM_FigureWhiteSpace.txt
@@ -0,0 +1,4 @@
There is room.

Figure null is the file "".
Figure nearly null is the file " ".
4 changes: 4 additions & 0 deletions inform7/Tests/Test Problems/PM_SoundWhiteSpace.txt
@@ -0,0 +1,4 @@
There is room.

Sound null is the file "".
Sound nearly null is the file " ".
13 changes: 13 additions & 0 deletions inform7/Tests/Test Problems/_Results_Ideal/PM_FigureWhiteSpace.txt
@@ -0,0 +1,13 @@
Inform 7 v10.1.0 has started.
I've now read your source text, which is 14 words long.
I've also read Basic Inform by Graham Nelson, which is 7691 words long.
I've also read English Language by Graham Nelson, which is 2328 words long.
I've also read Standard Rules by Graham Nelson, which is 32092 words long.
Problem__ PM_FigureWhiteSpace
>--> You wrote 'Figure null is the file ""' (source text, line 3): but this
is not a filename I can use, because it is either empty or contains only
spaces.
Problem__ PM_FigureWhiteSpace
>--> You wrote 'Figure nearly null is the file " "' (source text, line 4):
again, this is not a filename I can use.
Inform 7 has finished.
13 changes: 13 additions & 0 deletions inform7/Tests/Test Problems/_Results_Ideal/PM_SoundWhiteSpace.txt
@@ -0,0 +1,13 @@
Inform 7 v10.1.0 has started.
I've now read your source text, which is 14 words long.
I've also read Basic Inform by Graham Nelson, which is 7691 words long.
I've also read English Language by Graham Nelson, which is 2328 words long.
I've also read Standard Rules by Graham Nelson, which is 32092 words long.
Problem__ PM_SoundWhiteSpace
>--> You wrote 'Sound null is the file ""' (source text, line 3): but this is
not a filename I can use, because it is either empty or contains only
spaces.
Problem__ PM_SoundWhiteSpace
>--> You wrote 'Sound nearly null is the file " "' (source text, line 4):
again, this is not a filename I can use.
Inform 7 has finished.
8 changes: 7 additions & 1 deletion inform7/multimedia-module/Chapter 2/Figures.w
Expand Up @@ -103,9 +103,15 @@ void Figures::register_figure(wording W, wording FN) {
if (wn >= 0) id = Task::get_next_free_blorb_resource_ID();
TEMPORARY_TEXT(leaf)
WRITE_TO(leaf, "%N", wn);
DISCARD_TEXT(leaf)
if ((wn >= 0) && (Str::is_whitespace(leaf))) {
StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_FigureWhiteSpace),
"this is not a filename I can use",
"because it is either empty or contains only spaces.");
return;
}
filename *figure_file = NULL;
if (wn >= 0) figure_file = Filenames::in(Task::figures_path(), leaf);
DISCARD_TEXT(leaf)
Figures::figures_create(W, id, figure_file, <<alttext>>);
LOGIF(MULTIMEDIA_CREATIONS, "Created figure <%W> = filename '%f' = resource ID %d\n",
W, figure_file, id);
Expand Down
8 changes: 7 additions & 1 deletion inform7/multimedia-module/Chapter 2/Sound Effects.w
Expand Up @@ -96,8 +96,14 @@ void Sounds::register_sound(wording W, wording FN) {
int id = Task::get_next_free_blorb_resource_ID();
TEMPORARY_TEXT(leaf)
WRITE_TO(leaf, "%N", wn);
DISCARD_TEXT(leaf)
if (Str::is_whitespace(leaf)) {
StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_SoundWhiteSpace),
"this is not a filename I can use",
"because it is either empty or contains only spaces.");
return;
}
filename *sound_file = Filenames::in(Task::sounds_path(), leaf);
DISCARD_TEXT(leaf)
Sounds::sounds_create(W, id, sound_file, <<alttext>>);
LOGIF(MULTIMEDIA_CREATIONS,
"Created sound effect <%W> = filename '%N' = resource ID %d\n", W, wn, id);
Expand Down

0 comments on commit 5da67dc

Please sign in to comment.