slint icon indicating copy to clipboard operation
slint copied to clipboard

Add support for writing tests that run with all styles

Open tronical opened this issue 1 year ago • 6 comments

Tests under tests/cases/for_each_style are run with all styles at least in the Rust driver.

Amends 6bb9905191e3ac1e63839ce434be55c1c3940e63 to include a test that using edited works.

tronical avatar Feb 08 '24 13:02 tronical

"Should this include the qt style?" is one of the option questions...

tronical avatar Feb 08 '24 13:02 tronical

These tests are needed.

You took a different approach than i would have done. I would have kept the driverlib as is, and made the detection of "for_each_style" (which i would have called "widgets") in the relevant driver. (and let the other drivers that can't do style just do with the default style) But both approach works.

I started out that that as well heh but then it felt dirty to me to just "hack" this in the rust driver. But in the end the "dirty" in the other drivers to ignore it is also there, so not a great result either. I'll go with this for now, but I have no objections against changing this.

tronical avatar Feb 08 '24 16:02 tronical

(which i would have called "widgets")

I thought about this again, and you're right. We already have widgets and then it makes sense that every .slint test file that imports std-widgets.slint is under widgets/ and then we run it with multiple styles. I'll adjust this PR accordingly.

tronical avatar Feb 08 '24 16:02 tronical

So this is one of those differences...

The "other" styles have a TextEdit inside a SpinBox, which responds to the enter key. The Qt spinbox doesn't have that, but it responds to arrow up/down keys.

Who is right?

tronical avatar Feb 08 '24 19:02 tronical

My guts feeling is that the SpinBox should not be editable by default, but that should be controllable via an "editable" boolean property.

I'm not sure this can be supported with Qt though.

tronical avatar Feb 08 '24 19:02 tronical

My guts feeling is that the SpinBox should not be editable by default, but that should be controllable via an "editable" boolean property.

We should follow what the platform does. On Windows it's always editable. The "native" Qt combobox is also always editable it seems.

This is just a bug in our qt style for which the edition hasn't been implemented.

ogoffart avatar Feb 09 '24 08:02 ogoffart