added tests for gui2.

This commit is contained in:
Martin Preuss
2026-03-23 00:22:21 +01:00
parent 41d60f4331
commit 68624e92e0

View File

@@ -357,7 +357,6 @@ mkTestWindow_ret:
; @end
#if 0
; ---------------------------------------------------------------------------
; @routine mkTestWidgets
;
@@ -366,64 +365,15 @@ mkTestWindow_ret:
; @return Y address of newly created object
mkTestWidgets:
ldi r16, 0 ; OPTS
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
; ldi r20, HLAYOUT_MODE_SPREAD
ldi r20, VLAYOUT_MODE_EXPAND
bigcall VLayout_new
brcc mkTestWidgets_ret
push yl
push yh
mov xl, yl ; use HLayout as parent
mov xh, yh
push xl ; HLayout
push xh
ldi r16, 0
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_IMG_HUMIDITY96)
ldi r21, HIGH(RESSSOURCE_IMG_HUMIDITY96)
bigcall ImageView_new
pop xh
pop xl
brcc mkTestWidgets_popRet
push xl ; HLayout
push xh
ldi r16, 0
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_IMG_CLOUD96)
ldi r21, HIGH(RESSSOURCE_IMG_CLOUD96)
bigcall ImageView_new
pop xh
pop xl
brcc mkTestWidgets_popRet
mkTestWidgets_popRet:
pop yh
pop yl
mkTestWidgets_ret:
ret
; @end
#endif
; ---------------------------------------------------------------------------
; @routine mkTestWidgets
;
; @param X pointer to MainWindow content window (becomes parent)
; @return CFLAG set of okay, cleared otherwise
; @return Y address of newly created object
mkTestWidgets:
ldi r16, 0 ; OPTS
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT) ; OPT
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, HLAYOUT_MODE_COLUMNS
ldi r21, 2
ldi r21, 3
bigcall MLayout_new
brcc mkTestWidgets_ret
sts mLayoutWidget, yl
sts mLayoutWidget+1, yh
; brcc mkTestWidgets_ret
push yl
push yh
@@ -432,49 +382,84 @@ mkTestWidgets:
push xl ; MLayout
push xh
ldi r16, 0
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT)
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_IMG_HUMIDITY)
ldi r21, HIGH(RESSSOURCE_IMG_HUMIDITY)
bigcall ImageView_new
ldi r20, LOW(RESSSOURCE_TXT_KITCHEN)
ldi r21, HIGH(RESSSOURCE_TXT_KITCHEN)
bigcall Label_new
sts widget1, yl
sts widget1+1, yh
pop xh
pop xl
; brcc mkTestWidgets_popRet
push xl ; MLayout
push xh
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT)
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_TXT_CORRIDOR)
ldi r21, HIGH(RESSSOURCE_TXT_CORRIDOR)
bigcall Label_new
sts widget2, yl
sts widget2+1, yh
pop xh
pop xl
brcc mkTestWidgets_popRet
push xl ; MLayout
push xh
ldi r16, 0
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT)
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_IMG_CLOUD)
ldi r21, HIGH(RESSSOURCE_IMG_CLOUD)
bigcall ImageView_new
pop xh
pop xl
brcc mkTestWidgets_popRet
#if 0
push xl ; MLayout
push xh
ldi r16, 0
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_IMG_HUMIDITY)
ldi r21, HIGH(RESSSOURCE_IMG_HUMIDITY)
bigcall ImageView_new
ldi r20, LOW(RESSSOURCE_TXT_TEMP_S)
ldi r21, HIGH(RESSSOURCE_TXT_TEMP_S)
bigcall Label_new
sts widget3, yl
sts widget3+1, yh
pop xh
pop xl
brcc mkTestWidgets_popRet
push xl ; MLayout
push xh
ldi r16, 0
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT)
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_IMG_LIGHT)
ldi r21, HIGH(RESSSOURCE_IMG_LIGHT)
bigcall ImageView_new
ldi r20, LOW(RESSSOURCE_TXT_BATHROOM)
ldi r21, HIGH(RESSSOURCE_TXT_BATHROOM)
bigcall Label_new
sts widget4, yl
sts widget4+1, yh
pop xh
pop xl
brcc mkTestWidgets_popRet
#endif
push xl ; MLayout
push xh
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT)
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_TXT_CELLAR)
ldi r21, HIGH(RESSSOURCE_TXT_CELLAR)
bigcall Label_new
sts widget5, yl
sts widget5+1, yh
pop xh
pop xl
brcc mkTestWidgets_popRet
push xl ; MLayout
push xh
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT)
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_TXT_CO2_S)
ldi r21, HIGH(RESSSOURCE_TXT_CO2_S)
bigcall Label_new
sts widget6, yl
sts widget6+1, yh
pop xh
pop xl
brcc mkTestWidgets_popRet
; rcall testMLayout
; sec
mkTestWidgets_popRet:
pop yh
@@ -514,6 +499,50 @@ mkSimpleTestWidgets_ret:
testMLayout:
lds yl, widget1
lds yh, widget1+1
clr r20
ldi r25, 3
ldi zl, LOW(testMLayout_cb)
ldi zh, HIGH(testMLayout_cb)
bigcall mLayoutForEveryObjectSkipped
; bigcall mLayoutForEveryObjectContiguous
ret
testMLayout_cb:
cpi r20, 0
breq testMLayout_cb0
cpi r20, 1
breq testMLayout_cb1
rjmp testMLayout_end
bigjmp DEBUG3
testMLayout_cb0:
lds r18, widget1
lds r19, widget1+1
cp yl, r18
brne testMLayout_error1
cp yh, r19
brne testMLayout_error1
rjmp testMLayout_end
testMLayout_cb1:
lds r18, widget4
lds r19, widget4+1
cp yl, r18
brne testMLayout_error2
cp yh, r19
brne testMLayout_error2
rjmp testMLayout_end
testMLayout_error1:
bigjmp DEBUG1
testMLayout_error2:
bigjmp DEBUG4
testMLayout_end:
inc r20
clc
ret
@@ -554,7 +583,7 @@ GUI2_MODULE_BEGIN:
.include "modules/lcd2/gui2/base/layout.asm"
.include "modules/lcd2/gui2/base/hlayout.asm"
.include "modules/lcd2/gui2/base/vlayout.asm"
.include "modules/lcd2/gui2/base/mlayout.asm"
.include "modules/lcd2/gui2/base/mlayout2.asm"
.include "modules/lcd2/gui2/base/mlayout_column.asm"
.include "modules/lcd2/gui2/base/guiapp.asm"
.include "modules/lcd2/gui2/base/mainwindow.asm"
@@ -589,6 +618,13 @@ guiApp: .byte 2
; debug
rootWindow: .byte 2
mainWin1: .byte 2
mLayoutWidget: .byte 2
widget1: .byte 2
widget2: .byte 2
widget3: .byte 2
widget4: .byte 2
widget5: .byte 2
widget6: .byte 2
heapStart: