forked from bruderstein/PythonScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotepadTestCase.py
More file actions
46 lines (34 loc) · 1.26 KB
/
NotepadTestCase.py
File metadata and controls
46 lines (34 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
import unittest
from Npp import *
class NotepadTestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_setEncoding(self):
notepad.new()
notepad.setEncoding(BUFFERENCODING.UTF8)
encoding = notepad.getEncoding()
self.assertEqual(encoding, BUFFERENCODING.UTF8)
notepad.setEncoding(BUFFERENCODING.ANSI)
encoding = notepad.getEncoding()
self.assertEqual(encoding, BUFFERENCODING.ANSI)
notepad.close()
def test_setLangType(self):
notepad.new()
buffer1 = notepad.getCurrentBufferID()
notepad.setLangType(LANGTYPE.C)
notepad.new()
buffer2 = notepad.getCurrentBufferID()
notepad.setLangType(LANGTYPE.PHP)
notepad.activateBufferID(buffer1)
newBuffer1Lang = notepad.getLangType()
notepad.activateBufferID(buffer2)
newBuffer2Lang = notepad.getLangType()
notepad.close()
notepad.activateBufferID(buffer1)
notepad.close()
self.assertEqual(newBuffer1Lang, LANGTYPE.C)
self.assertEqual(newBuffer2Lang, LANGTYPE.PHP)
suite = unittest.TestLoader().loadTestsFromTestCase(NotepadTestCase)