コード例 #1
0
ファイル: test_form.py プロジェクト: dgfitch/psychopy
    def test_set_response(self):
        survey = Form(self.win, items=[self.genderItem], size=(1.0, 0.3), pos=(0.0, 0.0), autoLog=False)
        textStim, questionHeight, questionWidth = survey._setQuestion(self.genderItem)
        sliderStim, respHeight = survey._setResponse(self.genderItem, textStim)

        assert type(sliderStim) == Slider
        assert type(respHeight) == float
コード例 #2
0
    def test_set_response(self):
        survey = Form(self.win, items=[self.genderItem], size=(1.0, 0.3), pos=(0.0, 0.0), autoLog=False)
        textStim, questionHeight, questionWidth = survey._setQuestion(self.genderItem)
        sliderStim, respHeight = survey._setResponse(self.genderItem, textStim)

        assert type(sliderStim) == Slider
        assert type(respHeight) == float
コード例 #3
0
ファイル: test_form.py プロジェクト: dgfitch/psychopy
    def test_set_questions(self):
        survey = Form(self.win, items=[self.genderItem], size=(1.0, 0.3), pos=(0.0, 0.0), autoLog=False)
        textStim, questionHeight, questionWidth = survey._setQuestion(self.genderItem)

        assert type(textStim) == TextStim
        assert type(questionHeight) == float
        assert type(questionWidth) == float
コード例 #4
0
    def test_set_questions(self):
        survey = Form(self.win, items=[self.genderItem], size=(1.0, 0.3), pos=(0.0, 0.0), autoLog=False)
        textStim, questionHeight, questionWidth = survey._setQuestion(self.genderItem)

        assert type(textStim) == TextStim
        assert type(questionHeight) == float
        assert type(questionWidth) == float
コード例 #5
0
    def test_set_response(self):
        survey = Form(self.win, items=[], size=(1.0, 0.3), pos=(0.0, 0.0))
        textStim, qHeight, qWidth = survey._setQuestion(self.genderItem)
        sliderStim, aHeight = survey._setResponse(self.genderItem, textStim)

        assert type(sliderStim) == Slider
        assert type(aHeight) == float
コード例 #6
0
    def test_set_response(self):
        survey = Form(self.win, items=[self.genderItem], size=(1.0, 0.3),
                      pos=(0.0, 0.0), autoLog=False)
        ctrl, h, w = survey._setQuestion(self.genderItem)
        sliderStim, respHeight = survey._setResponse(self.genderItem)

        assert type(sliderStim) == Slider
        assert type(respHeight) in [float, np.float64]
コード例 #7
0
    def test_set_questions(self):
        survey = Form(self.win, items=[self.genderItem], size=(1.0, 0.3),
                      pos=(0.0, 0.0), autoLog=False)
        ctrl, h, w = survey._setQuestion(self.genderItem)

        assert type(ctrl) == TextBox2
        assert type(h) in [float, np.float64]
        assert type(w) in [float, np.float64]
コード例 #8
0
    def test_baseYpositions(self):
        survey = Form(self.win, items=self.questions, size=(1.0, 0.3), pos=(0.0, 0.0))
        testPositions = []
        survey.virtualHeight = 0
        for item in survey.items:
            question, qHeight, qWidth = survey._setQuestion(item)
            response, aHeight, = survey._setResponse(item, question)
            testPositions.append(survey.virtualHeight
                                 - max(aHeight, qHeight)
                                 + (aHeight / 2)
                                 - survey.textHeight)
            survey.virtualHeight -= max(aHeight, qHeight) + survey.itemPadding

        for idx, pos in enumerate(survey._baseYpositions):
            assert testPositions[idx] == pos