@@ -426,6 +426,11 @@ mod ext_trait {
426426 glib:: Object :: builder ( ) . build ( )
427427 }
428428 }
429+ impl Default for Author {
430+ fn default ( ) -> Self {
431+ Self :: new ( )
432+ }
433+ }
429434}
430435
431436#[ test]
@@ -438,66 +443,65 @@ fn ext_trait() {
438443 assert_eq ! ( AuthorPropertiesExt :: lastname( & author) , "Doe" ) ;
439444}
440445
441- #[ cfg( test) ]
442- mod kw_names {
443- mod imp {
444-
445- use glib:: subclass:: object:: DerivedObjectProperties ;
446- use glib:: ObjectExt ;
447- use std:: cell:: Cell ;
448-
449- use glib:: subclass:: { prelude:: ObjectImpl , types:: ObjectSubclass } ;
450- use glib_macros:: Properties ;
451-
452- #[ derive( Properties , Default ) ]
453- #[ properties( wrapper_type = super :: KwNames ) ]
454- pub struct KwNames {
455- // Some of the strict keywords
456- #[ property( get, set) ]
457- r#loop : Cell < u8 > ,
458- #[ property( get, set) ]
459- r#move : Cell < u8 > ,
460- #[ property( get, set) ]
461- r#type : Cell < u8 > ,
462-
463- // Lexer 2018+ strict keywords
464- #[ property( get, set) ]
465- r#async : Cell < u8 > ,
466- #[ property( get, set) ]
467- r#await : Cell < u8 > ,
468- #[ property( get, set) ]
469- r#dyn : Cell < u8 > ,
446+ #[ test]
447+ fn keyword_propnames ( ) {
448+ mod kw_names {
449+ mod imp {
450+
451+ use glib:: subclass:: object:: DerivedObjectProperties ;
452+ use glib:: ObjectExt ;
453+ use std:: cell:: Cell ;
454+
455+ use glib:: subclass:: { prelude:: ObjectImpl , types:: ObjectSubclass } ;
456+ use glib_macros:: Properties ;
457+
458+ #[ derive( Properties , Default ) ]
459+ #[ properties( wrapper_type = super :: KwNames ) ]
460+ pub struct KwNames {
461+ // Some of the strict keywords
462+ #[ property( get, set) ]
463+ r#loop : Cell < u8 > ,
464+ #[ property( get, set) ]
465+ r#move : Cell < u8 > ,
466+ #[ property( get, set) ]
467+ r#type : Cell < u8 > ,
468+
469+ // Lexer 2018+ strict keywords
470+ #[ property( get, set) ]
471+ r#async : Cell < u8 > ,
472+ #[ property( get, set) ]
473+ r#await : Cell < u8 > ,
474+ #[ property( get, set) ]
475+ r#dyn : Cell < u8 > ,
476+
477+ // Some of the reserved keywords
478+ #[ property( get, set) ]
479+ r#become : Cell < u8 > ,
480+ #[ property( get, set) ]
481+ r#macro : Cell < u8 > ,
482+ #[ property( get, set) ]
483+ r#unsized : Cell < u8 > ,
484+
485+ // Lexer 2018+ reserved keywords
486+ #[ property( get, set) ]
487+ r#try : Cell < u8 > ,
488+ }
470489
471- // Some of the reserved keywords
472- #[ property( get, set) ]
473- r#become : Cell < u8 > ,
474- #[ property( get, set) ]
475- r#macro : Cell < u8 > ,
476- #[ property( get, set) ]
477- r#unsized : Cell < u8 > ,
490+ #[ glib:: object_subclass]
491+ impl ObjectSubclass for KwNames {
492+ const NAME : & ' static str = "MyKwNames" ;
493+ type Type = super :: KwNames ;
494+ }
478495
479- // Lexer 2018+ reserved keywords
480- #[ property( get, set) ]
481- r#try : Cell < u8 > ,
496+ #[ glib:: derived_properties]
497+ impl ObjectImpl for KwNames { }
482498 }
483499
484- #[ glib:: object_subclass]
485- impl ObjectSubclass for KwNames {
486- const NAME : & ' static str = "MyKwNames" ;
487- type Type = super :: KwNames ;
500+ glib:: wrapper! {
501+ pub struct KwNames ( ObjectSubclass <imp:: KwNames >) ;
488502 }
489-
490- #[ glib:: derived_properties]
491- impl ObjectImpl for KwNames { }
492503 }
493504
494- glib:: wrapper! {
495- pub struct KwNames ( ObjectSubclass <imp:: KwNames >) ;
496- }
497- }
498-
499- #[ test]
500- fn keyword_propnames ( ) {
501505 let mykwnames: kw_names:: KwNames = glib:: Object :: new ( ) ;
502506
503507 // make sure all 10 properties are registered
0 commit comments