示例#1
0
void wxExVCSCommandOnSTC(
    const wxExVCSCommand& command,
    const wxExLexer& lexer,
    wxExSTC* stc)
{
    if (command.IsBlame())
    {
        // Do not show an edge for blamed documents, they are too wide.
        stc->SetEdgeMode(wxSTC_EDGE_NONE);
    }

    if (command.IsDiff())
    {
        stc->SetLexer("diff");
    }
    else if (command.IsHistory())
    {
        stc->SetLexer("");
    }
    else if (command.IsOpen())
    {
        stc->SetLexer(lexer.GetScintillaLexer());
    }
    else
    {
        stc->SetLexer(wxEmptyString);
    }
}
示例#2
0
// Name:      test-vcscommand.cpp
// Purpose:   Implementation for wxExtension unit testing
// Author:    Anton van Wezenbeek
// Copyright: (c) 2015 Anton van Wezenbeek
////////////////////////////////////////////////////////////////////////////////

#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/extension/vcscommand.h>
#include "test.h"

TEST_CASE("wxExVCSCommand", "[vcs]")
{
  const wxExVCSCommand add("a&dd");
  const wxExVCSCommand blame("blame");
  const wxExVCSCommand co("checkou&t");
  const wxExVCSCommand commit("commit", "main");
  const wxExVCSCommand diff("diff", "popup", "submenu");
  const wxExVCSCommand log("log", "main");
  const wxExVCSCommand help("h&elp", "error", "", "m&e");
  const wxExVCSCommand update("update");
  const wxExVCSCommand none;

  REQUIRE(add.GetCommand() == "add");
  REQUIRE(add.GetCommand(true, true) == "a&dd");
  
  REQUIRE(add.IsAdd());
  REQUIRE(blame.IsBlame());
  REQUIRE(co.IsCheckout());