You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Docs/Documentation.md
+49-10Lines changed: 49 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,12 @@
1
1
# 📚 Documentation
2
2
3
-
This is the official and up-to-date documentation for the **GameMaker's Testing Library**. Here you will find all the information you need to start using the library in your projects.
3
+
This is the offline version of the official and up-to-date documentation for the **GameMaker's Testing Library**. Here you will find all the information you need to start using the library in your projects.
4
4
5
5
---
6
6
7
7
## 📖 Table of Contents
8
8
9
+
-[Definitions](#definitions)
9
10
-[Setup](#setup)
10
11
-[suite](#suite)
11
12
-[describe / section](#describe)
@@ -21,7 +22,7 @@ This is the official and up-to-date documentation for the **GameMaker's Testing
21
22
-[afterAll](#afterall)
22
23
-[Common Matchers](#common-matchers)
23
24
-[toBe](#tobe)
24
-
-[toEqual](#toequal)
25
+
-[toBeEqual](#tobeequal)
25
26
-[toContain](#tocontain)
26
27
-[toHaveLength](#tohavelength)
27
28
-[toHaveProperty](#tohaveproperty)
@@ -50,6 +51,24 @@ This is the official and up-to-date documentation for the **GameMaker's Testing
> Definitions were added in v1.1.0 to allow users to configure the library's behavior without modifying the library's code directly. Previous versions of the library do not have this feature so this section would not apply to them.
63
+
64
+
Here you will find some of the definitions that are user editable for the GameMaker's Testing Library. These are used to configure some of the library and its behavior.
65
+
66
+
You can find and change these definitions in the `Libraries/GMTL/Setup/GMTL_definitions` script file inside the library. Here's the table of definitions you can edit in that file:
| gmtl_run_at_start | Run GMTL tests at game start. | true |
71
+
| gmtl_wait_frames_before_start | Frames to wait before start running GMTL suites. | 10 |
53
72
54
73
---
55
74
@@ -88,8 +107,7 @@ Sections are used to group tests together. They can contain tests but not other
88
107
89
108
`test(name, callback)` _or_ `it(name, callback)`
90
109
91
-
> [!IMPORTANT]
92
-
> `test` and `it` are the same function. You can use either of them to create a new test. They are used to create a new test inside a section. You cannot nest tests inside other tests. Tests should always be inside a section.
110
+
> [!IMPORTANT] > `test` and `it` are the same function. You can use either of them to create a new test. They are used to create a new test inside a section. You cannot nest tests inside other tests. Tests should always be inside a section.
93
111
94
112
Tests are used to test a specific piece of code. They should be small and focused on a single aspect of your code. You can put a test in any section and it is recommended to have multiple tests per section to test different parts of your code.
95
113
@@ -260,13 +278,13 @@ Here you will find all the matchers you can use after the `expect` function to m
260
278
261
279
`toBe(expected)`
262
280
263
-
The `toBe` matcher is used to compare the actual value with the expected value using the `==` operator. This matcher will check if the actual value is the same as the expected value. It will throw an error if they are not the same. This matcher is used to compare primitive values like numbers, strings, ref index, and booleans, and can accept arrays, but not structs. For structs, you can use the `toEqual` matcher.
281
+
The `toBe` matcher is used to compare the actual value with the expected value using the `==` operator. This matcher will check if the actual value is the same as the expected value. It will throw an error if they are not the same. This matcher is used to compare primitive values like numbers, strings, ref index, and booleans, and can accept arrays, but not structs. For structs, you can use the `toBeEqual` matcher.
264
282
265
-
### toEqual
283
+
### toBeEqual
266
284
267
-
`toEqual(expected)`
285
+
`toBeEqual(expected)`
268
286
269
-
The `toEqual` matcher is used to compare the actual value with the expected value using the `==` operator. This matcher will check if the actual value is the same as the expected value. It will throw an error if they are not the same. This matcher is used to compare primitive values like numbers, strings, ref index, and booleans, and can accept arrays and structs.
287
+
The `toBeEqual` matcher is used to compare the actual value with the expected value using the `==` operator. This matcher will check if the actual value is the same as the expected value. It will throw an error if they are not the same. This matcher is used to compare primitive values like numbers, strings, ref index, and booleans, and can accept arrays and structs.
270
288
271
289
### toContain
272
290
@@ -385,7 +403,7 @@ The `create` function is used to create an instance of an object at a specific p
385
403
Example:
386
404
387
405
```gml
388
-
suite("Mfunction() {
406
+
suite(function() {
389
407
section("My Section", function() {
390
408
test("My Test", function() {
391
409
var _obj = create(0, 0, obj_player);
@@ -461,7 +479,7 @@ The `simulateMousePosition` function is used to simulate a mouse position event.
461
479
`simulateFrameWait([frames])`
462
480
463
481
> [!IMPORTANT]
464
-
> This function simulates frames passing by executing the step events of the objects, the frames are not actually rendered by GameMaker.
482
+
> This function simulates frames passing by executing timesources/call_later, the step events of the objects, the frames are not actually rendered by GameMaker.
465
483
466
484
The `simulateFrameWait` function is used to simulate a frame wait event. This function will wait for the specified number of virtual frames before continuing. You can pass an optional number of frames to the function to wait for a specific number of frames. If no frames are specified, it will wait for one frame.
467
485
@@ -470,3 +488,24 @@ The `simulateFrameWait` function is used to simulate a frame wait event. This fu
The `simulateEvent` function is used to simulate an event for an object. This function will simulate an event for the specified object. You can pass an object id, an event id, and an optional instance id to the function to simulate an event for the specified object. The event type and number should be theones described in the manual like `ev_create`, `ev_step`, etc. The instance id should be an instance id, if no instance id is specified, it will simulate the event for all instances currently active.
`simulateTimesource(parent, period, unit, callback, [args], [repetitions], [expiry])`
495
+
496
+
The `simulateTimesource` function is used to simulate a [timesource](https://manual.gamemaker.io/lts/en/GameMaker_Language/GML_Reference/Time_Sources/Time_Sources.htm). This function takes the exact same parameters than a GameMaker native timesource, but it will not actually create a timesource, it will just virtually simulate the event. This is useful when you want to test pseudo-async events like a custom garbage collector or waiting some frames for an event to happen.
497
+
498
+
This function creates a constructor that will be used to simulate the timesource and has 2 methods to call for it to work: `.start()` that mimics the behaviour of [time_source_start()](https://manual.gamemaker.io/lts/en/GameMaker_Language/GML_Reference/Time_Sources/time_source_start.htm), and `.stop()` that mimics the behaviour of [time_source_stop()](https://manual.gamemaker.io/lts/en/GameMaker_Language/GML_Reference/Time_Sources/time_source_stop.htm).
499
+
500
+
**If you want to strictly call the GameMaker's built-in functions you can use `original_time_source_create()`, `original_time_source_start()`, etc**
> Since the original GameMaker's `call_later()` function works behind the scenes with a timesource, this function is basically a wrapper for the `simulateTimesource` function too.
The `simulateCallLater` function is used to simulate a [call_later()](https://manual.gamemaker.io/lts/en/GameMaker_Language/GML_Reference/Time_Sources/call_later.htm) event. This function will simulate a call later event for the specified callback. You can pass a callback, an optional array of arguments, an optional number of repetitions, and an optional loop flag to the function to simulate a call later event. The callback will be called after the specified number of frames.
510
+
511
+
**If you want to strictly call the GameMaker's built-in function you can use `original_call_later()` directly in your code.**
Copy file name to clipboardExpand all lines: Docs/Home.md
+13-14Lines changed: 13 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -17,24 +17,23 @@
17
17
18
18
## 🔧 Versioning & Compatibility
19
19
20
-
The minimum version of GameMaker required to use this library is **GameMaker 2023.4**. This is because it uses the _string templates_ and _string functions_ introduced in that version and previous like `string_split()`. The library is fully compatible with the latest version of GameMaker 2024.x.
20
+
The minimum version of GameMaker required to use this library is **GameMaker 2023.4**. This is because it uses the _string templates_ and _string functions_ introduced in that version like the `string_split()` function. The library should be fully compatible with the latest version of GameMaker 2024.x.
21
21
22
22
✅: Fully compatible. (\*: Recommended for this version.)
23
23
24
24
⚠️: Compatible but could have some issues with the new features of the version or built-in functions.
25
25
26
26
❌: Not compatible.
27
27
28
-
| GameMaker Version | GMTL v1.0.x |
29
-
| ----------------: | :---------: |
30
-
| Studio 1.4.x | ❌ |
31
-
| Studio 2 - 2.2 | ❌ |
32
-
| Studio 2.3.x | ❌ |
33
-
| 2022.x & 2022 LTS | ❌ |
34
-
| 2023.1 - 2023.3 | ⚠️ |
35
-
| 2023.4 - 2023.11 | ✅ |
36
-
| 2023 LTS | ✅ |
37
-
| 2024.x | ✅\*|
38
-
39
-
> [!NOTE]
40
-
> **Author's comment:** Depending if anyone is interested in using this library with older versions of GameMaker, I could make a version compatible up to **GameMaker Studio 2.3.7** as I did with the compatibility update in the [**GML-Extended**](https://github.com/DAndrewBox/GML-Extended/) library.
28
+
| GameMaker Version | GMTL v1.0.x | GMTL v1.1.x |
29
+
| ----------------: | :---------: | :---------: |
30
+
| Studio 1.4.x | ❌ | ❌ |
31
+
| Studio 2 - 2.2 | ❌ | ❌ |
32
+
| Studio 2.3.x | ❌ | ❌ |
33
+
| 2022.x & 2022 LTS | ❌ | ❌ |
34
+
| 2023.1 - 2023.3 | ⚠️ | ❌ |
35
+
| 2023.4 - 2023.11 | ✅ | ✅ |
36
+
| 2023 LTS | ✅ | ✅ |
37
+
| 2024.x / 2024 LTS | ✅\*| ✅\*|
38
+
39
+
> [!NOTE] > **Author's comment:** Depending if anyone is interested in using this library with older versions of GameMaker, I could make a version compatible up to **GameMaker Studio 2.3.7** as I did with the compatibility update in the [**GML-Extended**](https://github.com/DAndrewBox/GML-Extended/) library.
Copy file name to clipboardExpand all lines: Docs/Troubleshooting.md
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -27,3 +27,11 @@ This issue can be caused by the library's scripts not being found in the project
27
27
This error is caused by the library not being found in the project. To fix this, you need to add the library to the project. You can do this by following the installation instructions in the [**Getting Started**](./Getting-Started) section.
28
28
29
29
---
30
+
31
+
### GMTL_Definitions script file empty after importing in blank project
32
+
33
+
This issue should be solved since v1.1.0, but if you still encounter it, you can manually copy the contents of the `GMTL_Definitions` script file from the [library's repository](https://github.com/DAndrewBox/GM-Testing-Library/blob/main/GM-Testing-Library/scripts/GMTL_definitions/GMTL_definitions.gml) into your project. This file contains the definitions for the library's functions and is essential for the library to work correctly.
34
+
35
+
I'm not really sure what causes this issue, but it seems to be related to the import process of the library that GameMaker does. If you encounter this issue, please [create an issue](https://github.com/DAndrewBox/GM-Testing-Library/issues) so I can investigate it further.
0 commit comments