Skip to content

Commit

Permalink
Rework testing infrastructure.
Browse files Browse the repository at this point in the history
  • Loading branch information
CensoredUsername committed Feb 22, 2024
1 parent e1e6bf2 commit 7cd1b63
Show file tree
Hide file tree
Showing 90 changed files with 18,569 additions and 47 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/python-app.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test build and run tests
name: Build and test status

on:
push:
Expand All @@ -24,8 +24,8 @@ jobs:
python-version: "3.12"
- name: Test by decompiling a script and building un.rpyc
run: |
./unrpyc.py --clobber testcases/script.rpyc
diff -u testcases/script.orig.rpy testcases/script.rpy
./unrpyc.py --clobber --init-offset "testcases/compiled/**/*.rpyc"
diff -ur testcases/expected testcases/compiled -x "*.rpyc"
cd un.rpyc;
./compile.py -p 1
cd ..
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
unrpyc.sublime-*

!testcases/originals/**/*.rpy
!testcases/expected/**/*.rpy
!testcases/compiled/**/*.rpyc
5 changes: 0 additions & 5 deletions testcases/.gitignore

This file was deleted.

11 changes: 11 additions & 0 deletions testcases/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
The folders in this folder contain the following items:

* `originals`: contains several original .rpy files to be used in for testing the decompiler
* `compiled`: contains the compiled `.rpyc` files corresponding to the files in `originals`
* `expected`: contains the expected output of decompiling the `.rpyc` files to `.rpy` files

The contents in `expected` have been manually verified to match `originals`, as `.rpyc` files unfortunately do not contain enough data to reconstruct the original file perfectly.

To make this verification easier, a test script (`validate_expected.py`) has been provided that strips out comments and empty lines. Running it with the --update option will cause it to update the `expected` folder with decompiled `.rpy` files found in the `compiled` folder.

Licenses for the files can be found in the corresponding `originals` folder for each dataset.
Binary file added testcases/compiled/the_question-8.2/gui.rpyc
Binary file not shown.
Binary file added testcases/compiled/the_question-8.2/options.rpyc
Binary file not shown.
Binary file added testcases/compiled/the_question-8.2/screens.rpyc
Binary file not shown.
Binary file added testcases/compiled/the_question-8.2/script.rpyc
Binary file not shown.
Binary file not shown.
Binary file added testcases/compiled/tutorial-8.2/01example.rpyc
Binary file not shown.
Binary file added testcases/compiled/tutorial-8.2/examples.rpyc
Binary file not shown.
Binary file added testcases/compiled/tutorial-8.2/gui.rpyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added testcases/compiled/tutorial-8.2/indepth_text.rpyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added testcases/compiled/tutorial-8.2/options.rpyc
Binary file not shown.
Binary file added testcases/compiled/tutorial-8.2/screens.rpyc
Binary file not shown.
Binary file added testcases/compiled/tutorial-8.2/script.rpyc
Binary file not shown.
Binary file added testcases/compiled/tutorial-8.2/testcases.rpyc
Binary file not shown.
Binary file added testcases/compiled/tutorial-8.2/tutorial_atl.rpyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
167 changes: 167 additions & 0 deletions testcases/expected/the_question-8.2/gui.rpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
init offset = -2
init python:
gui.init(1280, 720)
define gui.accent_color = '#cc6600'
define gui.idle_color = '#555555'
define gui.idle_small_color = '#aaaaaa'
define gui.hover_color = '#e0a366'
define gui.selected_color = '#ffffff'
define gui.insensitive_color = '#5555557f'
define gui.muted_color = '#512800'
define gui.hover_muted_color = '#7a3d00'
define gui.text_color = '#ffffff'
define gui.interface_text_color = '#ffffff'
define gui.text_font = "DejaVuSans.ttf"
define gui.name_text_font = "DejaVuSans.ttf"
define gui.interface_text_font = "DejaVuSans.ttf"
define gui.text_size = 22
define gui.name_text_size = 30
define gui.interface_text_size = 24
define gui.label_text_size = 28
define gui.notify_text_size = 16
define gui.title_text_size = 50
define gui.main_menu_background = "gui/main_menu.png"
define gui.game_menu_background = "gui/game_menu.png"
define gui.main_menu_text_color = "#ffaa22"
define gui.textbox_height = 185
define gui.textbox_yalign = 1.0
define gui.name_xpos = 240
define gui.name_ypos = 0
define gui.name_xalign = 0.0
define gui.namebox_width = None
define gui.namebox_height = None
define gui.namebox_borders = Borders(5, 5, 5, 5)
define gui.namebox_tile = False
define gui.dialogue_xpos = 268
define gui.dialogue_ypos = 50
define gui.dialogue_width = 744
define gui.dialogue_text_xalign = 0.0
define gui.button_width = None
define gui.button_height = 36
define gui.button_borders = Borders(4, 4, 4, 4)
define gui.button_tile = False
define gui.button_text_font = gui.interface_text_font
define gui.button_text_size = gui.interface_text_size
define gui.button_text_idle_color = gui.idle_color
define gui.button_text_hover_color = gui.hover_color
define gui.button_text_selected_color = gui.selected_color
define gui.button_text_insensitive_color = gui.insensitive_color
define gui.button_text_xalign = 0.0
define gui.radio_button_borders = Borders(25, 4, 4, 4)
define gui.check_button_borders = Borders(25, 4, 4, 4)
define gui.confirm_button_text_xalign = 0.5
define gui.page_button_borders = Borders(10, 4, 10, 4)
define gui.quick_button_borders = Borders(10, 4, 10, 0)
define gui.quick_button_text_size = 14
define gui.quick_button_text_idle_color = gui.idle_small_color
define gui.quick_button_text_selected_color = gui.accent_color
define gui.choice_button_width = 790
define gui.choice_button_height = None
define gui.choice_button_tile = False
define gui.choice_button_borders = Borders(100, 5, 100, 5)
define gui.choice_button_text_font = gui.text_font
define gui.choice_button_text_size = gui.text_size
define gui.choice_button_text_xalign = 0.5
define gui.choice_button_text_idle_color = "#cccccc"
define gui.choice_button_text_hover_color = "#ffffff"
define gui.slot_button_width = 276
define gui.slot_button_height = 206
define gui.slot_button_borders = Borders(10, 10, 10, 10)
define gui.slot_button_text_size = 14
define gui.slot_button_text_xalign = 0.5
define gui.slot_button_text_idle_color = gui.idle_small_color
define config.thumbnail_width = 256
define config.thumbnail_height = 144
define gui.file_slot_cols = 3
define gui.file_slot_rows = 2
define gui.navigation_xpos = 40
define gui.skip_ypos = 10
define gui.notify_ypos = 45
define gui.choice_spacing = 22
define gui.navigation_spacing = 4
define gui.pref_spacing = 10
define gui.pref_button_spacing = 0
define gui.page_spacing = 0
define gui.slot_spacing = 10
define gui.main_menu_text_xalign = 0.0
define gui.frame_borders = Borders(4, 4, 4, 4)
define gui.confirm_frame_borders = Borders(40, 40, 40, 40)
define gui.skip_frame_borders = Borders(16, 5, 50, 5)
define gui.notify_frame_borders = Borders(16, 5, 40, 5)
define gui.frame_tile = False
define gui.bar_size = 36
define gui.scrollbar_size = 12
define gui.slider_size = 30
define gui.bar_tile = False
define gui.scrollbar_tile = False
define gui.slider_tile = False
define gui.bar_borders = Borders(4, 4, 4, 4)
define gui.scrollbar_borders = Borders(4, 4, 4, 4)
define gui.slider_borders = Borders(4, 4, 4, 4)
define gui.vbar_borders = Borders(4, 4, 4, 4)
define gui.vscrollbar_borders = Borders(4, 4, 4, 4)
define gui.vslider_borders = Borders(4, 4, 4, 4)
define gui.unscrollable = "hide"
define config.history_length = 250
define gui.history_height = 140
define gui.history_name_xpos = 150
define gui.history_name_ypos = 0
define gui.history_name_width = 150
define gui.history_name_xalign = 1.0
define gui.history_text_xpos = 170
define gui.history_text_ypos = 5
define gui.history_text_width = 740
define gui.history_text_xalign = 0.0
define gui.nvl_borders = Borders(0, 10, 0, 20)
define gui.nvl_height = 115
define gui.nvl_spacing = 10
define gui.nvl_name_xpos = 430
define gui.nvl_name_ypos = 0
define gui.nvl_name_width = 150
define gui.nvl_name_xalign = 1.0
define gui.nvl_text_xpos = 450
define gui.nvl_text_ypos = 8
define gui.nvl_text_width = 590
define gui.nvl_text_xalign = 0.0
define gui.nvl_thought_xpos = 240
define gui.nvl_thought_ypos = 0
define gui.nvl_thought_width = 780
define gui.nvl_thought_xalign = 0.0
define gui.nvl_button_xpos = 450
define gui.nvl_button_xalign = 0.0
define gui.language = "unicode"
init python:
@gui.variant
def touch():
gui.quick_button_borders = Borders(40, 14, 40, 0)
@gui.variant
def small():
gui.text_size = 30
gui.name_text_size = 36
gui.notify_text_size = 25
gui.interface_text_size = 36
gui.button_text_size = 34
gui.label_text_size = 36
gui.textbox_height = 240
gui.name_xpos = 80
gui.dialogue_xpos = 90
gui.dialogue_width = 1100
gui.choice_button_width = 1240
gui.navigation_spacing = 20
gui.pref_button_spacing = 10
gui.history_height = 190
gui.history_text_width = 690
gui.file_slot_cols = 2
gui.file_slot_rows = 2
gui.nvl_height = 170
gui.nvl_name_width = 305
gui.nvl_name_xpos = 325
gui.nvl_text_width = 915
gui.nvl_text_xpos = 345
gui.nvl_text_ypos = 5
gui.nvl_thought_width = 1240
gui.nvl_thought_xpos = 20
gui.nvl_button_width = 1240
gui.nvl_button_xpos = 20
gui.quick_button_text_size = 20
# Decompiled by unrpyc: https://github.com/CensoredUsername/unrpyc
39 changes: 39 additions & 0 deletions testcases/expected/the_question-8.2/options.rpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
define config.name = _("The Question")
define gui.show_name = True
define config.version = "7.0"
define gui.about = _("""Character Art: Deji.
Original Character Art: derik.
Background Art: Mugenjohncel.
Original Background Art: DaFool
Music By: Alessio
Written By: mikey""")
define build.name = "the_question"
define build.version = "7.0"
define config.has_sound = True
define config.has_music = True
define config.has_voice = False
define config.enter_transition = dissolve
define config.exit_transition = dissolve
define config.after_load_transition = None
define config.end_game_transition = None
define config.window = "auto"
define config.window_show_transition = Dissolve(.2)
define config.window_hide_transition = Dissolve(.2)
default preferences.text_cps = 0
default preferences.afm_time = 15
define config.save_directory = "the_question-7"
define config.window_icon = "gui/window_icon.png"
init python:
config.searchpath.append(config.renpy_base + "/sdk-fonts")
build.classify_renpy("sdk-fonts/**", "all")
build._sdk_fonts = True
build.classify('**~', None)
build.classify('**.bak', None)
build.classify('**/.**', None)
build.classify('**/#**', None)
build.classify('**/thumbs.db', None)
build.documentation('*.html')
build.documentation('*.txt')
define build.itch_project = "renpytom/the-question"
define config.console = True
# Decompiled by unrpyc: https://github.com/CensoredUsername/unrpyc
Loading

0 comments on commit 7cd1b63

Please sign in to comment.