@@ -126,32 +126,32 @@ fn capitalise_first(str: String) -> String {
126
126
}
127
127
128
128
/// For a given property name generate the getter name
129
- fn getter_name_from_property ( name : & Name ) -> Name {
129
+ pub fn getter_name_from_property ( name : & Name ) -> Name {
130
130
name. clone ( )
131
131
. with_cxx_name ( format ! ( "get{}" , capitalise_first( name. cxx_unqualified( ) ) ) )
132
132
}
133
133
134
134
/// For a given property name generate the setter name
135
- fn setter_name_from_property ( name : & Name ) -> Name {
135
+ pub fn setter_name_from_property ( name : & Name ) -> Name {
136
136
name. clone ( )
137
137
. with_rust_name ( format_ident ! ( "set_{}" , name. rust_unqualified( ) ) )
138
138
. with_cxx_name ( format ! ( "set{}" , capitalise_first( name. cxx_unqualified( ) ) ) )
139
139
}
140
140
141
141
/// For a given property name generate the notify signal name
142
- fn notify_name_from_property ( name : & Name ) -> Name {
142
+ pub fn notify_name_from_property ( name : & Name ) -> Name {
143
143
name. clone ( )
144
144
. with_rust_name ( format_ident ! ( "{}_changed" , name. rust_unqualified( ) ) )
145
145
. with_cxx_name ( format ! ( "{}Changed" , name. cxx_unqualified( ) ) )
146
146
}
147
147
148
148
#[ cfg( test) ]
149
149
pub mod tests {
150
- use syn:: parse_quote;
151
-
152
150
use super :: * ;
153
151
use crate :: parser:: property:: QPropertyFlags ;
154
152
use crate :: parser:: qobject:: ParsedQObject ;
153
+ use crate :: parser:: CaseConversion ;
154
+ use syn:: { parse_quote, ItemStruct } ;
155
155
156
156
pub fn create_i32_qpropertyname ( ) -> QPropertyNames {
157
157
let property = ParsedQProperty {
@@ -167,6 +167,21 @@ pub mod tests {
167
167
. expect ( "Failed to create QPropertyNames" )
168
168
}
169
169
170
+ #[ test]
171
+ fn test_invalid_custom_signal ( ) {
172
+ let input: ItemStruct = parse_quote ! {
173
+ #[ qproperty( T , reused_prop, READ , WRITE , NOTIFY = unknown_signal) ]
174
+ struct MyStruct ;
175
+ } ;
176
+ let property = ParsedQProperty :: parse ( & input. attrs [ 0 ] , CaseConversion :: none ( ) ) . unwrap ( ) ;
177
+
178
+ let obj = ParsedQObject :: mock ( ) ;
179
+
180
+ let structured_qobject = StructuredQObject :: mock ( & obj) ;
181
+ let qproperty_names = QPropertyNames :: try_from_property ( & property, & structured_qobject) ;
182
+ assert ! ( qproperty_names. is_err( ) ) ;
183
+ }
184
+
170
185
#[ test]
171
186
fn test_parsed_property ( ) {
172
187
let names = create_i32_qpropertyname ( ) ;
0 commit comments