/***************************************************************************
 * tabsongtest.cpp
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2004-2007 the KTabEdit development team <mrgwen@gmail.com>
 ***************************************************************************/

/***************************************************************************
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * See the file COPYING for more information.
 ***************************************************************************/

#include "songviewcommandtest.h"

#include "src/header.h"

#include "src/tablature/tabnote.h"
#include "src/tablature/tabtimes.h"
#include "src/tablature/tabbar.h"
#include "src/tablature/tabtrack.h"
#include "src/tablature/tabsong.h"
#include "src/songview.h"
#include "src/songviewcommands.h"

#include <qtest_kde.h>

const QString SongViewCommandTest::title("title");
const QString SongViewCommandTest::subtitle("subtitle");
const QString SongViewCommandTest::artist("artist");
const QString SongViewCommandTest::album("album");
const QString SongViewCommandTest::author("author");
const QString SongViewCommandTest::copyright("copyright");
const QString SongViewCommandTest::transcriber("transcriber");
const QString SongViewCommandTest::instructions("instructions");
const QString SongViewCommandTest::comments("comments");
const QString SongViewCommandTest::majorKey("C");
const QString SongViewCommandTest::minorKey("Am");
const QString SongViewCommandTest::lyrics("ThisIsASample");
const uint SongViewCommandTest::tempo = 80;
const int SongViewCommandTest::octave = 0;
const int SongViewCommandTest::lyricsTrack = 1;
const int SongViewCommandTest::lyricsMeasure = 2;

TabProperties SongViewCommandTest::buildProperties() const
{
	TabProperties tabProperties;
	
	tabProperties.setTitle(title);
	tabProperties.setSubTitle(subtitle);
	tabProperties.setArtist(artist);
	tabProperties.setAlbum(album);
	tabProperties.setAuthor(author);
	tabProperties.setCopyright(copyright);
	tabProperties.setTranscriber(transcriber);
	tabProperties.setInstructions(instructions);
	tabProperties.setComments(comments);
	tabProperties.setShuffle(true);
	tabProperties.setTempo(tempo);
	tabProperties.setOctave(octave);
	tabProperties.setKey(0);
	tabProperties.setMinor(true);
	tabProperties.setLyricsTrack(lyricsTrack);
	tabProperties.setLyricsMeasure(lyricsTrack, lyricsMeasure);
	tabProperties.setLyrics(lyricsMeasure, lyrics);
	
	return tabProperties;
}

void SongViewCommandTest::testSetSongProperties()
{
	TabSong properties;
	TabProperties newProperties = buildProperties();
	QUndoCommand* command = new SongView::SetSongPropCommand(&properties, newProperties);
	
	command->redo();
	//QCOMPARE( properties.songProperties(), newProperties );
	
	command->undo();
	//QCOMPARE( properties.songProperties(), TabProperties() );
}

QTEST_KDEMAIN(SongViewCommandTest, NoGUI)
#include "songviewcommandtest.moc"
