about summary refs log tree commit diff stats
path: root/Makefile
Commit message (Expand)AuthorAgeFilesLines
* thx to Toni Lainsonarg@suckless.org2007-10-191-2/+2
* removed dwm.h, just include C-files in config.h if you extend dwm, that's sim...arg@suckless.org2007-10-181-2/+2
* recreated dwm.hAnselm R. Garbe2007-10-111-1/+1
* renamed config.h into config.def.h, config.h will be created if not present, ...Anselm R. Garbe2007-09-231-1/+5
* made all stuff non-static - so you can choose wether to use dwm the static or...arg@suckless.org2007-09-171-1/+1
* micromizing dwm step 1Anselm R. Garbe2007-09-151-3/+3
* moved bar-related stuff to bar.c (merged draw.c into that)Anselm R. Garbe2007-09-151-1/+1
* renamed config.default.h into config.hAnselm R. Garbe2007-09-151-5/+1
* dist target only needs to add config.default.hAnselm R. Garbe2007-09-151-1/+1
* added screen.c, removed layout.c and tag.cAnselm R. Garbe2007-08-191-1/+1
* fififiAnselm R. Garbe2007-08-151-1/+1
* separated layout-specific stuff into separate .h and .c files which are inclu...Anselm R. Garbe2007-08-111-1/+1
* removed strip, added -s to LDFLAGSAnselm R. Garbe2007-05-151-1/+0
* yet another fix of copyright compactisitionAnselm R. Garbe2007-04-131-1/+1
* fixed quoting and a comment 3.6Anselm R. Garbe2007-02-211-1/+1
* added draw.c again (except getcolor and setfont which are helpers in main.c)Anselm R. Garbe2007-02-201-1/+1
* split screen.c into layout.c and tag.c (because the view is an implicit mixtu...Anselm R. Garbe2007-02-201-1/+1
* draw.c is useless (belongs to main.c now)Anselm R. Garbe2007-02-191-1/+1
* renamed view.c into screen.cAnselm R. Garbe2007-02-191-1/+1
* merged tag.c, view.c and tile.c to manage.cAnselm R. Garbe2007-02-191-1/+1
* introduced tile.c, some refactoring of functionsAnselm R. Garbe2007-02-191-1/+1
* fixed copyright notice in MakefileAnselm R. Garbe2007-02-081-1/+1
* got rid of LD (inspired by JGs patch to wmii)Anselm R. Garbe2007-02-051-3/+2
* next version will contain updated copyright noticearg@mig292007-01-021-1/+1
* separated several functions into view.cAnselm R. Garbe2006-08-221-1/+1
* removed finished messageAnselm R.Garbe2006-08-141-1/+0
* applied Sanders LD and resize patchesAnselm R.Garbe2006-08-141-1/+2
* applied Sanders tiny patchesAnselm R.Garbe2006-08-081-1/+1
* typo fixarg@10ksloc.org2006-08-071-1/+1
* applied Sanders man page/Makefile patcharg@10ksloc.org2006-08-071-1/+1
* added stripping to dwm target in Makefilearg@10ksloc.org2006-08-071-0/+1
* removed CONFIGarg@10ksloc.org2006-08-031-3/+2
* make config.h not a time dependencearg@10ksloc.org2006-08-031-1/+1
* removed rm config.h from cleanarg@10ksloc.org2006-08-031-1/+1
* added gmake compliancearg@10ksloc.org2006-08-031-2/+2
* applied Jukka's diffarg@10ksloc.org2006-08-031-4/+5
* applied Sanders Makefile patcharg@10ksloc.org2006-08-031-26/+20
* using SRC instead of *.carg@10ksloc.org2006-08-031-1/+1
* changed the files included in make distarg@10ksloc.org2006-08-031-1/+2
* applied Sanders doc changes, added a PHONY line and changed the output of con...arg@10ksloc.org2006-08-031-1/+4
* implemented the idea presented by Sander for dwm targetarg@10ksloc.org2006-08-021-1/+4
* applied Sanders patchesarg@10ksloc.org2006-08-011-2/+1
* makefile now sets permissions for executables and man pagesarg@10ksloc.org2006-07-201-0/+6
* simplified MakefileAnselm R. Garbe2006-07-171-2/+2
* rearranged several stuffAnselm R. Garbe2006-07-151-1/+1
* rearrangedAnselm R. Garbe2006-07-141-1/+1
* draw bar on exposure ;)Anselm R. Garbe2006-07-141-1/+1
* prep 0.1 0.1Anselm R. Garbe2006-07-141-1/+1
* implemented bar for dwm (I miss status text), I plan that status text is read...Anselm R. Garbe2006-07-141-1/+1
* changed default colorsAnselm R. Garbe2006-07-131-2/+2
ed more stuff' href='/akspecs/ranger/commit/test/tc_directory.py?h=v1.6.1&id=5822dff7d91472bf2fc337c68f144e0ce1de09ae'>5822dff7 ^
9506fb8e ^
fae694a0 ^
fe179145 ^
fae694a0 ^
fe179145 ^

fae694a0 ^


fe179145 ^
fae694a0 ^
9506fb8e ^

f6f26231 ^
4c05e43d ^
f6f26231 ^







9506fb8e ^
fae694a0 ^

f6f26231 ^










4c05e43d ^

fae694a0 ^

fe179145 ^
5822dff7 ^

fe179145 ^
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
                                                            
 

                                           
                           

                                               


                                                
 

                                                      
                                              
 
               
                               
                                         
                                                          
                                        

                                                   

                                                     
                                                 

                                                                            
 
                                            
                         
                                                                                
                                        
                                  

                                           
                                                           
 


                                                                                       

                                                                                    

                                        

                                             




                                                                                 
                                      
                                
                                                 



                                                                                       
 
                                       
                                                
                                  
                
                                                   

                                                


                                                                            
 
                                        

                           
                                                                                 
                                                                                         







                                                        
                                        

                          










                                                                             

                                                                                                      

                                                       
 

                          
 
if __name__ == '__main__': from __init__ import init; init()

from os.path import realpath, join, dirname

from ranger import fsobject
from ranger.fsobject.file import File
from ranger.fsobject.directory import Directory
from ranger.shared.settings import SettingsAware

SettingsAware._setup()

TESTDIR = realpath(join(dirname(__file__), 'testdir'))
TESTFILE = join(TESTDIR, 'testfile5234148')
NONEXISTANT_DIR = join(TESTDIR, 'nonexistant')

import unittest
class Test1(unittest.TestCase):
	def test_initial_condition(self):
		# Check for the expected initial condition
		dir = Directory(TESTDIR)

		self.assertEqual(dir.path, TESTDIR)
		self.assertFalse(dir.content_loaded)
		self.assertEqual(dir.filenames, None)
		self.assertEqual(dir.files, None)
		self.assertRaises(fsobject.NotLoadedYet, len, dir)
		self.assertRaises(fsobject.NotLoadedYet, dir.__getitem__, 0)

	def test_after_content_loaded(self):
		import os
		# Check whether the directory has the correct list of filenames.
		dir = Directory(TESTDIR)
		dir.load_content()

		self.assertTrue(dir.exists)
		self.assertEqual(type(dir.filenames), list)

		# Get the filenames you expect it to have and sort both before
		# comparing. I don't expect any order after only loading the filenames.
		assumed_filenames = os.listdir(TESTDIR)
		assumed_filenames = list(map(lambda str: os.path.join(TESTDIR, str),
			assumed_filenames))
		assumed_filenames.sort()
		dir.filenames.sort()

		self.assertTrue(len(dir) > 0)
		self.assertEqual(dir.filenames, assumed_filenames)

		# build a file object for each file in the list assumed_filenames
		# and find exactly one equivalent in dir.files
		for name in assumed_filenames:
			f = File(name)
			f.load()
			for dirfile in dir.files:
				if (f.path == dirfile.path and f.stat == dirfile.stat):
					break
			else:
				self.fail("couldn't find file {0}".format(name))

	def test_nonexistant_dir(self):
		dir = Directory(NONEXISTANT_DIR)
		dir.load_content()
		
		self.assertTrue(dir.content_loaded)
		self.assertFalse(dir.exists)
		self.assertFalse(dir.accessible)
		self.assertEqual(dir.filenames, None)
		self.assertRaises(fsobject.NotLoadedYet, len, dir)
		self.assertRaises(fsobject.NotLoadedYet, dir.__getitem__, 0)

	def test_load_if_outdated(self):
		import os
		import time
		# modify the directory. If the time between the last modification
		# was within the filesystems resolution of mtime, we should have a reload

		def modify_dir():
			open(TESTFILE, 'w').close()
			os.unlink(TESTFILE)

		def mtime():
			return os.stat(TESTDIR).st_mtime

		dir = Directory(TESTDIR)
		dir.load()

		# If the modification happens to be in the same second as the
		# last modification, it will result in mtime having the same
		# integer value. So we wait until the resolution is exceeded
		# and mtime differs.
		old_mtime = mtime()
		for i in range(50):
			modify_dir()
			if old_mtime != mtime(): break
			time.sleep(0.1)
		else:
			# fail after 5 seconds of trying
			self.fail(
					"Cannot perform test: mtime of TESTDIR is not being updated.")

		self.assertTrue(dir.load_if_outdated())

if __name__ == '__main__':
	unittest.main()