# -*- coding: utf-8 -*-

def main():
    startApplication("sasview")
    clickButton(waitForObject(":groupBox.cmdLoad_QPushButton"))
    waitForObjectItem(":stackedWidget.listView_QListView", "test")
    doubleClickItem(":stackedWidget.listView_QListView", "test", 32, 11, 0, Qt.LeftButton)
    waitForObjectItem(":stackedWidget.listView_QListView", "2d\\_data")
    doubleClickItem(":stackedWidget.listView_QListView", "2d\\_data", 25, 4, 0, Qt.LeftButton)
    waitForObjectItem(":stackedWidget.listView_QListView", "P123\\_D2O\\_30\\_percent\\.dat")
    doubleClickItem(":stackedWidget.listView_QListView", "P123\\_D2O\\_30\\_percent\\.dat", 97, 5, 0, Qt.LeftButton)
    waitForObjectItem(":groupBox.treeView_QTreeView", "P123\\_D2O\\_30\\_percent\\.dat")
    clickItem(":groupBox.treeView_QTreeView", "P123\\_D2O\\_30\\_percent\\.dat", -10, 10, 0, Qt.LeftButton)
    waitForObjectItem(":groupBox.treeView_QTreeView", "P123\\_D2O\\_30\\_percent\\.dat.Info")
    clickItem(":groupBox.treeView_QTreeView", "P123\\_D2O\\_30\\_percent\\.dat.Info", -4, 6, 0, Qt.LeftButton)
    test.compare(waitForObjectExists(":Info.Type: Data2D_QModelIndex").text, "Type: Data2D")
    openItemContextMenu(waitForObject(":groupBox.treeView_QTreeView"), "P123\\_D2O\\_30\\_percent\\.dat", 139, 9, 0)
    activateItem(waitForObjectItem(":MainWindow_QMenu", "Quick 3DPlot (slow)"))
    test.vp("VP1")
    snooze(2)
    openItemContextMenu(waitForObject(":groupBox.treeView_QTreeView"), "P123\\_D2O\\_30\\_percent\\.dat", 139, 9, 0)
    activateItem(waitForObjectItem(":MainWindow_QMenu", "Edit Mask"))
    test.compare(waitForObjectExists(":MaskEditorUI_MaskEditor").visible, True)
    test.compare(str(waitForObjectExists(":MaskEditorUI_MaskEditor").windowTitle), "Mask Editor for P123_D2O_30_percent.dat")
