Cabin Crew Express · Lesson 42 of 50 · Publishing · About 35 min
One tester serves water on a small phone. Another rotates a tablet during the Galley screen. Their observations need to be precise enough for Ari to repeat.

Download the projects from the course page. In Godot’s Project Manager, choose Import, select project.godot, and use Run Project (F5). Start from checkpoints/41 when the lesson builds on prior work, or copy the checkpoints/42 folder to try this lesson on its own. Read the file names in the steps before editing.


Build it step by step
Language and tools in this lesson get_viewport_rect(), Vector2, Dictionary, String.format(), append(), regression.
-
Label the trial
Write down the build number, device model, OS version and orientation. Keep personal details out of the report. If you only have a computer, record that device separately and flag physical tests as pending.
Why it works Two reports of the same game version can reach different results on different screens.
-
Measure the checkpoint
Import checkpoint 42, open main.gd and press F5. Choose Measure the viewport. Try a smaller standalone game window or adjust the embedded game view if the editor provides the control.
var viewport_size := get_viewport_rect().sizeWhy it works Viewport dimensions are the game's drawing coordinates. Fixed base-resolution games can keep those values while the window outside changes.
-
Record what happened
Choose Log a tray tap pass, then Log a resume miss. Look at entries and note how it collects each check's expected and observed results.
entries.append({"step": step, "expected": expected, "observed": observed})Why it works Reports are evidence. Keep a record of the failure while adding a separate later retest result.
-
Tap nearby controls
With an adult helping deploy the reference build, run the first three flights on a supported small phone and tablet. At occupied rows, tap the intended seat from both sides. Tap every galley item twice to check capacity and feedback.
Why it works Close controls and scrollable layouts can behave differently on real hardware.
-
Test offline and resume
On the device, turn on its airplane mode, advance a mission and reopen the game. Observe what the game actually retains. Change orientation both ways. Use a device where the tester is allowed to change these settings.
Why it works A reference build can separate saved milestones from temporary state. Your report should match the tested build's documented promise.
-
Give a reproducible revision
Write one report with numbered steps, expected result, observed result and a build. Attach a clean screenshot if helpful and try the same steps after any fix.
Why it works Running a previously tested case on a changed build is a regression test.
Watch the values change
-
Measure viewport Godot supplies visible game coordinates.
What you see. The output shows width and height. -
Record a water tap Expected and observed both say row 2 served.
What you see. The trial logs a pass. -
Record a resume miss Expected row 4; observed row 0.
What you see. The report counts one case to retest.
Predict before you run Does a clean desktop run prove that the buttons are usable on a small phone?
Reveal the answer
No. Run the tap tests on the supported device too and observe the result there.
Complete checkpoint
A size in pixels appears. Log a pass and a miss to get two cases with one flagged for retest.
main.gd
extends Control
const Lab = preload("res://release_lab.gd")
const TITLE = "Run a real-device cabin trial"
var ui: VBoxContainer
func _ready() -> void:
ui = VBoxContainer.new()
ui.set_script(Lab)
add_child(ui)
ui.start(TITLE)
build()
var entries: Array[Dictionary] = []
func build() -> void:
ui.say("Measure the visible game, then log two fictional test cases.")
ui.option("Measure the viewport", dimensions)
ui.option("Log a tray tap pass", record.bind("Deliver water at row 2", "Served 2A", "Served 2A"))
ui.option("Log a resume miss", record.bind("Return to the cabin view", "Row 4", "Row 0"))
func dimensions() -> void:
var viewport_size := get_viewport_rect().size
ui.say("Game viewport: %d × %d." % [viewport_size.x, viewport_size.y])
func record(step: String, expected: String, observed: String) -> void:
entries.append({"step": step, "expected": expected, "observed": observed})
var misses := 0
for item in entries:
if item.expected != item.observed:
misses += 1
ui.say("{step}\nExpected: {expected} / observed: {observed}\nReports: {count}. To retest: {misses}.".format({
"step": step, "expected": expected, "observed": observed,
"count": entries.size(), "misses": misses
}))
release_lab.gd
extends VBoxContainer
var output: Label
func start(title_text: String) -> void:
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
offset_left = 32.0
offset_top = 28.0
offset_right = -32.0
offset_bottom = -28.0
add_theme_constant_override("separation", 12)
var background := ColorRect.new()
background.color = Color("#14283d")
background.mouse_filter = Control.MOUSE_FILTER_IGNORE
get_parent().add_child(background)
background.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
get_parent().move_child(background, 0)
var title := Label.new()
title.text = title_text
title.add_theme_font_size_override("font_size", 32)
title.add_theme_color_override("font_color", Color("#ffd293"))
add_child(title)
output = Label.new()
output.custom_minimum_size.y = 151.0
output.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
output.add_theme_font_size_override("font_size", 19)
add_child(output)
func say(message: String) -> void:
output.text = message
func option(label: String, command: Callable) -> void:
var button := Button.new()
button.text = label
button.custom_minimum_size.y = 46.0
button.add_theme_font_size_override("font_size", 19)
button.pressed.connect(command)
add_child(button)
GDScript line by line
Follow the line numbers, including the indent at the start of each line. Find the code the game will run first, then look for the function that reacts when you tap or change something.
Read main.gd line by line
-
extends ControlStarts with Godot's Control type. This script gets the abilities of that type and adds the game's own rules. -
const Lab = preload("res://release_lab.gd")Creates a constant named Lab. The expression prepares a resource at a fixed project path when the script is loaded. -
const TITLE = "Run a real-device cabin trial"Creates a constant named TITLE. The expression uses the text inside the quotes. -
var ui: VBoxContainerDeclares ui for later use. A colon followed by a type says which kind of value belongs here. -
func _ready() -> void:Godot calls this once after the scene and its children are ready. Use it to set up the room and connect controls. -
ui = VBoxContainer.new()Stores the new value in ui. The expression creates a new VBoxContainer object. -
ui.set_script(Lab)Calls ui.set_script with the values in its parentheses. -
add_child(ui)Adds the new node to the scene tree so that Godot can run and draw it. -
ui.start(TITLE)Calls ui.start with the values in its parentheses. -
build()Calls build with the values in its parentheses. -
var entries: Array[Dictionary] = []Creates a variable named entries. The expression makes a list whose items keep their order. The type after the colon says what kind of value it can hold. -
func build() -> void:Defines build, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect. -
ui.say("Measure the visible game, then log two fictional test cases.")Calls ui.say with the values in its parentheses. -
ui.option("Measure the viewport", dimensions)Calls ui.option with the values in its parentheses. -
ui.option("Log a tray tap pass", record.bind("Deliver water at row 2", "Served 2A", "Served 2A"))Calls ui.option with the values in its parentheses. -
ui.option("Log a resume miss", record.bind("Return to the cabin view", "Row 4", "Row 0"))Calls ui.option with the values in its parentheses. -
func dimensions() -> void:Defines dimensions, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect. -
var viewport_size := get_viewport_rect().sizeCreates a variable named viewport_size. The expression reads the game view's rectangle, which can change when the window changes. Godot infers the type from the first value. -
ui.say("Game viewport: %d × %d." % [viewport_size.x, viewport_size.y])Calls ui.say with the values in its parentheses. -
func record(step: String, expected: String, observed: String) -> void:Defines record, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect. -
entries.append({"step": step, "expected": expected, "observed": observed})Adds an item to the end of a list. -
var misses := 0Creates a variable named misses. The expression uses the whole number 0. Godot infers the type from the first value. -
for item in entries:Repeats the indented instructions for each value in entries. -
if item.expected != item.observed:Checks item.expected != item.observed. The indented instructions below run only if this test passes. -
misses += 1Reads misses, adds to its old value, then stores the result back in the same place. -
ui.say("{step}\nExpected: {expected} / observed: {observed}\nReports: {count}. To retest: {misses}.".format({Calls ui.say with the values in its parentheses. -
"step": step, "expected": expected, "observed": observed,Continues the same instruction on a new line. This is one of the arguments, data entries or expressions started above. -
"count": entries.size(), "misses": missesContinues the same instruction on a new line. This is one of the arguments, data entries or expressions started above. -
}))Continues the same instruction on a new line. This is one of the arguments, data entries or expressions started above.
Read release_lab.gd line by line
-
extends VBoxContainerStarts with Godot's VBoxContainer type. This script gets the abilities of that type and adds the game's own rules. -
var output: LabelDeclares output for later use. A colon followed by a type says which kind of value belongs here. -
func start(title_text: String) -> void:Defines start, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect. -
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)Positions this Control relative to the bounds of its parent. -
offset_left = 32.0Stores the new value in offset_left. The expression reads 32.0. -
offset_top = 28.0Stores the new value in offset_top. The expression reads 28.0. -
offset_right = -32.0Stores the new value in offset_right. The expression reads -32.0. -
offset_bottom = -28.0Stores the new value in offset_bottom. The expression reads -28.0. -
add_theme_constant_override("separation", 12)Calls add_theme_constant_override with the values in its parentheses. -
var background := ColorRect.new()Creates a variable named background. The expression creates a new ColorRect object. Godot infers the type from the first value. -
background.color = Color("#14283d")Stores the new value in background.color. The expression builds a colour from these values. -
background.mouse_filter = Control.MOUSE_FILTER_IGNOREUpdates background.mouse_filter, which controls how this control participates in pointer and touch input. The expression reads Control.MOUSE_FILTER_IGNORE. -
get_parent().add_child(background)Calls get_parent with the values in its parentheses. -
background.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)Positions this Control relative to the bounds of its parent. -
get_parent().move_child(background, 0)Calls get_parent with the values in its parentheses. -
var title := Label.new()Creates a variable named title. The expression creates a new Label object. Godot infers the type from the first value. -
title.text = title_textUpdates title.text, which controls the words a player sees. The expression reads title_text. -
title.add_theme_font_size_override("font_size", 32)Calls title.add_theme_font_size_override with the values in its parentheses. -
title.add_theme_color_override("font_color", Color("#ffd293"))Calls title.add_theme_color_override with the values in its parentheses. -
add_child(title)Adds the new node to the scene tree so that Godot can run and draw it. -
output = Label.new()Stores the new value in output. The expression creates a new Label object. -
output.custom_minimum_size.y = 151.0Stores the new value in output.custom_minimum_size.y. The expression reads 151.0. -
output.autowrap_mode = TextServer.AUTOWRAP_WORD_SMARTStores the new value in output.autowrap_mode. The expression reads TextServer.AUTOWRAP_WORD_SMART. -
output.add_theme_font_size_override("font_size", 19)Calls output.add_theme_font_size_override with the values in its parentheses. -
add_child(output)Adds the new node to the scene tree so that Godot can run and draw it. -
func say(message: String) -> void:Defines say, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect. -
output.text = messageUpdates output.text, which controls the words a player sees. The expression reads message. -
func option(label: String, command: Callable) -> void:Defines option, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect. -
var button := Button.new()Creates a variable named button. The expression creates a new Button object. Godot infers the type from the first value. -
button.text = labelUpdates button.text, which controls the words a player sees. The expression reads label. -
button.custom_minimum_size.y = 46.0Stores the new value in button.custom_minimum_size.y. The expression reads 46.0. -
button.add_theme_font_size_override("font_size", 19)Calls button.add_theme_font_size_override with the values in its parentheses. -
button.pressed.connect(command)Links a signal to the function that should run when the event happens. -
add_child(button)Adds the new node to the scene tree so that Godot can run and draw it.
Find and fix a bug
If the report says two misses after one tap, check how many signals were connected and whether the button was pressed twice.
Try a change
Ages 10–12. Record one pass and one unexpected result. Ages 13–16. Test first launch, background/foreground and reduced device volume on two different devices.