def test_modified_indicator(self): segment_info = vim_module._get_segment_info() self.assertEqual(vim.modified_indicator(segment_info=segment_info), None) segment_info['buffer'][0] = 'abc' try: self.assertEqual(vim.modified_indicator(segment_info=segment_info), '+') self.assertEqual(vim.modified_indicator(segment_info=segment_info, text='-'), '-') finally: vim_module._bw(segment_info['bufnr'])
def test_modified_indicator(self): pl = Pl() segment_info = vim_module._get_segment_info() self.assertEqual(vim.modified_indicator(pl=pl, segment_info=segment_info), None) segment_info['buffer'][0] = 'abc' try: self.assertEqual(vim.modified_indicator(pl=pl, segment_info=segment_info), '+') self.assertEqual(vim.modified_indicator(pl=pl, segment_info=segment_info, text='-'), '-') finally: vim_module._bw(segment_info['bufnr'])
def test_line_percent(self): segment_info = vim_module._get_segment_info() segment_info['buffer'][0:-1] = [str(i) for i in range(100)] try: self.assertEqual(vim.line_percent(segment_info=segment_info), '0') vim_module._set_cursor(50, 0) self.assertEqual(vim.line_percent(segment_info=segment_info), '49') self.assertEqual(vim.line_percent(segment_info=segment_info, gradient=True), [{'contents': '49', 'highlight_group': ['line_percent_gradient', 'line_percent'], 'gradient_level': 49}]) finally: vim_module._bw(segment_info['bufnr'])
def test_line_percent(self): pl = Pl() segment_info = vim_module._get_segment_info() segment_info['buffer'][0:-1] = [str(i) for i in range(100)] try: self.assertEqual(vim.line_percent(pl=pl, segment_info=segment_info), '1') vim_module._set_cursor(50, 0) self.assertEqual(vim.line_percent(pl=pl, segment_info=segment_info), '50') self.assertEqual(vim.line_percent(pl=pl, segment_info=segment_info, gradient=True), [{'contents': '50', 'highlight_group': ['line_percent_gradient', 'line_percent'], 'gradient_level': 50 * 100.0 / 101}]) finally: vim_module._bw(segment_info['bufnr'])
def test_position(self): pl = Pl() segment_info = vim_module._get_segment_info() try: segment_info['buffer'][0:-1] = [str(i) for i in range(99)] vim_module._set_cursor(49, 0) self.assertEqual(vim.position(pl=pl, segment_info=segment_info), '50%') self.assertEqual(vim.position(pl=pl, segment_info=segment_info, gradient=True), [{'contents': '50%', 'highlight_group': ['position_gradient', 'position'], 'gradient_level': 50.0}]) vim_module._set_cursor(0, 0) self.assertEqual(vim.position(pl=pl, segment_info=segment_info), 'Top') vim_module._set_cursor(97, 0) self.assertEqual(vim.position(pl=pl, segment_info=segment_info, position_strings={'top': 'Comienzo', 'bottom': 'Final', 'all': 'Todo'}), 'Final') segment_info['buffer'][0:-1] = [str(i) for i in range(2)] vim_module._set_cursor(0, 0) self.assertEqual(vim.position(pl=pl, segment_info=segment_info, position_strings={'top': 'Comienzo', 'bottom': 'Final', 'all': 'Todo'}), 'Todo') self.assertEqual(vim.position(pl=pl, segment_info=segment_info, gradient=True), [{'contents': 'All', 'highlight_group': ['position_gradient', 'position'], 'gradient_level': 0.0}]) finally: vim_module._bw(segment_info['bufnr'])
def test_position(self): pl = Pl() segment_info = vim_module._get_segment_info() try: segment_info['buffer'][0:-1] = [str(i) for i in range(99)] vim_module._set_cursor(49, 0) self.assertEqual(vim.position(pl=pl, segment_info=segment_info), '50%') self.assertEqual(vim.position(pl=pl, segment_info=segment_info, gradient=True), [{'contents': '50%', 'highlight_group': ['position_gradient', 'position'], 'gradient_level': 50.0}]) vim_module._set_cursor(0, 0) self.assertEqual(vim.position(pl=pl, segment_info=segment_info), 'Top') vim_module._set_cursor(97, 0) self.assertEqual(vim.position(pl=pl, segment_info=segment_info, position_strings={'top':'Comienzo', 'bottom':'Final', 'all':'Todo'}), 'Final') segment_info['buffer'][0:-1] = [str(i) for i in range(2)] vim_module._set_cursor(0, 0) self.assertEqual(vim.position(pl=pl, segment_info=segment_info, position_strings={'top':'Comienzo', 'bottom':'Final', 'all':'Todo'}), 'Todo') self.assertEqual(vim.position(pl=pl, segment_info=segment_info, gradient=True), [{'contents': 'All', 'highlight_group': ['position_gradient', 'position'], 'gradient_level': 0.0}]) finally: vim_module._bw(segment_info['bufnr'])