Overview
Comment: | Add manual tests for terminal control methods |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b926426749171a11aa6919e00bc068dd |
User & Date: | js on 2020-05-24 16:48:41 |
Other Links: | manifest | tags |
Context
2020-05-24
| ||
17:00 | tests/objc_sync/Makefile: Adjust to recent changes check-in: 024da6ee57 user: js tags: trunk | |
16:48 | Add manual tests for terminal control methods check-in: b926426749 user: js tags: trunk | |
15:54 | Add terminal control methods for Windows check-in: 40f58c637b user: js tags: trunk | |
Changes
Added tests/terminal/Makefile version [7039207a22].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | include ../../extra.mk PROG_NOINST = terminal_tests${PROG_SUFFIX} SRCS = TerminalTests.m include ../../buildsys.mk post-all: ${RUN_TESTS} .PHONY: run run: rm -f libobjfw.so.${OBJFW_LIB_MAJOR} rm -f libobjfw.so.${OBJFW_LIB_MAJOR_MINOR} rm -f objfw.dll libobjfw.${OBJFW_LIB_MAJOR}.dylib rm -f libobjfwrt.so.${OBJFWRT_LIB_MAJOR} rm -f libobjfwrt.so.${OBJFWRT_LIB_MAJOR_MINOR} rm -f objfwrt.dll libobjfwrt.${OBJFWRT_LIB_MAJOR}.dylib rm -f ${OBJFWRT_AMIGA_LIB} if test -f ../../src/libobjfw.so; then \ ${LN_S} ../../src/libobjfw.so libobjfw.so.${OBJFW_LIB_MAJOR}; \ ${LN_S} ../../src/libobjfw.so \ libobjfw.so.${OBJFW_LIB_MAJOR_MINOR}; \ elif test -f ../../src/libobjfw.so.${OBJFW_LIB_MAJOR_MINOR}; then \ ${LN_S} ../../src/libobjfw.so.${OBJFW_LIB_MAJOR_MINOR} \ libobjfw.so.${OBJFW_LIB_MAJOR_MINOR}; \ fi if test -f ../../src/objfw.dll; then \ ${LN_S} ../../src/objfw.dll objfw.dll; \ fi if test -f ../../src/libobjfw.dylib; then \ ${LN_S} ../../src/libobjfw.dylib \ libobjfw.${OBJFW_LIB_MAJOR}.dylib; \ fi if test -f ../../src/runtime/libobjfwrt.so; then \ ${LN_S} ../../src/runtime/libobjfwrt.so \ libobjfwrt.so.${OBJFWRT_LIB_MAJOR}; \ ${LN_S} ../../src/runtime/libobjfwrt.so \ libobjfwrt.so.${OBJFWRT_LIB_MAJOR_MINOR}; \ elif test -f ../../src/runtime/libobjfwrt.so.${OBJFWRT_LIB_MAJOR_MINOR}; then \ ${LN_S} ../../src/runtime/libobjfwrt.so.${OBJFWRT_LIB_MAJOR_MINOR} libobjfwrt.so.${OBJFWRT_LIB_MAJOR_MINOR}; \ fi if test -f ../../src/runtime/objfwrt.dll; then \ ${LN_S} ../../src/runtime/objfwrt.dll objfwrt.dll; \ fi if test -f ../../src/runtime/libobjfwrt.dylib; then \ ${LN_S} ../../src/runtime/libobjfwrt.dylib \ libobjfwrt.${OBJFWRT_LIB_MAJOR}.dylib; \ fi if test -f ../../src/runtime/${OBJFWRT_AMIGA_LIB}; then \ ${LN_S} ../../src/runtime/${OBJFWRT_AMIGA_LIB} \ ${OBJFWRT_AMIGA_LIB}; \ fi LD_LIBRARY_PATH=.$${LD_LIBRARY_PATH+:}$$LD_LIBRARY_PATH \ DYLD_FRAMEWORK_PATH=../../src:../../src/runtime$${DYLD_FRAMEWORK_PATH+:}$$DYLD_FRAMEWORK_PATH \ DYLD_LIBRARY_PATH=.$${DYLD_LIBRARY_PATH+:}$$DYLD_LIBRARY_PATH \ LIBRARY_PATH=.$${LIBRARY_PATH+:}$$LIBRARY_PATH \ ${WRAPPER} ./${PROG_NOINST}; EXIT=$$?; \ rm -f libobjfw.so.${OBJFW_LIB_MAJOR}; \ rm -f objfw.so.${OBJFW_LIB_MAJOR_MINOR} objfw.dll; \ rm -f libobjfw.${OBJFW_LIB_MAJOR}.dylib; \ rm -f libobjfwrt.so.${OBJFWRT_LIB_MAJOR}; \ rm -f objfwrt.so.${OBJFWRT_LIB_MAJOR_MINOR} objfwrt.dll; \ rm -f libobjfwrt.${OBJFWRT_LIB_MAJOR}.dylib; \ exit $$EXIT CPPFLAGS += -I../../src -I../../src/exceptions -I../../src/runtime -I../.. LIBS := -L../../src -lobjfw -L../../src/runtime ${RUNTIME_LIBS} ${LIBS} LD = ${OBJC} |
Added tests/terminal/TerminalTests.m version [3e135bdea5].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | /* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, * 2018, 2019, 2020 * Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFApplication.h" #import "OFArray.h" #import "OFColor.h" #import "OFStdIOStream.h" #import "OFThread.h" @interface TerminalTests: OFObject <OFApplicationDelegate> @end OF_APPLICATION_DELEGATE(TerminalTests) @implementation TerminalTests - (void)applicationDidFinishLaunching { OFArray *colors = [OFArray arrayWithObjects: [OFColor black], [OFColor silver], [OFColor grey], [OFColor white], [OFColor maroon], [OFColor red], [OFColor purple], [OFColor fuchsia], [OFColor green], [OFColor lime], [OFColor olive], [OFColor yellow], [OFColor navy], [OFColor blue], [OFColor teal], [OFColor aqua], nil]; size_t i; OFEnumerator OF_GENERIC(OFColor *) *reverseEnumerator; [of_stdout writeFormat: @"%dx%d\n", of_stdout.columns, of_stdout.rows]; i = 0; for (OFColor *color in colors) { of_stdout.foregroundColor = color; [of_stdout writeFormat: @"%zx", i++]; } [of_stdout reset]; [of_stdout writeLine: @"R"]; i = 0; for (OFColor *color in colors) { of_stdout.backgroundColor = color; [of_stdout writeFormat: @"%zx", i++]; } [of_stdout reset]; [of_stdout writeLine: @"R"]; i = 0; reverseEnumerator = [colors.reversedArray objectEnumerator]; for (OFColor *color in colors) { of_stdout.foregroundColor = color; of_stdout.backgroundColor = [reverseEnumerator nextObject]; [of_stdout writeFormat: @"%zx", i++]; } [of_stdout reset]; [of_stdout writeLine: @"R"]; for (i = 0; i < colors.count * 2; i++) { if (i % 2) of_stdout.backgroundColor = [colors objectAtIndex: ((i / 2) + 2) % colors.count]; else of_stdout.foregroundColor = [colors objectAtIndex: i / 2]; [of_stdout writeFormat: @"%zx", i / 2]; } [of_stdout reset]; [of_stdout writeLine: @"R"]; [of_stdout writeLine: @"Press return"]; [of_stdin readLine]; of_stdout.backgroundColor = [OFColor green]; [of_stdout writeString: @"Hello!"]; [OFThread sleepForTimeInterval: 2]; [of_stdout eraseLine]; [of_stdout writeString: @"World!"]; [OFThread sleepForTimeInterval: 2]; [of_stdout clear]; [OFThread sleepForTimeInterval: 2]; of_stdout.cursorPosition = of_point(5, 3); [of_stdout writeString: @"Text at (5, 3)"]; [OFThread sleepForTimeInterval: 2]; [of_stdout setRelativeCursorPosition: of_point(-2, 0)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setRelativeCursorPosition: of_point(2, 0)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setRelativeCursorPosition: of_point(0, -2)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setRelativeCursorPosition: of_point(0, 2)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setRelativeCursorPosition: of_point(1, 1)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setRelativeCursorPosition: of_point(-1, -1)]; [OFThread sleepForTimeInterval: 2]; of_stdout.cursorColumn = 2; [OFThread sleepForTimeInterval: 2]; [of_stdout reset]; [OFApplication terminate]; } @end |