KItemListKeyboardSearchManager and QApplication::keyboardInputInterval()

Peter Penz peter.penz19 at gmail.com
Wed Mar 28 20:24:18 BST 2012


Hi Frank,

On 03/28/2012 07:46 PM, Frank Reininghaus wrote:
[...]
>> Sounds good!
>
> thanks, I did this now [1]. The only downside is that the unit test,
> which checks that the search is cancelled when nothing happens during
> the timeout, now takes more than 5 seconds to complete, which is a
> waste of time IMHO - I run the tests quite often, and I hope that I'm
> not the only one :-)

I probably cannot compete with your number of runs, but I also think 
needing to wait 5 seconds would be way too long ;-)

> There are two ways out of this:
>
> a) Remove that part of the test.
> b) Add some API to set KItemListKeyboardSearchManager's timeout to a
> custom value (initialised to 5000 ms in the constructor), which the
> unit test would then make quite small.
>
> In spite of the added complexity, b) seems better from a testing point
> of view, and it would also make it clear that a timeout exists when
> looking at the header file only. Any objections?

I fully agree to b) and to write classes in a way that they are well 
testable with unit-tests. I initially thought about making the 
timeout-setter private being accessible only by the unit-test. But as 
you say the interface also makes clear that there is a timeout. So 
making this public is fine for me (even if in Dolphin we rely only on 
the default setting).

Thanks,
Peter

>
> Cheers,
> Frank
>
> [1] http://quickgit.kde.org/?p=kde-baseapps.git&a=commit&h=02eab49b2de51c31fe46a0d9501327b579b3648e





More information about the kfm-devel mailing list