Blog | agateau.com

Web Name: Blog | agateau.com

WebSite: http://agateau.com

ID:17361

Keywords:

Blog,agateau,com,

Description:

Today I want to present a testing technique I now use in Nanonote unit tests.Nanonote main component is a QTextEdit with several "extensions" to provide custom behaviors such as indenting/unindenting selected lines with tab/shift+tab or moving selected lines up and down with alt+shift+arrow keys (next version feature, #spoileralert!).Testing these extensions is not particularly difficult but it requires tedious setup to set the text, position the cursor, define the selection. Then you perform the action and have to write more tedious code to check the new text, cursor position and selection match your expectations. Not only is it tedious to write, it is also error-prone and hard to read.Here is an example:SECTION("indent whole lines") { // GIVEN a TextEdit with 3 lines, the first two being selected edit- setPlainText("1\n" "2\n" "3\n"); auto cursor = edit- textCursor(); cursor.movePosition(QTextCursor::Down, QTextCursor::KeepAnchor, 2); edit- setTextCursor(cursor); // WHEN I press Tab QTest::keyClick(edit, Qt::Key_Tab); // THEN the selected lines are indented CHECK(edit- toPlainText() == QString(" 1\n" " 2\n" "3\n")); // AND the selected lines are still selected CHECK(cursor.selectionStart() == 4); CHECK(cursor.selectionEnd() == 12); Read more... I finally found the time and motivation to get a new version of Pixel Wheels out, so here comes 0.16.0.Not many engine changes in this new version, mostly new content: first a new track: "Welcome". This track takes place in the countryside, so you'll race among fields and should spot an old tractor. As its name imply it's a simple track, designed to be the track new players begin with.It is part of a new championship called "Country Life", which for now contains only this track, so it's very short... I plan to add a new track to it in the next version.The other content addition is a new car: the Dark M.It's a bit longer than the others. Maybe I should shorten it a bit, what do you think? Read more... Let's say you need to parse and analyse some raw data, for example a log file, to generate a report.An easy way to get started with this is to write some Python, Perl, Ruby or shell code to work on your file and print meaningful information about it.To illustrate this article I am going to write a Python script to "analyze" the var/log/syslog log file, whose entries look like this:Apr 12 11:53:42 dozer org.kde.KScreen[6995]: kscreen.xrandr: #011Primary: falseApr 12 11:53:42 dozer org.kde.KScreen[6995]: kscreen.xrandr: Output 68 : connected = false , enabled = falseApr 12 11:53:43 dozer org.kde.KScreen[6995]: kscreen.xrandr: Emitting configChanged()Apr 12 11:53:47 dozer dbus-daemon[991]: [system] Activating service name='org.kde.powerdevil.backlighthelper' requested by ':1.416652' (uid=1001 pid=7186 comm="/usr/lib/x86_64-linux-gnu/libexec/org_kde_powerdev" label="unconfined") (usiApr 12 11:53:47 dozer org.kde.powerdevil.backlighthelper: QDBusArgument: read from a write-only objectApr 12 11:53:47 dozer org.kde.powerdevil.backlighthelper: message repeated 2 times: [ QDBusArgument: read from a write-only object]Apr 12 11:53:47 dozer dbus-daemon[991]: [system] Successfully activated service 'org.kde.powerdevil.backlighthelper'Apr 12 11:54:04 dozer kernel: [716525.975149] usb 3-2: USB disconnect, device number 64Apr 12 11:54:04 dozer kernel: [716525.975156] usb 3-2.1: USB disconnect, device number 65Apr 12 11:54:04 dozer kernel: [716526.040164] usb 3-2.3: USB disconnect, device number 66Apr 12 11:54:04 dozer upowerd[1672]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2.1/3-2.1:1.0/0003:046D:C046.0025Apr 12 11:54:04 dozer upowerd[1672]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2.1/3-2.1:1.0Apr 12 11:54:04 dozer upowerd[1672]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2.1Apr 12 11:54:04 dozer acpid: input device has been disconnected, fd 6The script is going to take the log entries from stdin, iterate on the lines and produce a report on stdout.Parsing the log fileThe first thing to do is to parse the log file. Since we read the log from stdin, we can start with something like this:import sysdef parse_line(line): # TODOdef parse_log(): for line in sys.stdin.readlines(): entry = parse_line(line) if entry: yield entrydef main(): for entry in parse_log(): print(entry)if __name__ == "__main__": main() Read more... I don't know about you, but when I work in a git repository for a long time, I tend to accumulate branches, which I need to clean up.There are a number of tools to do this, but since I have been teaching myself Rust I thought it was a good topic for a first "real" program. So here is "Git Bonsai", a command-line tool to help you keep your git repository clean and tidy by:updating all branches to their remote onesdeleting the merged branchesFor example, given a repository like this:$ git log --all --oneline --graph* f97c782 (HEAD - master) Merging topic1| * f6bfa90 (topic1) Merging topic1-1| |\ | | * 6943ed2 (topic1-1) Create topic1-1| |/ | * 4ea41ff Create topic1| * eec4ebe (topic2) Create topic2* b8b1506 Init$ git branch* master topic1 topic1-1 topic2 Read more... This article is part of a series on creating a Bluetooth speaker from an old vacuum tube radio and spare parts I had lying around in the house.Part 1: IntroductionPart 2: Attempting to update the audio hardwarePart 3: Using an existing Bluetooth speakerPart 4: Frontend workPart 5: Electronics, take 3If you remember well, my first attempt at electronics for this Bluetooth speaker project was using an all-in-one Bluetooth + amplifier board. It did not go well, so I tried to use the guts of an existing Bluetooth speaker instead. That almost worked, but I experienced stability issues I was not able to solve :(This article is about the third attempt: following the instructions from the Radio Workshop (which I mentioned at the end of part 3) to get a working Bluetooth + mono amplifier (hopefully). Read more... I am happy to announce the release of Pixel Wheels 0.15.0, the first version of year 2020! This version could almost have been called 0.14.2 as it's mostly made of bug fixes. Take this as an hint that the game is almost feature complete... at least that is how I analyze it :)What's in this new version, you ask? Read more... This article is part of a series on creating a Bluetooth speaker from an old vacuum tube radio and spare parts I had lying around in the house.Part 1: IntroductionPart 2: Attempting to update the audio hardwarePart 3: Using an existing Bluetooth speakerPart 4: Frontend workPart 5: Electronics, take 3So, while I was waiting for the components I ordered at the end of part 3 to arrive, I spent some time working on the "frontend": the front panel of the radio.In case you forgot, this is what the original front panel looked like at the beginning:But the original radio had a cloth and a grille to hide the speaker, so there was more work to do on the front side. Read more... This article is part of a series on creating a Bluetooth speaker from an old vacuum tube radio and spare parts I had lying around in the house.Part 1: IntroductionPart 2: Attempting to update the audio hardwarePart 3: Using an existing Bluetooth speakerPart 4: Frontend workPart 5: Electronics, take 3So after the failure of part 2, I decided to try a seemingly safer approach: buy a small Bluetooth speaker, tear it down and use its guts to power my radio.I bought a small portable Grundig GSB 710 Bluetooth speaker. It's a mono speaker, but since the radio I am working was also mono, as was common by the time it was created, it felt like a good fit. I checked it worked and started to tear it down: This article is part of a series on creating a Bluetooth speaker from an old vacuum tube radio and spare parts I had lying around in the house.Part 1: IntroductionPart 2: Attempting to update the audio hardwarePart 3: Using an existing Bluetooth speakerPart 4: Frontend workPart 5: Electronics, take 3As I explained in part 1, the electronics looked too old so I decided to replace it with a small Bluetooth audio amplifier board and two loud speakers.I ordered a TPA3116D2-based Bluetooth amplifier from Nobsound and a pair of MTX TX450C, 4 Ohms loud speakers. This article is the first of a series on creating a Bluetooth speaker from an old vacuum tube radio and spare parts I had lying around in the house.Part 1: IntroductionPart 2: Attempting to update the audio hardwarePart 3: Using an existing Bluetooth speakerPart 4: Frontend workPart 5: Electronics, take 3At the time I am writing this, the speaker is not done yet, so there is still a chance that I never finish it... As you will see, the journey so far as not been straight, I hit a few roadblocks and changed my mind while working on this project.Let's start with the reason I started this project. When we moved in our house, more than a decade ago, I found this old vacuum tube radio left around by the previous owner:I have always wanted to make something out of it, but never took the time to do so, until last month. Read more... Hey, I am making a game! A retro arcade racing game called Pixel Wheels! Check it out!

TAGS:Blog agateau com 

<<< Thank you for your visit >>>

Websites to related :
Buy Gold Bullion - Gold Buying

  BuyGoldBullion.com - Everything You Need to Know About Buying Gold For many centuries, gold has been recognized as one of the best ways to preserve we

CSS-Tricks

  We expect a line to break when the text on that line reaches the parent box boundaries. We see this every time we create a paragraph, just like this o

HOME | MPS

  Partnering with Government Agenciesfor Financial AccountabilityHOMETEAMSERVICESCONTACTMoreMaking NotesMature BusinesswomanBusiness Team Research 1/5Ou

GunsAmerica - Buy Guns and Sel

  *We Never share your email without your permission. Already a Member? Login NIB Walther PPQ Q5 Match, 9mm, 5" barrel, adjustable rear sight, front fi

Welcome to the premier site for

  Maratac/Zulu Strap line is available here MARATAC Now available, Specter Gear Tactical Equipment Specter Gear NRC COMPLIANCE NOTICE: All gaseous

Saugus Football | Official Site

  This page is having a slideshow that uses Javascript. Your browser either doesn't support Javascript or you have it turned off. To see this page as it

TeamPages - San Dimas High Schoo

  Sports Physicals2017-04-25 01:39 PDTSan Dimas High School FootballPhysicals will take place on Thursday, May 10th between 5:30 – 8:00. This year they

Kentwood Football

  This website will not work correctly using Internet Explorer. Please use a modern browser like Google Chrome.

Indian Sex Cams Girls from Desi

  You will enjoy watching this amazing indian xxx chat rooms sex scene from a Bhojpuri movie. This hot actress comes to the bathroom to take a shower be

HOME | lowndesfootball

  State Champions 1980, 1999, 2004, 2005, 2007HOMESCHEDULE STATSROSTERSTD CLUBFACILITIESFANSHISTORYTICKETSSTADIUM DIRECTIONSMoreSeason Ticket Informatio

ads

Hot Websites