'Color combo enables to select class values. Checks if class values
are selected correctly.
GH-2133
GH-2036'

def test_color_combo(self):

    RESULTS = [[0, 2, 6], [0, 3, 10], [0, 4, 11], [1, 2, 6], [1, 3, 7], [1, 4, 7]]
    table = Table('titanic')
    self.send_signal(self.widget.Inputs.data, table)
    color_vars = (['(Pearson    residuals)'] + [str(x) for x in table.domain])
    for (i, cv) in enumerate(color_vars):
        idx = self.widget.cb_attr_color.findText(cv)
        self.widget.cb_attr_color.setCurrentIndex(idx)
        color = self.widget.cb_attr_color.currentText()
        simulate.combobox_activate_index(self.widget.controls.variable_color, idx, 0)
        discrete_data = self.widget.discrete_data
        if (color == '(Pearson    residuals)'):
            self.widget.interior_coloring = self.widget.PEARSON
            self.assertIsNone(discrete_data.domain.class_var)
        else:
            self.widget.interior_coloring = self.widget.CLASS_DISTRIBUTION
            self.assertEqual(color, str(discrete_data.domain.class_var))
        output = self.get_output('Data')
        self.assertEqual(output.domain.class_var, table.domain.class_var)
        for ma in range(2, 5):
            self.vizrank.max_attrs = ma
            sc = self.vizrank.state_count()
            self.assertTrue(([(i > 0), ma, sc] in RESULTS))
