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

def main():
    startApplication("sasview")
    clickTab(waitForObject(":FittingWidgetUI.tabFitting_QTabWidget_2"), "Resolution")
    test.compare(waitForObjectExists(":groupBox_4.cbSmearing_QComboBox").currentIndex, 0)
    test.compare(str(waitForObjectExists(":groupBox_4.cbSmearing_QComboBox").currentText), "None")
    test.compare(waitForObjectExists(":groupBox_4.cbSmearing_QComboBox").count, 1)
    clickTab(waitForObject(":FittingWidgetUI.tabFitting_QTabWidget_2"), "Model")
    clickButton(waitForObject(":groupBox.cmdLoad_QPushButton"))
    waitForObjectItem(":stackedWidget.listView_QListView", "test")
    doubleClickItem(":stackedWidget.listView_QListView", "test", 36, 4, 0, Qt.LeftButton)
    waitForObjectItem(":stackedWidget.listView_QListView", "1d\\_data")
    doubleClickItem(":stackedWidget.listView_QListView", "1d\\_data", 30, 10, 0, Qt.LeftButton)
    waitForObjectItem(":stackedWidget.listView_QListView", "cyl\\_400\\_20\\.txt")
    doubleClickItem(":stackedWidget.listView_QListView", "cyl\\_400\\_20\\.txt", 72, 3, 0, Qt.LeftButton)
    clickButton(waitForObject(":groupBox.cmdSendTo_QPushButton"))
    mouseClick(waitForObject(":groupBox_6.cbCategory_QComboBox_2"), 136, 8, 0, Qt.LeftButton)
    mouseClick(waitForObjectItem(":groupBox_6.cbCategory_QComboBox_2", "Cylinder"), 129, 9, 0, Qt.LeftButton)
    clickTab(waitForObject(":FittingWidgetUI.tabFitting_QTabWidget_2"), "Resolution")
    test.compare(waitForObjectExists(":groupBox_4.cbSmearing_QComboBox").currentIndex, 0)
    test.compare(str(waitForObjectExists(":groupBox_4.cbSmearing_QComboBox").currentText), "None")
    test.compare(waitForObjectExists(":groupBox_4.cbSmearing_QComboBox").count, 3)
    mouseClick(waitForObject(":groupBox_4.cbSmearing_QComboBox"), 117, 7, 0, Qt.LeftButton)
    mouseClick(waitForObjectItem(":groupBox_4.cbSmearing_QComboBox", "Custom Pinhole Smear"), 113, 6, 0, Qt.LeftButton)
    test.compare(str(waitForObjectExists(":groupBox_4.cbSmearing_QComboBox").currentText), "Custom Pinhole Smear")
    test.compare(str(waitForObjectExists(":groupBox_4.lblSmearUp_QLabel").text), "<html><head/><body><p>dQ<span style=\" vertical-align:sub;\">low</span></p></body></html>")
    test.compare(str(waitForObjectExists(":groupBox_4.lblSmearDown_QLabel").text), "<html><head/><body><p>dQ<span style=\" vertical-align:sub;\">high</span></p></body></html>")
    test.compare(str(waitForObjectExists(":groupBox_4.txtSmearUp_QLineEdit").text), "")
    test.compare(waitForObjectExists(":groupBox_4.txtSmearUp_QLineEdit").enabled, True)
    test.compare(str(waitForObjectExists(":groupBox_4.txtSmearDown_QLineEdit").text), "")
    test.compare(waitForObjectExists(":groupBox_4.txtSmearDown_QLineEdit").enabled, True)
    mouseClick(waitForObject(":groupBox_4.cbSmearing_QComboBox"), 117, 15, 0, Qt.LeftButton)
    mouseClick(waitForObjectItem(":groupBox_4.cbSmearing_QComboBox", "Custom Slit Smear"), 89, 5, 0, Qt.LeftButton)
    test.compare(str(waitForObjectExists(":groupBox_4.cbSmearing_QComboBox").currentText), "Custom Slit Smear")
    test.compare(waitForObjectExists(":groupBox_4.lblSmearUp_QLabel").visible, True)
    test.compare(str(waitForObjectExists(":groupBox_4.lblSmearUp_QLabel").text), "Slit height")
    test.compare(str(waitForObjectExists(":groupBox_4.lblSmearDown_QLabel").text), "Slit width")
    test.compare(waitForObjectExists(":groupBox_4.lblSmearDown_QLabel").visible, True)
