Comment 0 for bug 1210260

Revision history for this message
Leo Arias (elopio) wrote :

When using autopilot emulators, we have to name the emulator class the same way as the QML type it represents.
Sometimes, the application will have the same QML type used in really different ways, defining different children to them. For example, an application could have a Bar used once as a bar for the top and once as a bar for the bottom.
In this case we have to put all the methods for the top bar and for the bottom bar on the same Bar emulator.

It would be a lot better if the name of the emulator is not fixed, and we can use something else to select it. What comes to mind after talking with thomi is to select the right emulator based on the attributes it has.

Something like:

class TobBar(BaseEmulator):

    emulator_attributes = {'type': 'Bar', 'objectName': 'top'}

    def top_bar_method(self): ....

class BottomBar(BaseEmulator):

    emulator_attributes = {'type': 'Bar', 'objectName': 'bottom'}

    def bottom_bar_method(self): ....