Created
December 23, 2019 21:13
-
-
Save riccardoklinger/b0337251e5fe21059e284b746518d3f7 to your computer and use it in GitHub Desktop.
an automated testing script for QGIS, German version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <AutoItConstants.au3> ; need this for the mouse clicks | |
#include <MsgBoxConstants.au3> | |
#include <WinAPIFiles.au3> | |
Run("C:\Program Files\QGIS 3.4\bin\qgis-ltr-bin-g7.exe") ; starting the program | |
Local $qgis = WinWaitActive("Unbenanntes Projekt - QGIS") | |
WinSetState ($qgis, "", @SW_MAXIMIZE) ; maximise the working window | |
Send("^+n"); ctrl Shift n for new geopackage Layer | |
WinWaitActive("Neuer GeoPackage-Layer") ; waiting for the window to appear | |
Send("{TAB 3}") ; Presses the DEL key 3 times | |
; damn navigation fro creating a Geopackage layer... | |
Send("Test_Table") ; | |
Send("{TAB}") | |
Send("{DOWN}") | |
Send("{TAB 4}") | |
Send("Name") ; | |
Send("{TAB 2}") | |
Send("255") | |
Send("{TAB}") | |
Send("{SPACE}") | |
Send("{TAB}") | |
Send("C:\Users\" & @UserName & "\Documents\GIS DataBase\test") | |
Send("{ENTER}") | |
; should be ready now | |
WinWaitActive($qgis) | |
Send("!l") ;switch to Layer menu ALT+L | |
Send("{DOWN 8}") | |
Send("{ENTER}"); open edit mode | |
Send("^."); create new point | |
WinWaitActive($qgis) | |
MouseClick($MOUSE_CLICK_LEFT, 559, 411, 1) ; creates a poin on the map pane at x-y pixel | |
WinWaitActive("Test_Table - Objektattribute") | |
Send("{TAB}"); we don't set a fid | |
Send("This is my name") | |
Send("{ENTER}"); closes attribut entry window | |
WinWaitActive($qgis) | |
Send("!l") ;switch to Layer menu ALT+L | |
Send("{DOWN 8}") | |
Send("{ENTER}"); closes edit mode | |
WinWaitActive("Bearbeitung beenden") | |
Send("{ENTER}") ;save edits | |
WinWaitActive($qgis) | |
WinClose($qgis) | |
WinWaitActive("Projekt speichern") | |
Send("{TAB 1}") | |
Send("{SPACE}") | |
FileChecker() | |
Func FileChecker() | |
Local $filePath = "C:\Users\" & @UserName & "\Documents\GIS DataBase\test.gpkg" | |
Local $iFileExists = FileExists($filePath) | |
; Display a message of whether the file exists or not. | |
If $iFileExists Then | |
MsgBox($MB_SYSTEMMODAL, "", "The file exists." & @CRLF & "FileExist returned: " & $iFileExists) | |
Else | |
MsgBox($MB_SYSTEMMODAL, "", "The file doesn't exist." & @CRLF & "FileExist returned: " & $iFileExists) | |
EndIf | |
; Delete the file: | |
FileDelete($filePath) | |
EndFunc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment