~tpeeters/ubuntu-ui-toolkit/arrows

« back to all changes in this revision

Viewing changes to tests/unit/components/tst_action.qml

  • Committer: Tim Peeters
  • Date: 2016-09-12 09:06:53 UTC
  • mfrom: (2085.1.10 staging)
  • Revision ID: tim.peeters@canonical.com-20160912090653-l07yk6keb10jhbt5
sync staging

Show diffs side-by-side

added added

removed removed

Lines of Context:
342
342
         }
343
343
     }
344
344
 
 
345
     QtObject {
 
346
         id: styleProperties
 
347
         property string iconName: "contact"
 
348
         property string iconSource
 
349
     }
 
350
     Action {
 
351
         id: actionWithPropertiesFromStyle
 
352
         iconName: styleProperties.iconName
 
353
         iconSource: styleProperties.iconSource
 
354
         property int numIconSourceChanged: 0
 
355
         onIconSourceChanged: numIconSourceChanged++
 
356
     }
 
357
     function test_icon_name_and_source_from_style_bug1616858() {
 
358
         compare(actionWithPropertiesFromStyle.iconName, "contact",
 
359
                 "iconName not properly copied from style.");
 
360
         compare(actionWithPropertiesFromStyle.iconSource, "image://theme/contact",
 
361
                 "iconSource not properly set with an undefined iconSource from style.");
 
362
         compare(actionWithPropertiesFromStyle.numIconSourceChanged, 1,
 
363
                 "iconSource did not update exactly once.");
 
364
         var newIconSource = Qt.resolvedUrl("../../../examples/ubuntu-ui-toolkit-gallery/small_avatar.png")
 
365
         styleProperties.iconSource = newIconSource;
 
366
         compare(actionWithPropertiesFromStyle.iconSource, newIconSource,
 
367
                 "Failed to update iconSource from style properly.");
 
368
         compare(actionWithPropertiesFromStyle.numIconSourceChanged, 2,
 
369
                 "Incorrect number of updates to icon source.");
 
370
     }
345
371
}