add two new tests for regressions reported by @smallsco

This commit is contained in:
Jeff Epler 2025-08-10 18:57:44 -05:00
parent 0f5f932df0
commit 82c617a259
6 changed files with 58 additions and 1 deletions

View file

@ -2,6 +2,14 @@
name: Byte
type: uint8_t
- typedef:
name: Ptr
type: char*
- typedef:
name: LONGINT
type: int32_t
- typedef:
name: INTEGER
type: int16_t
@ -75,6 +83,8 @@
- pyverbatim:
typedef_content: |
typedef void *Ptr;
typedef struct {
INTEGER top, left, bottom, right;
} Rect;
@ -117,14 +127,22 @@
return &result;
}
static void ShowWindow(WindowPtr w) {
mp_printf(&mp_plat_print, "ShowWindow(w@%p)\n", w);
}
static void PtToAngle(const Rect *r, Point p, INTEGER *angle) {
mp_printf(&mp_plat_print, "PtToAngle(rect@%p, p={%d,%d}, angle@%p\n", r, p.h, p.v, angle);
mp_printf(&mp_plat_print, "PtToAngle(rect@%p, p={%d,%d}, angle@%p)\n", r, p.h, p.v, angle);
*angle = 314;
}
static INTEGER GetWinDevice(WindowPtr w) {
return w->device;
}
static void TETextBox(char *p, uint32_t ln, const Rect *r, int j) {
mp_printf(&mp_plat_print, "TETextBox(p[ln=%d]=%.*s, r@%p, j=%d\n", ln, ln, p, r, j);
}
- function:
name: NewRgn
return: RgnHandle
@ -165,3 +183,26 @@
args:
- name: w
type: WindowPtr
- function:
name: ShowWindow
args:
- name: w
type: WindowPtr
trap: 0xA915
executor: C_
- function:
name: TETextBox
args:
- name: p
type: Ptr
- name: ln
type: LONGINT
- name: r
type: const Rect*
- name: j
type: INTEGER
trap: 0xA9CE
executor: C_

4
tests/extmod/mkapi2.py Normal file
View file

@ -0,0 +1,4 @@
import mkapitest
w = mkapitest.NewWindow()
mkapitest.ShowWindow(w)

View file

@ -0,0 +1 @@
ShowWindow(w@\[0-9a-f\]\*)

7
tests/extmod/mkapi3.py Normal file
View file

@ -0,0 +1,7 @@
import mkapitest as mactypes
import mkapitest as textedit
teJustCenter = 1
textRect = mactypes.Rect(135, 10, 270, 487)
text = bytearray(b"\n".join([b"Hello, World", b"This is another line"]))
textedit.TETextBox(text, len(text), textRect, teJustCenter)

View file

@ -0,0 +1,2 @@
TETextBox(p[ln=33]=Hello, World
This is another line, r@\[0-9a-f\]\*, j=1

View file

@ -358,6 +358,8 @@ special_tests = [
"thread/thread_exc2.py",
"ports/esp32/partition_ota.py",
"extmod/mkapi.py",
"extmod/mkapi2.py",
"extmod/mkapi3.py",
)
]