mocking kcontrol infrastructure for quick kontrol module test

Matthias Kretz kretz at kde.org
Sun Aug 27 20:02:18 BST 2006


On Sunday 27 August 2006 18:45, Andriy Rysin wrote:
> Can somebody tell me how that could be done with new KGenericFactory
> approach?
>  If I just change to LayoutConfig(window, emptyStringList) it asserts in
> kcmodule.cpp

That's because the LayoutConfig ctor passes LayoutConfigFactory::instance() to 
the KCModule ctor for the KInstance pointer (which of course is 0 as 
LayoutConfigFactory was not created).

The correct way to do it, of course, is to use KCModuleLoader from libkutils. 
You should also be able to do it using KLibLoader. How you do it without 
having to link your application against a plugin (i.e. not a shared lib) I 
don't know for certain (perhaps I don't want to know), but you could try to 
call the init_keyboard_layout method which returns a LayoutConfigFactory 
which in turn will create an instance of LayoutConfig for you.

-- 
C'ya
        Matthias
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060827/5e1f8b91/attachment.sig>


More information about the kde-core-devel mailing list