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

def main():
    startApplication("sasview")
    clickButton(waitForObject(":groupBox.cmdLoad_QPushButton"))
    waitForObjectItem(":stackedWidget.listView_QListView", "test")
    doubleClickItem(":stackedWidget.listView_QListView", "test", 51, 8, 0, Qt.LeftButton)
    waitForObjectItem(":stackedWidget.listView_QListView", "2d\\_data")
    doubleClickItem(":stackedWidget.listView_QListView", "2d\\_data", 64, 8, 0, Qt.LeftButton)
    waitForObjectItem(":stackedWidget.listView_QListView", "P123\\_D2O\\_30\\_percent\\.dat")
    doubleClickItem(":stackedWidget.listView_QListView", "P123\\_D2O\\_30\\_percent\\.dat", 92, 8, 0, Qt.LeftButton)
    clickButton(waitForObject(":groupBox.cmdSendTo_QPushButton"))
    mouseClick(waitForObject(":groupBox_6.cbCategory_QComboBox_2"), 140, 15, 0, Qt.LeftButton)
    mouseClick(waitForObjectItem(":groupBox_6.cbCategory_QComboBox_2", "Sphere"), 127, 10, 0, Qt.LeftButton)
    mouseClick(waitForObject(":groupBox_6.cbModel_QComboBox_2"), 73, 11, 0, Qt.LeftButton)
    mouseClick(waitForObjectItem(":groupBox_6.cbModel_QComboBox_2", "core\\_shell\\_sphere"), 78, 8, 0, Qt.LeftButton)
    test.compare(str(waitForObjectExists(":groupBox_8.lblMinRangeDef_QLabel").text), "0")
    test.compare(str(waitForObjectExists(":groupBox_8.lblMaxRangeDef_QLabel").text), "0.141421356237")
    test.compare(str(waitForObjectExists(":groupBox_9.lblChi2Value_QLabel").text), "481.82")
    test.compare(waitForObjectExists(":FittingWidgetUI.cmdFit_QPushButton").enabled, False)
    waitForObjectItem(":groupBox_6.lstParams_QTreeView_4", "sld\\_solvent")
    clickItem(":groupBox_6.lstParams_QTreeView_4", "sld\\_solvent", 10, 10, 0, Qt.LeftButton)
    waitForObjectItem(":groupBox_6.lstParams_QTreeView_4", "sld\\_shell")
    clickItem(":groupBox_6.lstParams_QTreeView_4", "sld\\_shell", 13, 8, 0, Qt.LeftButton)
    test.compare(waitForObjectExists(":FittingWidgetUI.cmdFit_QPushButton").enabled, True)
    clickButton(waitForObject(":FittingWidgetUI.cmdFit_QPushButton"))
    snooze(2)
    test.compare(waitForObjectExists(":lstParams.4.2551_QModelIndex").text, "4.2551")
    test.compare(str(waitForObjectExists(":groupBox_9.lblChi2Value_QLabel_2").text), "37.303")
    test.compare(waitForObjectExists(":qt_workspacechild_FigureCanvasQTAgg_4").visible, True)
    test.compare(waitForObjectExists(":qt_workspacechild_FigureCanvasQTAgg_3").visible, True)
    test.compare(waitForObjectExists(":qt_workspacechild_FigureCanvasQTAgg_2").visible, True)
    test.compare(str(waitForObjectExists(":Figure 6_MainWindow").windowTitle), "Figure 6")
    test.compare(str(waitForObjectExists(":Figure 5_MainWindow").windowTitle), "Figure 5")
    test.compare(str(waitForObjectExists(":Figure 4_MainWindow").windowTitle), "Figure 4")
