From 3d64566ab65cacca573b2a07d57bcb55838100df Mon Sep 17 00:00:00 2001 From: Adam Reif Date: Mon, 13 Nov 2017 04:35:21 +0000 Subject: [PATCH] Add X11 emulation to travis so tests can run after build Add guard against popping from empty stack --- .travis.yml | 6 ++++++ CMakeLists.txt | 2 +- src/ViewModel/ViewModelBuilder.cpp | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 45699451..63b4fb9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,6 +58,12 @@ install: - if [[ $TRAVIS_OS_NAME == 'osx' ]] ; then brew install qt5 ; fi # - if [[ $TRAVIS_OS_NAME == 'osx' ]] ; then brew link --force qt5 && ln -s /usr/local/Cellar/qt5/5.9.1/mkspecs /usr/local/mkspecs && ln -s /usr/local/Cellar/qt5/5.9.1/plugins /usr/local/plugins ; fi +#emulate x server to run the gui on linux - necessary for testing +before_script: + - if [[ $TRAVIS_OS_NAME == 'linux' ]] ; then export DISPLAY=:99.0 ; fi + - if [[ $TRAVIS_OS_NAME == 'linux' ]] ; then sh -e /etc/init.d/xvfb start ; fi + - if [[ $TRAVIS_OS_NAME == 'linux' ]] ; then sleep 3 ; fi # give xvfb some time to start + script: - if [[ $TRAVIS_OS_NAME == 'linux' ]] ; then cd bin && cmake -DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5 .. && make && ctest -V ; fi - if [[ $TRAVIS_OS_NAME == 'osx' ]] ; then cd bin && cmake .. && make && ctest -V ; fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f77c9f8..4d665294 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(pfcrender) # The project version number. set(VERSION_MAJOR 0 CACHE STRING "Major version number.") -set(VERSION_MINOR 4 CACHE STRING "Minor version number.") +set(VERSION_MINOR 5 CACHE STRING "Minor version number.") set(VERSION_PATCH 0 CACHE STRING "Patch version number.") mark_as_advanced(VERSION_MAJOR VERSION_MINOR VERSION_PATCH) diff --git a/src/ViewModel/ViewModelBuilder.cpp b/src/ViewModel/ViewModelBuilder.cpp index 3f6dbae3..d0c35e8c 100644 --- a/src/ViewModel/ViewModelBuilder.cpp +++ b/src/ViewModel/ViewModelBuilder.cpp @@ -147,7 +147,10 @@ ViewModelBuilder::_createGeometry(const QString& curve) stack.push(pos); continue; case ']': // pop position and direction from stack - pos = stack.pop(); + if(stack.isEmpty()) + qWarning("Tried to pop from empty stack. Ignoring this character"); + else + pos = stack.pop(); continue; case '_': // special command: next color // idx = colors.indexOf(pos.getColor())+1;